1. agentultra
  2. pypy

Commits

Maciej Fijalkowski  committed 87a7b0a

Try to revert the vector ops. will do it differently

  • Participants
  • Parent commits 8100e72
  • Branches numpy-exp

Comments (0)

Files changed (6)

File pypy/jit/codewriter/jtransform.py

View file
             prepare = self._handle_jit_call
         elif oopspec_name.startswith('libffi_'):
             prepare = self._handle_libffi_call
-        elif oopspec_name.startswith('vector_'):
-            prepare = self._handle_vector_op
         else:
             prepare = self.prepare_builtin_call
         try:
             assert False, 'unsupported oopspec: %s' % oopspec_name
         return self._handle_oopspec_call(op, args, oopspecindex, extraeffect)
 
-    # ----------
-    # vector ops
-
-    def _handle_vector_op(self, op, oopspec_name, args):
-        if oopspec_name in ['vector_float_read',
-                            'vector_float_write',
-                            'vector_float_add']:
-            return SpaceOperation(oopspec_name, op.args, op.result)
-        else:
-            raise NotSupported(oopspec_name)
-
     def rewrite_op_jit_force_virtual(self, op):
         return self._do_builtin_call(op)
 

File pypy/jit/codewriter/test/test_jtransform.py

View file
     assert op1.args[1] == 'calldescr-%d' % effectinfo.EffectInfo.OS_ARRAYCOPY
     assert op1.args[2] == ListOfKind('int', [v3, v4, v5])
     assert op1.args[3] == ListOfKind('ref', [v1, v2])
-
-def test_vector_ops():
-    TP = lltype.Array(lltype.Float, hints={'nolength': True})
-    

File pypy/jit/metainterp/history.py

View file
 INT   = 'i'
 REF   = 'r'
 FLOAT = 'f'
-VECTOR = 'F'
 HOLE  = '_'
 VOID  = 'v'
 
     def forget_value(self):
         raise NotImplementedError
 
-class BoxVector(Box):
-    _attrs_ = ()
-
 class BoxInt(Box):
     type = INT
     _attrs_ = ('value',)

File pypy/jit/metainterp/test/test_optimizeopt.py

View file
         # not obvious, because of the exception UnicodeDecodeError that
         # can be raised by ll_str2unicode()
 
+
+
+
 ##class TestOOtype(OptimizeOptTest, OOtypeMixin):
 
 ##    def test_instanceof(self):

File pypy/rlib/rvector.py

-
-from pypy.rpython.extregistry import ExtRegistryEntry
-
-class VectorContainer(object):
-    """ Class that is a container for multiple float/int objects.
-    Can be represented at jit-level by a single register, like xmm
-    on x86 architecture
-    """
-
-class FloatVectorContainer(VectorContainer):
-    """ A container for float values
-    """
-    def __init__(self, val1, val2):
-        self.v1 = val1
-        self.v2 = val2
-
-    def __repr__(self):
-        return '<FloatVector %f %f>' % (self.v1, self.v2)
-
-def vector_float_read(arr, index):
-    return FloatVectorContainer(arr[index], arr[index + 1])
-vector_float_read.oopspec = 'vector_float_read(arr, index)'
-
-def vector_float_write(arr, index, container):
-    arr[index] = container.v1
-    arr[index + 1] = container.v2
-vector_float_write.oopspec = 'vector_from_write(arr, index, container)'
-
-def vector_float_add(left, right):
-    return FloatVectorContainer(left.v1 + right.v1, left.v2 + right.v2)
-vector_float_add.oopspec = 'vector_float_add(left, right)'

File pypy/rlib/test/test_rvector.py

-
-from pypy.rlib.rvector import (vector_float_read, vector_float_write,
-                               vector_float_add)
-from pypy.rpython.lltypesystem import lltype
-from pypy.rpython.test.test_llinterp import interpret
-
-TP = lltype.Array(lltype.Float, hints={'nolength': True})
-
-class TestRVector(object):
-    def test_direct_add(self):
-        a = lltype.malloc(TP, 16, flavor='raw')
-        b = lltype.malloc(TP, 16, flavor='raw')
-        res = lltype.malloc(TP, 16, flavor='raw')
-        a[0] = 1.2
-        a[1] = 1.3
-        b[0] = 0.1
-        b[1] = 0.3
-        a[10] = 8.3
-        a[11] = 8.1
-        b[10] = 7.8
-        b[11] = 7.6
-        f1 = vector_float_read(a, 0)
-        f2 = vector_float_read(b, 0)
-        vector_float_write(res, 2, vector_float_add(f1, f2))
-        assert res[2] == 1.2 + 0.1
-        assert res[3] == 1.3 + 0.3
-        f1 = vector_float_read(a, 10)
-        f2 = vector_float_read(b, 10)
-        vector_float_write(res, 8, vector_float_add(f1, f2))
-        assert res[8] == 8.3 + 7.8
-        assert res[9] == 8.1 + 7.6
-        lltype.free(a, flavor='raw')
-        lltype.free(b, flavor='raw')
-        lltype.free(res, flavor='raw')
-
-    def test_interpret(self):
-        def f():
-            a = lltype.malloc(TP, 16, flavor='raw')
-            b = lltype.malloc(TP, 16, flavor='raw')
-            res = lltype.malloc(TP, 16, flavor='raw')
-            try:
-                a[0] = 1.2
-                a[1] = 1.3
-                b[0] = 0.1
-                b[1] = 0.3
-                f1 = vector_float_read(a, 0)
-                f2 = vector_float_read(b, 0)
-                vector_float_write(res, 8, vector_float_add(f1, f2))
-                return res[8] * 100 + res[9]
-            finally:
-                lltype.free(a, flavor='raw')
-                lltype.free(b, flavor='raw')
-                lltype.free(res, flavor='raw')
-
-        res = interpret(f, [])
-        assert res == f()