[pypy-commit] pypy vecopt-merge: why not split the parameters up into several different integer ones, why not do it this way in the first place?

plan_rich noreply at buildbot.pypy.org
Wed Aug 19 14:54:45 CEST 2015


Author: Richard Plangger <rich at pasra.at>
Branch: vecopt-merge
Changeset: r79056:7594920913e7
Date: 2015-08-19 14:54 +0200
http://bitbucket.org/pypy/pypy/changeset/7594920913e7/

Log:	why not split the parameters up into several different integer ones,
	why not do it this way in the first place?

diff --git a/pypy/module/pypyjit/interp_jit.py b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -137,12 +137,10 @@
     for key, w_value in kwds_w.items():
         if key == 'enable_opts':
             jit.set_param(None, 'enable_opts', space.str_w(w_value))
-        elif key == 'vec_params':
-            jit.set_param(None, 'vec_params', space.str_w(w_value))
         else:
             intval = space.int_w(w_value)
             for name, _ in unroll_parameters:
-                if name == key and name != 'enable_opts' and name != 'vec_params':
+                if name == key and name != 'enable_opts':
                     jit.set_param(None, name, intval)
                     break
             else:
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
@@ -71,8 +71,8 @@
                     backendopt=False, trace_limit=sys.maxint, inline=False,
                     loop_longevity=0, retrace_limit=5, function_threshold=4,
                     enable_opts=ALL_OPTS_NAMES, max_retrace_guards=15, 
-                    max_unroll_recursion=7, vec=0, vec_params='0:0:50:0.6',
-                    **kwds):
+                    max_unroll_recursion=7, vec=0, vec_all=0, vec_cost=0,
+                    vec_length=50, vec_ratio=6, **kwds):
     from rpython.config.config import ConfigError
     translator = interp.typer.annotator.translator
     try:
@@ -96,7 +96,10 @@
         jd.warmstate.set_param_enable_opts(enable_opts)
         jd.warmstate.set_param_max_unroll_recursion(max_unroll_recursion)
         jd.warmstate.set_param_vec(vec)
-        jd.warmstate.set_param_vec_params(vec_params)
+        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)
     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
@@ -303,20 +303,17 @@
     def set_param_vec(self, value):
         self.vec = bool(value)
 
-    def set_param_vec_params(self, value):
-        if NonConstant(False):
-            value = 'blah' # not a constant ''
-        values = value.split(":")
-        self.vec_all = bool(values[0])
-        self.vec_cost = 0
-        if len(values) > 1:
-            self.vec_cost = int(values[1])
-        self.vec_length = 50
-        if len(values) > 2:
-            self.vec_length = int(values[2])
-        self.vec_ratio = 0.60
-        if len(values) > 3:
-            self.vec_ratio = float(values[3])
+    def set_param_vec_all(self, value):
+        self.vec_all = bool(value)
+
+    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 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
@@ -554,13 +554,11 @@
                    '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). requires sse4.1',
-    'vec_params': 'parameters to the optimization separated by colons. <all>[:<cost>[:<length>[:<ratio>]]]. '
-                  'all = 1: try to vectorize trace loops that occur outside of the numpy library. '
-                  'cost = 0: threshold for which traces to bail. 0 means the costs '
-                  'balance the unpacking, if below the vectorizer bails out. '
-                  'length = 50:  the amount of instructions allowed in "all" traces. '
-                  'ratio = 0.60: the number statements that have vector equivalents divided '
-                  'by the total number of trace instructions.',
+    'vec_all': 'all = 1: try to vectorize trace loops that occur outside of the numpy library.',
+    'vec_cost': 'cost = 0: threshold for which traces to bail. 0 means the costs.',
+    'vec_length': 'length = 50:  the amount of instructions allowed in "all" traces.',
+    'vec_ratio': 'ratio = 6: an integer (0-10 => X / 10) statements that have vector equivalents '
+                 'divided by the total number of trace instructions.',
 }
 
 PARAMETERS = {'threshold': 1039, # just above 1024, prime
@@ -577,7 +575,10 @@
               'enable_opts': 'all',
               'max_unroll_recursion': 7,
               'vec': 0,
-              'vec_params': '0:0:50:0.60',
+              'vec_all': 0,
+              'vec_cost': 0,
+              'vec_length': 50,
+              'vec_ratio': 6,
               }
 unroll_parameters = unrolling_iterable(PARAMETERS.items())
 
@@ -799,11 +800,9 @@
         value = parts[1]
         if name == 'enable_opts':
             set_param(driver, 'enable_opts', value)
-        elif name == 'vec_params':
-            set_param(driver, 'vec_params', value)
         else:
             for name1, _ in unroll_parameters:
-                if name1 == name and name1 != 'vec_params' and name1 != 'enable_opts':
+                if name1 == name and name1 != 'enable_opts':
                     try:
                         set_param(driver, name1, int(value))
                     except ValueError:
@@ -969,8 +968,6 @@
         assert s_name.is_constant()
         if s_name.const == 'enable_opts':
             assert annmodel.SomeString(can_be_None=True).contains(s_value)
-        elif s_name.const == 'vec_params':
-            assert annmodel.SomeString(can_be_None=True).contains(s_value)
         else:
             assert (s_value == annmodel.s_None or
                     annmodel.SomeInteger().contains(s_value))
@@ -986,8 +983,6 @@
         name = hop.args_s[1].const
         if name == 'enable_opts':
             repr = string_repr
-        elif name == 'vec_params':
-            repr = string_repr
         else:
             repr = lltype.Signed
         if (isinstance(hop.args_v[2], Constant) and


More information about the pypy-commit mailing list