[pypy-svn] pypy numpy-exp: Try to revert the vector ops. will do it differently
fijal
commits-noreply at bitbucket.org
Wed May 4 12:05:33 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-exp
Changeset: r43879:87a7b0aeccfc
Date: 2011-05-04 12:03 +0200
http://bitbucket.org/pypy/pypy/changeset/87a7b0aeccfc/
Log: Try to revert the vector ops. will do it differently
diff --git a/pypy/jit/codewriter/jtransform.py b/pypy/jit/codewriter/jtransform.py
--- a/pypy/jit/codewriter/jtransform.py
+++ b/pypy/jit/codewriter/jtransform.py
@@ -351,8 +351,6 @@
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:
@@ -1353,17 +1351,6 @@
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)
diff --git a/pypy/jit/codewriter/test/test_jtransform.py b/pypy/jit/codewriter/test/test_jtransform.py
--- a/pypy/jit/codewriter/test/test_jtransform.py
+++ b/pypy/jit/codewriter/test/test_jtransform.py
@@ -947,7 +947,3 @@
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})
-
diff --git a/pypy/jit/metainterp/history.py b/pypy/jit/metainterp/history.py
--- a/pypy/jit/metainterp/history.py
+++ b/pypy/jit/metainterp/history.py
@@ -15,7 +15,6 @@
INT = 'i'
REF = 'r'
FLOAT = 'f'
-VECTOR = 'F'
HOLE = '_'
VOID = 'v'
@@ -512,9 +511,6 @@
def forget_value(self):
raise NotImplementedError
-class BoxVector(Box):
- _attrs_ = ()
-
class BoxInt(Box):
type = INT
_attrs_ = ('value',)
diff --git a/pypy/jit/metainterp/test/test_optimizeopt.py b/pypy/jit/metainterp/test/test_optimizeopt.py
--- a/pypy/jit/metainterp/test/test_optimizeopt.py
+++ b/pypy/jit/metainterp/test/test_optimizeopt.py
@@ -5718,6 +5718,9 @@
# not obvious, because of the exception UnicodeDecodeError that
# can be raised by ll_str2unicode()
+
+
+
##class TestOOtype(OptimizeOptTest, OOtypeMixin):
## def test_instanceof(self):
diff --git a/pypy/rlib/rvector.py b/pypy/rlib/rvector.py
deleted file mode 100644
--- a/pypy/rlib/rvector.py
+++ /dev/null
@@ -1,31 +0,0 @@
-
-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)'
diff --git a/pypy/rlib/test/test_rvector.py b/pypy/rlib/test/test_rvector.py
deleted file mode 100644
--- a/pypy/rlib/test/test_rvector.py
+++ /dev/null
@@ -1,56 +0,0 @@
-
-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()
More information about the Pypy-commit
mailing list