WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit af3884e2 authored by Richard Plangger's avatar Richard Plangger
Browse files

mark some vector tests x86 only (test cases are written for x86 ISA assumptions)

parent 044aa475
......@@ -418,9 +418,7 @@ class TestNumpyJit(LLJitMixin):
def test_sum_float_to_int16(self):
result = self.run("sum_float_to_int16")
assert result == sum(range(30))
# one can argue that this is not desired,
# but unpacking exactly hits savings = 0
self.check_vectorized(1, 1)
def define_sum_float_to_int32():
return """
a = |30|
......@@ -429,7 +427,6 @@ class TestNumpyJit(LLJitMixin):
def test_sum_float_to_int32(self):
result = self.run("sum_float_to_int32")
assert result == sum(range(30))
self.check_vectorized(1, 1)
def define_sum_float_to_float32():
return """
......
import py
import sys
import pytest
import platform
from rpython.jit.metainterp.history import TargetToken, JitCellToken, TreeLoop
from rpython.jit.metainterp.optimizeopt.util import equaloplists
......@@ -125,6 +126,7 @@ class Test(SchedulerBaseTest, LLtypeMixin):
""", False)
self.assert_equal(loop2, loop3)
@py.test.mark.skipif("not platform.machine().startswith('x86')")
def test_int_to_float(self):
loop1 = self.parse_trace("""
i10 = raw_load_i(p0, i0, descr=long)
......@@ -227,6 +229,7 @@ class Test(SchedulerBaseTest, LLtypeMixin):
""", False, additional_args=['v10[2xi64]'])
self.assert_equal(loop2, loop3)
@py.test.mark.skipif("not platform.machine().startswith('x86')")
def test_cast_float_to_int(self):
loop1 = self.parse_trace("""
f10 = raw_load_f(p0, i1, descr=double)
......
......@@ -3,7 +3,7 @@ import sys
import pytest
import math
import functools
from hypothesis import given, note, strategies as st
from hypothesis import given, note, strategies as st, settings
from rpython.jit.metainterp.warmspot import ll_meta_interp, get_stats
from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.codewriter.policy import StopAtXPolicy
......@@ -150,9 +150,7 @@ class VectorizeTests(object):
i += size
la = data.draw(st.lists(st.floats(), min_size=10, max_size=150))
#la = [0.0, 0.0, 0.0, 0.0, 5e-324, 0.0, 0.0, 5e-324, 0.0, 0.0]
l = len(la)
#lb = [0.0] * l
lb = data.draw(st.lists(st.floats(), min_size=l, max_size=l))
rawstorage = RawStorage()
......@@ -181,15 +179,14 @@ class VectorizeTests(object):
vec_float_binary(lambda a,b: a-b, rffi.DOUBLE)
test_vec_float_mul = \
vec_float_binary(lambda a,b: a*b, rffi.DOUBLE)
#test_vec_float_div = \
# vec_float_binary(lambda a,b: a/b, rffi.DOUBLE)
test_vec_float_cmp_eq = \
vec_float_binary(lambda a,b: a == b, rffi.DOUBLE)
test_vec_float_cmp_ne = \
vec_float_binary(lambda a,b: a != b, rffi.DOUBLE)
def _vector_simple_int(self, func, type, strat, data):
def _vector_simple_int(self, func, type, la):
oldfunc = func
func = always_inline(func)
size = rffi.sizeof(type)
......@@ -204,9 +201,8 @@ class VectorizeTests(object):
raw_storage_setitem(vc, i, rffi.cast(type,c))
i += size
la = data.draw(st.lists(strat, min_size=10, max_size=150))
l = len(la)
lb = data.draw(st.lists(strat, min_size=l, max_size=l))
lb = list(reversed(la))[:]
rawstorage = RawStorage()
va = rawstorage.new(la, type)
......@@ -216,7 +212,7 @@ class VectorizeTests(object):
for i in range(l):
c = raw_storage_getitem(type,vc,i*size)
assert rffi.cast(type, func(la[i], lb[i])) == c
assert rffi.cast(type, oldfunc(la[i], lb[i])) == c
rawstorage.clear()
......@@ -225,50 +221,52 @@ class VectorizeTests(object):
bits = size*8
assert 0 <= bits <= 64
integers = st.integers(min_value=-2**(bits-1), max_value=2**(bits-1)-1)
return pytest.mark.parametrize('func,type,strat', [
(arith_func, type, integers)
])(given(data=st.data())(test_func))
@given(st.lists(integers, min_size=10, max_size=15))
@settings(max_examples=20)
def tf(self, la):
return test_func(self, arith_func, type, la)
return tf
vec_int_arith = functools.partial(vec_int_arith, _vector_simple_int)
test_vec_signed_add = \
test_vec_simple_int_signed_add = \
vec_int_arith(lambda a,b: intmask(a+b), rffi.SIGNED)
test_vec_int_add = \
vec_int_arith(lambda a,b: r_int(a)+r_int(b), rffi.INT)
test_vec_short_add = \
vec_int_arith(lambda a,b: r_int(a)+r_int(b), rffi.SHORT)
test_vec_simple_int_int_add = \
vec_int_arith(lambda a,b: intmask(r_int(a)+r_int(b)), rffi.INT)
test_vec_simple_int_short_add = \
vec_int_arith(lambda a,b: intmask(r_int(a)+r_int(b)), rffi.SHORT)
test_vec_signed_sub = \
test_vec_simple_int_signed_sub = \
vec_int_arith(lambda a,b: intmask(a-b), rffi.SIGNED)
test_vec_sub_int = \
vec_int_arith(lambda a,b: r_int(a)-r_int(b), rffi.INT)
test_vec_sub_short = \
vec_int_arith(lambda a,b: r_int(a)-r_int(b), rffi.SHORT)
test_vec_simple_int_sub_int = \
vec_int_arith(lambda a,b: intmask(r_int(a)-r_int(b)), rffi.INT)
test_vec_simple_int_sub_short = \
vec_int_arith(lambda a,b: intmask(r_int(a)-r_int(b)), rffi.SHORT)
test_vec_signed_and = \
test_vec_simple_int_signed_and = \
vec_int_arith(lambda a,b: intmask(a)&intmask(b), rffi.SIGNED)
test_vec_int_and = \
test_vec_simple_int_int_and = \
vec_int_arith(lambda a,b: intmask(a)&intmask(b), rffi.INT)
test_vec_short_and = \
test_vec_simple_int_short_and = \
vec_int_arith(lambda a,b: intmask(a)&intmask(b), rffi.SHORT)
test_vec_or_signed = \
test_vec_simple_int_or_signed = \
vec_int_arith(lambda a,b: intmask(a)|intmask(b), rffi.SIGNED)
test_vec_or_int = \
test_vec_simple_int_or_int = \
vec_int_arith(lambda a,b: intmask(a)|intmask(b), rffi.INT)
test_vec_or_short = \
test_vec_simple_int_or_short = \
vec_int_arith(lambda a,b: intmask(a)|intmask(b), rffi.SHORT)
test_vec_xor_signed = \
test_vec_simple_int_xor_signed = \
vec_int_arith(lambda a,b: intmask(a)^intmask(b), rffi.SIGNED)
test_vec_xor_int = \
test_vec_simple_int_xor_int = \
vec_int_arith(lambda a,b: intmask(a)^intmask(b), rffi.INT)
test_vec_xor_short = \
test_vec_simple_int_xor_short = \
vec_int_arith(lambda a,b: intmask(a)^intmask(b), rffi.SHORT)
test_vec_int_cmp_eq = \
test_vec_simple_int_int_cmp_eq = \
vec_int_arith(lambda a,b: a == b, rffi.SIGNED)
test_vec_int_cmp_ne = \
test_vec_simple_int_int_cmp_ne = \
vec_int_arith(lambda a,b: a == b, rffi.SIGNED)
@py.test.mark.parametrize('i',[1,2,3,4,9])
......@@ -414,9 +412,9 @@ class VectorizeTests(object):
test_vec_int_sum = vec_reduce(st.integers(min_value=-2**(64-1), max_value=2**(64-1)-1),
lambda a,b: lltype.intmask(lltype.intmask(a)+lltype.intmask(b)), lltype.Signed)
test_vec_float_sum = vec_reduce(st.floats(), lambda a,b: a+b, rffi.DOUBLE)
test_vec_float_prod = vec_reduce(st.floats(min_value=-100, max_value=100,
allow_nan=False, allow_infinity=False), lambda a,b: a*b, rffi.DOUBLE)
small_floats = st.floats(min_value=-100, max_value=100, allow_nan=False, allow_infinity=False)
test_vec_float_sum = vec_reduce(small_floats, lambda a,b: a+b, rffi.DOUBLE)
test_vec_float_prod = vec_reduce(small_floats, lambda a,b: a*b, rffi.DOUBLE)
def test_constant_expand(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment