Commits

Maciej Fijalkowski  committed c1a1b50

and this is why we need zjit tests. run them

  • Participants
  • Parent commits 665e056
  • Branches numpy-reintroduce-jit-drivers

Comments (0)

Files changed (3)

File pypy/module/micronumpy/compile.py

 
     def is_true(self, w_obj):
         assert isinstance(w_obj, BoolObject)
-        return w_obj.boolval
+        return False
+        #return w_obj.boolval
 
     def is_w(self, w_obj, w_what):
         return w_obj is w_what
             elif self.name == "unegative":
                 neg = interp_ufuncs.get(interp.space).negative
                 w_res = neg.call(interp.space, [arr])
+            elif self.name == "cos":
+                cos = interp_ufuncs.get(interp.space).cos
+                w_res = cos.call(interp.space, [arr])                
             elif self.name == "flat":
                 w_res = arr.descr_get_flatiter(interp.space)
             elif self.name == "tostring":
                 arr.descr_tostring(interp.space)
                 w_res = None
-            elif self.name == "count_nonzero":
-                w_res = arr.descr_count_nonzero(interp.space)
             else:
                 assert False # unreachable code
         elif self.name in TWO_ARG_FUNCTIONS:

File pypy/module/micronumpy/loop.py

     return target
 
 reduce_driver = jit.JitDriver(name='numpy_reduce',
-                              greens = ['shapelen', 'func', 'calc_dtype',
-                                        'identity', 'done_func'],
+                              greens = ['shapelen', 'func', 'done_func',
+                                        'calc_dtype', 'identity'],
                               reds = ['obj', 'obj_iter', 'cur_value'])
 
 def compute_reduce(obj, calc_dtype, func, done_func, identity):
 
 where_driver = jit.JitDriver(name='numpy_where',
                              greens = ['shapelen', 'dtype', 'arr_dtype'],
-                             reds = ['shape', 'arr', 'x', 'y','arr_iter',
-                                     'x_iter', 'y_iter', 'iter'])
+                             reds = ['shape', 'arr', 'x', 'y','arr_iter', 'out',
+                                     'x_iter', 'y_iter', 'iter', 'out_iter'])
 
 def where(out, shape, arr, x, y, dtype):
     out_iter = out.create_iter(shape)
         where_driver.jit_merge_point(shapelen=shapelen, shape=shape,
                                      dtype=dtype, iter=iter, x_iter=x_iter,
                                      y_iter=y_iter, arr_iter=arr_iter,
-                                     arr=arr, x=x, y=y, arr_dtype=arr_dtype)
+                                     arr=arr, x=x, y=y, arr_dtype=arr_dtype,
+                                     out_iter=out_iter, out=out)
         w_cond = arr_iter.getitem()
         if arr_dtype.itemtype.bool(w_cond):
             w_val = x_iter.getitem().convert_to(dtype)

File pypy/module/micronumpy/test/test_zjit.py

 good assembler
 """
 
-import py
-py.test.skip("this is going away")
-
 from pypy.jit.metainterp import pyjitpl
 from pypy.jit.metainterp.test.support import LLJitMixin
 from pypy.jit.metainterp.warmspot import reset_stats
 from pypy.module.micronumpy import interp_boxes
-from pypy.module.micronumpy.compile import (FakeSpace,
-    IntObject, Parser, InterpreterState)
-from pypy.module.micronumpy.interp_numarray import (W_NDimArray,
-     BaseArray, W_FlatIterator)
-from pypy.rlib.nonconst import NonConstant
-
+from pypy.module.micronumpy.compile import FakeSpace, Parser, InterpreterState
+from pypy.module.micronumpy.base import W_NDimArray
 
 class TestNumpyJIt(LLJitMixin):
     graph = None
             if not len(interp.results):
                 raise Exception("need results")
             w_res = interp.results[-1]
-            if isinstance(w_res, BaseArray):
-                concr = w_res.get_concrete_or_scalar()
-                sig = concr.find_sig()
-                frame = sig.create_frame(concr)
-                w_res = sig.eval(frame, concr)
+            if isinstance(w_res, W_NDimArray):
+                w_res = w_res.create_iter().getitem()
             if isinstance(w_res, interp_boxes.W_Float64Box):
                 return w_res.value
             if isinstance(w_res, interp_boxes.W_Int64Box):