[pypy-commit] pypy ppc-vsx-support: remove some unused options, change some tests in micronumpy
plan_rich
pypy.commits at gmail.com
Wed Sep 21 09:55:46 EDT 2016
Author: Richard Plangger <planrichi at gmail.com>
Branch: ppc-vsx-support
Changeset: r87270:c712f368bb91
Date: 2016-09-21 15:55 +0200
http://bitbucket.org/pypy/pypy/changeset/c712f368bb91/
Log: remove some unused options, change some tests in micronumpy
diff --git a/pypy/module/pypyjit/test_pypy_c/test_micronumpy.py b/pypy/module/pypyjit/test_pypy_c/test_micronumpy.py
--- a/pypy/module/pypyjit/test_pypy_c/test_micronumpy.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_micronumpy.py
@@ -7,19 +7,19 @@
class TestMicroNumPy(BaseTestPyPyC):
arith_comb = [('+','float','float', 4*3427, 3427, 1.0,3.0),
- ('+','float','int', 9*7843, 7843, 4.0,5.0),
- ('+','int','float', 8*2571, 2571, 9.0,-1.0),
- ('+','float','int', -18*2653, 2653, 4.0,-22.0),
- ('+','int','int', -1*1499, 1499, 24.0,-25.0),
- ('-','float','float', -2*5523, 5523, 1.0,3.0),
- ('*','float','float', 3*2999, 2999, 1.0,3.0),
- ('/','float','float', 3*7632, 7632, 3.0,1.0),
- ('/','float','float', 1.5*7632, 7632, 3.0,2.0),
- ('&','int','int', 0, 1500, 1,0),
- ('&','int','int', 1500, 1500, 1,1),
- ('|','int','int', 1500, 1500, 0,1),
- ('|','int','int', 0, 1500, 0,0),
- ]
+ ('+','float','int', 9*7843, 7843, 4.0,5.0),
+ ('+','int','float', 8*2571, 2571, 9.0,-1.0),
+ ('+','float','int', -18*2653, 2653, 4.0,-22.0),
+ ('+','int','int', -1*1499, 1499, 24.0,-25.0),
+ ('-','float','float', -2*5523, 5523, 1.0,3.0),
+ ('*','float','float', 3*2999, 2999, 1.0,3.0),
+ ('/','float','float', 3*7632, 7632, 3.0,1.0),
+ ('/','float','float', 1.5*7632, 7632, 3.0,2.0),
+ ('&','int','int', 0, 1500, 1,0),
+ ('&','int','int', 1500, 1500, 1,1),
+ ('|','int','int', 1500, 1500, 0,1),
+ ('|','int','int', 0, 1500, 0,0),
+ ]
type_permuated = []
types = { 'int': ['int32','int64','int8','int16'],
'float': ['float32', 'float64']
@@ -54,7 +54,10 @@
assert log.jit_summary.vecopt_tried == 0
assert log.jit_summary.vecopt_success == 0
assert vlog.jit_summary.vecopt_tried > 0
- assert vlog.jit_summary.vecopt_success > 0
+ if adtype in ('int64','float64') and bdtype in ('int64','float64'):
+ assert vlog.jit_summary.vecopt_success > 0
+ else:
+ assert vlog.jit_summary.vecopt_success >= 0
arith_comb = [
@@ -88,14 +91,17 @@
return a.{method}()
""".format(method=op, dtype=dtype, count=count, a=a)
exec py.code.Source(source).compile()
+ log = self.run(main, [], vec=0)
vlog = self.run(main, [], vec=1)
- log = self.run(main, [], vec=0)
assert log.result == vlog.result
assert log.result == result
assert log.jit_summary.vecopt_tried == 0
assert log.jit_summary.vecopt_success == 0
assert vlog.jit_summary.vecopt_tried > 0
- assert vlog.jit_summary.vecopt_success > 0
+ if dtype in ('int64','float64') and (dtype != 'int64' and op != 'prod'):
+ assert vlog.jit_summary.vecopt_success > 0
+ else:
+ assert vlog.jit_summary.vecopt_success >= 0
def test_reduce_logical_xor(self):
def main():
@@ -166,17 +172,30 @@
assert log.result is True
assert len(log.loops) == 1
loop = log._filter(log.loops[0])
+ # loop.match("""
+ # f31 = raw_load_f(i9, i29, 1, 0, descr=<ArrayF 8>)
+ # guard_not_invalidated(descr=...)
+ # v32 = float_ne(f31, 0.000000)
+ # guard_true(i32, descr=...)
+ # i36 = int_add(i24, 1)
+ # i37 = int_add(i29, 8)
+ # i38 = int_ge(i36, i30)
+ # guard_false(i38, descr=...)
+ # jump(..., descr=...)
+ # """)
+ # vector version
assert loop.match("""
- f31 = raw_load_f(i9, i29, descr=<ArrayF 8>)
guard_not_invalidated(descr=...)
- i32 = float_ne(f31, 0.000000)
- guard_true(i32, descr=...)
- i36 = int_add(i24, 1)
- i37 = int_add(i29, 8)
- i38 = int_ge(i36, i30)
- guard_false(i38, descr=...)
- jump(..., descr=...)
- """)
+ i38 = int_add(i25, 2)
+ i39 = int_ge(i38, i33)
+ guard_false(i39, descr=...)
+ v42 = vec_load_f(i9, i32, 1, 0, descr=<ArrayF 8>)
+ v43 = vec_float_ne(v42, v36)
+ f46 = vec_unpack_f(v42, 0, 1)
+ vec_guard_true(v43, descr=...)
+ i48 = int_add(i32, 16)
+ i50 = int_add(i25, 2)
+ jump(..., descr=...)""")
def test_array_getitem_basic(self):
def main():
diff --git a/rpython/jit/metainterp/warmspot.py b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -34,7 +34,7 @@
# Bootstrapping
def apply_jit(translator, backend_name="auto", inline=False,
- vec=True, enable_opts=ALL_OPTS_NAMES, **kwds):
+ vec=False, enable_opts=ALL_OPTS_NAMES, **kwds):
if 'CPUClass' not in kwds:
from rpython.jit.backend.detect_cpu import getcpuclass
kwds['CPUClass'] = getcpuclass(backend_name)
@@ -84,8 +84,8 @@
loop_longevity=0, retrace_limit=5, function_threshold=4,
disable_unrolling=sys.maxint,
enable_opts=ALL_OPTS_NAMES, max_retrace_guards=15,
- max_unroll_recursion=7, vec=1, vec_all=0, vec_cost=0,
- vec_length=60, vec_ratio=2, vec_guard_ratio=3, **kwds):
+ max_unroll_recursion=7, vec=0, vec_all=0, vec_cost=0,
+ **kwds):
from rpython.config.config import ConfigError
translator = interp.typer.annotator.translator
try:
@@ -112,9 +112,6 @@
jd.warmstate.set_param_vec(vec)
jd.warmstate.set_param_vec_all(vec_all)
jd.warmstate.set_param_vec_cost(vec_cost)
- jd.warmstate.set_param_vec_length(vec_length)
- jd.warmstate.set_param_vec_ratio(vec_ratio)
- jd.warmstate.set_param_vec_guard_ratio(vec_guard_ratio)
warmrunnerdesc.finish()
if graph_and_interp_only:
return interp, graph
diff --git a/rpython/jit/metainterp/warmstate.py b/rpython/jit/metainterp/warmstate.py
--- a/rpython/jit/metainterp/warmstate.py
+++ b/rpython/jit/metainterp/warmstate.py
@@ -308,23 +308,14 @@
if self.warmrunnerdesc.memory_manager:
self.warmrunnerdesc.memory_manager.max_unroll_recursion = value
- def set_param_vec(self, value):
- self.vec = bool(value)
+ def set_param_vec(self, ivalue):
+ self.vec = bool(ivalue)
- def set_param_vec_all(self, value):
- self.vec_all = bool(value)
+ def set_param_vec_all(self, ivalue):
+ self.vec_all = bool(ivalue)
- def set_param_vec_cost(self, value):
- self.vec_cost = bool(value)
-
- def set_param_vec_length(self, value):
- self.vec_length = int(value)
-
- def set_param_vec_ratio(self, value):
- self.vec_ratio = value / 10.0
-
- def set_param_vec_guard_ratio(self, value):
- self.vec_guard_ratio = value / 10.0
+ def set_param_vec_cost(self, ivalue):
+ self.vec_cost = value
def disable_noninlinable_function(self, greenkey):
cell = self.JitCell.ensure_jit_cell_at_key(greenkey)
diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -575,14 +575,10 @@
'optimizations to enable, or all = %s' % ENABLE_ALL_OPTS,
'max_unroll_recursion': 'how many levels deep to unroll a recursive function',
'vec': 'turn on the vectorization optimization (vecopt). ' \
- 'Supports x86 (SSE 4.1), powerpc (SVX), s390x',
- 'vec_all': 'try to vectorize trace loops that occur outside of the numpy library.',
- 'vec_cost': 'threshold for which traces to bail. 0 means the costs.',
- 'vec_length': 'the amount of instructions allowed in "all" traces.',
- 'vec_ratio': 'an integer (0-10 transfored into a float by X / 10.0) statements that have vector equivalents '
- 'divided by the total number of trace instructions.',
- 'vec_guard_ratio': 'an integer (0-10 transfored into a float by X / 10.0) divided by the'
- ' total number of trace instructions.',
+ 'Supports x86 (SSE 4.1), powerpc (SVX), s390x SIMD',
+ 'vec_cost': 'threshold for which traces to bail. Unpacking increases the counter,'\
+ ' vector operation decrease the cost',
+ 'vec_all': 'try to vectorize trace loops that occur outside of the numpypy library',
}
PARAMETERS = {'threshold': 1039, # just above 1024, prime
@@ -598,12 +594,9 @@
'disable_unrolling': 200,
'enable_opts': 'all',
'max_unroll_recursion': 7,
- 'vec': 1,
+ 'vec': 0,
'vec_all': 0,
'vec_cost': 0,
- 'vec_length': 60,
- 'vec_ratio': 2,
- 'vec_guard_ratio': 5,
}
unroll_parameters = unrolling_iterable(PARAMETERS.items())
More information about the pypy-commit
mailing list