Author: Richard Plangger <planri...@gmail.com>
Branch: vecopt-merge
Changeset: r79850:9236f6c98306
Date: 2015-09-26 10:00 +0200
http://bitbucket.org/pypy/pypy/changeset/9236f6c98306/

Log:    translation issues, zero_deps guards would produce cycle, remove
        them

diff --git a/rpython/jit/metainterp/optimizeopt/dependency.py 
b/rpython/jit/metainterp/optimizeopt/dependency.py
--- a/rpython/jit/metainterp/optimizeopt/dependency.py
+++ b/rpython/jit/metainterp/optimizeopt/dependency.py
@@ -62,6 +62,9 @@
             return None
         return self.path[-1]
 
+    def first(self):
+        return self.path[0]
+
     def is_always_pure(self, exclude_first=False, exclude_last=False):
         last = len(self.path)-1
         count = len(self.path)
@@ -596,19 +599,6 @@
             # the label operation defines all operations at the
             # beginning of the loop
 
-            # TODO if op.getopnum() == rop.LABEL and i != jump_pos:
-            #    node.setpriority(100)
-            #    label_pos = i
-            #    for arg in op.getarglist():
-            #        tracker.define(arg, node)
-            #    continue # prevent adding edge to the label itself
-            #elif node.is_guard_early_exit():
-            #    label_node = self.nodes[label_pos]
-            #    label_node.edge_to(node,None,label='L->EE')
-            #    for arg in label_node.getoperation().getarglist():
-            #        tracker.define(arg, node)
-            #    continue
-
             intformod.inspect_operation(op,node)
             # definition of a new variable
             if op.type != 'v':
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py 
b/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py
@@ -1235,6 +1235,7 @@
         self.assert_equal(trace, trace_opt)
 
     def test_axis_sum(self):
+        # TODO
         trace = """
         [i1, p10, i11, p8, i12, p3, p4, p13, i14, i15, p6, p9, i16, i17, i18, 
i19, i20, i21, i22, i23]
         f24 = raw_load_f(i16, i12, descr=floatarraydescr)
@@ -1257,11 +1258,8 @@
         guard_false(i39) [i1, p9, p8, p6, p4, p3, i33, i38, None, None, i26, 
i11, None, p13, None, None, p10]
         jump(i1, p10, i11, p8, i26, p3, p4, p13, i33, i38, p6, p9, i16, i17, 
i18, i19, i20, i21, i22, i23)
         """
-        try:
-            self.vectorize(self.parse_loop(trace))
-            py.test.fail("axis sum is not profitable")
-        except NotAProfitableLoop:
-            pass
+        loop = self.parse_loop(trace)
+        self.vectorize(loop)
 
     def test_cast_1(self):
         # TODO
diff --git a/rpython/jit/metainterp/optimizeopt/vector.py 
b/rpython/jit/metainterp/optimizeopt/vector.py
--- a/rpython/jit/metainterp/optimizeopt/vector.py
+++ b/rpython/jit/metainterp/optimizeopt/vector.py
@@ -103,7 +103,9 @@
                     loop_info, loop_ops, jitcell_token=None):
     """ Enter the world of SIMD. Bails if it cannot transform the trace. """
     user_code = not jitdriver_sd.vec and warmstate.vec_all
-    loop = VectorLoop(loop_info.label_op, loop_ops[1:-1], loop_ops[-1])
+    e = len(loop_ops)-1
+    assert e > 0
+    loop = VectorLoop(loop_info.label_op, loop_ops[1:e], loop_ops[-1])
     if user_code and user_loop_bail_fast_path(loop, warmstate):
         return loop_info, loop_ops
     # the original loop (output of optimize_unroll)
@@ -515,6 +517,8 @@
             modify_later = []
             last_prev_node = None
             valid = True
+            if guard_node in zero_deps:
+                del zero_deps[guard_node]
             for prev_dep in guard_node.depends():
                 prev_node = prev_dep.to
                 if prev_dep.is_failarg():
@@ -551,6 +555,7 @@
                 self.mark_guard(guard_node, loop)
         for node in zero_deps.keys():
             assert not node.is_imaginary()
+            print "edge to", node
             earlyexit.edge_to(node)
         if one_valid:
             return graph
diff --git a/rpython/jit/metainterp/warmspot.py 
b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -177,6 +177,7 @@
 
 def reset_jit():
     """Helper for some tests (see micronumpy/test/test_zjit.py)"""
+    from rpython.jit.metainterp import counter
     reset_stats()
     pyjitpl._warmrunnerdesc.memory_manager.alive_loops.clear()
     pyjitpl._warmrunnerdesc.jitcounter._clear_all()
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to