Author: Brian Kearns <bdkea...@gmail.com>
Branch: numpy-speed
Changeset: r70709:cc857b7e9422
Date: 2014-04-17 03:30 -0400
http://bitbucket.org/pypy/pypy/changeset/cc857b7e9422/

Log:    virtualize the array iter in dot

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
@@ -270,7 +270,10 @@
 
 dot_driver = jit.JitDriver(name = 'numpy_dot',
                            greens = ['dtype'],
-                           reds = 'auto')
+                           reds=['n', 's1', 's2', 'i1', 'i2', 'i',
+                                 'left_impl', 'right_impl', 'result',
+                                 'outi', 'lefti', 'righti', 'oval'],
+                           virtualizables=['outi'])
 
 def multidim_dot(space, left, right, result, dtype, right_critical_dim):
     ''' assumes left, right are concrete arrays
@@ -306,7 +309,11 @@
             i = 0
             while i < n:
                 i += 1
-                dot_driver.jit_merge_point(dtype=dtype)
+                dot_driver.jit_merge_point(dtype=dtype,
+                    n=n, s1=s1, s2=s2, i1=i1, i2=i2, i=i,
+                    left_impl=left_impl, right_impl=right_impl, result=result,
+                    outi=outi, lefti=lefti, righti=righti, oval=oval,
+                )
                 lval = left_impl.getitem(i1).convert_to(space, dtype)
                 rval = right_impl.getitem(i2).convert_to(space, dtype)
                 oval = dtype.itemtype.add(oval, dtype.itemtype.mul(lval, rval))
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
@@ -569,31 +569,32 @@
             'raw_load': 2,
         })
         self.check_resops({
-            'cond_call': 6,
+            'cond_call': 4,
             'float_add': 2,
             'float_mul': 2,
             'getarrayitem_gc': 7,
             'getarrayitem_gc_pure': 15,
-            'getfield_gc': 41,
+            'getfield_gc': 35,
             'getfield_gc_pure': 39,
             'guard_class': 4,
-            'guard_false': 14,
+            'guard_false': 18,
             'guard_nonnull': 12,
             'guard_nonnull_class': 4,
             'guard_not_invalidated': 2,
             'guard_true': 13,
-            'guard_value': 4,
+            'guard_value': 6,
             'int_add': 25,
             'int_ge': 4,
             'int_le': 8,
             'int_lt': 11,
             'int_sub': 4,
             'jump': 3,
-            'ptr_ne': 6,
+            'ptr_eq': 4,
+            'ptr_ne': 4,
             'raw_load': 6,
             'raw_store': 1,
-            'setarrayitem_gc': 10,
-            'setfield_gc': 14,
+            'setarrayitem_gc': 7,
+            'setfield_gc': 10,
         })
 
     def define_argsort():
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to