[pypy-commit] pypy vecopt: removed the unpacking of the values in the trace of call2

plan_rich noreply at buildbot.pypy.org
Tue Jun 2 11:21:48 CEST 2015


Author: Richard Plangger <rich at pasra.at>
Branch: vecopt
Changeset: r77755:dd7d048468f6
Date: 2015-06-02 11:21 +0200
http://bitbucket.org/pypy/pypy/changeset/dd7d048468f6/

Log:	removed the unpacking of the values in the trace of call2

diff --git a/pypy/module/micronumpy/iterators.py b/pypy/module/micronumpy/iterators.py
--- a/pypy/module/micronumpy/iterators.py
+++ b/pypy/module/micronumpy/iterators.py
@@ -145,7 +145,9 @@
             jit.promote(elsize)
             offset += elsize
         elif self.ndim_m1 == 0:
-            offset += self.strides[0]
+            stride = self.strides[0]
+            jit.promote(stride)
+            offset += stride
         else:
             for i in xrange(self.ndim_m1, -1, -1):
                 idx = indices[i]
diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py
--- a/pypy/module/micronumpy/loop.py
+++ b/pypy/module/micronumpy/loop.py
@@ -73,9 +73,16 @@
         if right_iter:
             w_right = right_iter.getitem(right_state).convert_to(space, calc_dtype)
             right_state = right_iter.next(right_state)
-        out_iter.setitem(out_state, func(calc_dtype, w_left, w_right).convert_to(
-            space, res_dtype))
+        w_out = func(calc_dtype, w_left, w_right)
+        out_iter.setitem(out_state, w_out.convert_to(space, res_dtype))
         out_state = out_iter.next(out_state)
+        # if not set to None, the values will be loop carried, forcing
+        # the vectorization to unpack the vector registers at the end
+        # of the loop
+        if left_iter:
+            w_left = None
+        if right_iter:
+            w_right = None
     return out
 
 call1_driver = jit.JitDriver(
diff --git a/pypy/module/micronumpy/test/test_zjit.py b/pypy/module/micronumpy/test/test_zjit.py
--- a/pypy/module/micronumpy/test/test_zjit.py
+++ b/pypy/module/micronumpy/test/test_zjit.py
@@ -488,7 +488,8 @@
     def test_setslice(self):
         result = self.run("setslice")
         assert result == 5.5
-        self.check_vectorized(1, 0) # TODO?
+        self.check_trace_count(1)
+        self.check_vectorized(1, 1)
 
     def define_virtual_slice():
         return """


More information about the pypy-commit mailing list