Author: Richard Plangger <r...@pasra.at>
Branch: vecopt
Changeset: r78254:96394198b3ec
Date: 2015-06-23 10:47 +0200
http://bitbucket.org/pypy/pypy/changeset/96394198b3ec/

Log:    timing the vecopt and printing it to the logfiles

diff --git a/rpython/jit/metainterp/optimizeopt/guard.py 
b/rpython/jit/metainterp/optimizeopt/guard.py
--- a/rpython/jit/metainterp/optimizeopt/guard.py
+++ b/rpython/jit/metainterp/optimizeopt/guard.py
@@ -122,6 +122,7 @@
         self.index_vars = index_vars
         self._newoperations = []
         self._same_as = {}
+        self.strength_reduced = 0 # how many guards could be removed?
 
     def find_compare_guard_bool(self, boolarg, operations, index):
         i = index - 1
@@ -211,6 +212,7 @@
                 guard = guards.get(i, None)
                 if not guard or guard.implied:
                     # this guard is implied or marked as not emitted (= None)
+                    self.strength_reduced += 1
                     continue
                 if guard.stronger:
                     guard.emit_operations(self)
diff --git a/rpython/jit/metainterp/optimizeopt/vectorize.py 
b/rpython/jit/metainterp/optimizeopt/vectorize.py
--- a/rpython/jit/metainterp/optimizeopt/vectorize.py
+++ b/rpython/jit/metainterp/optimizeopt/vectorize.py
@@ -60,10 +60,23 @@
         debug_start("vec-opt-loop")
         metainterp_sd.logger_noopt.log_loop(loop.inputargs, loop.operations, 
-2, None, None, "pre vectorize")
         metainterp_sd.profiler.count(Counters.OPT_VECTORIZE_TRY)
+        start = time.clock()
         opt = VectorizingOptimizer(metainterp_sd, jitdriver_sd, loop, 
cost_threshold)
         opt.propagate_all_forward()
+        gso = GuardStrengthenOpt(opt.dependency_graph.index_vars)
+        gso.propagate_all_forward(opt.loop)
+        end = time.clock()
         metainterp_sd.profiler.count(Counters.OPT_VECTORIZED)
         metainterp_sd.logger_noopt.log_loop(loop.inputargs, loop.operations, 
-2, None, None, "post vectorize")
+        debug_start("vec-opt-clock")
+        debug_print("unroll: %d gso count: %d opcount: (%d -> %d) took %fns" % 
\
+                      (opt.unroll_count+1,
+                       gso.strength_reduced,
+                       len(orig_ops),
+                       len(loop.operations),
+                       (end-start)*10.0**9))
+        debug_stop("vec-opt-clock")
+
     except NotAVectorizeableLoop:
         # vectorization is not possible
         loop.operations = orig_ops
@@ -135,9 +148,6 @@
         if not self.costmodel.profitable():
             raise NotAProfitableLoop()
 
-        gso = GuardStrengthenOpt(self.dependency_graph.index_vars)
-        gso.propagate_all_forward(self.loop)
-
     def emit_operation(self, op):
         if op.getopnum() == rop.DEBUG_MERGE_POINT:
             return
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to