[pypy-commit] pypy matrixmath-dot: progress

mattip noreply at buildbot.pypy.org
Fri Jan 20 15:41:51 CET 2012


Author: mattip
Branch: matrixmath-dot
Changeset: r51539:a2e2a35726cc
Date: 2012-01-20 11:12 +0200
http://bitbucket.org/pypy/pypy/changeset/a2e2a35726cc/

Log:	progress

diff --git a/pypy/module/micronumpy/dot.py b/pypy/module/micronumpy/dot.py
--- a/pypy/module/micronumpy/dot.py
+++ b/pypy/module/micronumpy/dot.py
@@ -7,8 +7,8 @@
 
 
 dot_driver = jit.JitDriver(
-    greens=['shapelen', 'left', 'right'],
-    reds=['lefti', 'righti', 'outi', 'result'],
+    greens=['shape_len', 'left'],
+    reds=['lefti', 'righti', 'outi', 'result', 'right'],
     get_printable_location=new_printable_location('dot'),
     name='dot',
 )
@@ -55,7 +55,7 @@
                                          if i != right_critical_dim]
     right_skip = range(len(left.shape) - 1)
     result_skip = [len(result.shape) - 1]
-    shapelen = len(broadcast_shape)
+    shape_len = len(broadcast_shape)
     _r = calculate_dot_strides(result.strides, result.backstrides,
                                   broadcast_shape, result_skip)
     outi = ViewIterator(0, _r[0], _r[1], broadcast_shape)
@@ -78,9 +78,9 @@
                        right.getitem(righti.offset))
         value = add(dtype, v, result.getitem(outi.offset))
         result.setitem(outi.offset, value)
-        outi = outi.next(shapelen)
-        righti = righti.next(shapelen)
-        lefti = lefti.next(shapelen)
+        outi = outi.next(shape_len)
+        righti = righti.next(shape_len)
+        lefti = lefti.next(shape_len)
     assert lefti.done()
     assert righti.done()
     return result
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
@@ -368,16 +368,15 @@
                                 'int_ge': 1, 'guard_false': 1, 'jump': 1,
                                 'arraylen_gc': 1})
 
-    def ddefine_dot():
+    def define_dot():
         return """
         a = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
         b=[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]]
-        c = a.dot(b)
+        c = dot(a, b)
         c -> 1 -> 2
         """
 
     def test_dot(self):
-        py.test.skip("not yet")
         result = self.run("dot")
         assert result == 184
         self.check_simple_loop({})


More information about the pypy-commit mailing list