Author: Richard Plangger <r...@pasra.at>
Branch: vecopt
Changeset: r77429:bc8e3589d68a
Date: 2015-05-20 14:39 +0200
http://bitbucket.org/pypy/pypy/changeset/bc8e3589d68a/

Log:    added debug output in the vecopt method and log it in the logfile

diff --git a/rpython/jit/metainterp/jitprof.py 
b/rpython/jit/metainterp/jitprof.py
--- a/rpython/jit/metainterp/jitprof.py
+++ b/rpython/jit/metainterp/jitprof.py
@@ -154,6 +154,8 @@
         self._print_intline("nvirtuals", cnt[Counters.NVIRTUALS])
         self._print_intline("nvholes", cnt[Counters.NVHOLES])
         self._print_intline("nvreused", cnt[Counters.NVREUSED])
+        self._print_intline("vecopt tried", cnt[Counters.OPT_VECTORIZE_TRY])
+        self._print_intline("vecopt success", cnt[Counters.OPT_VECTORIZED])
         cpu = self.cpu
         if cpu is not None:   # for some tests
             self._print_intline("Total # of loops",
diff --git a/rpython/jit/metainterp/optimizeopt/dependency.py 
b/rpython/jit/metainterp/optimizeopt/dependency.py
--- a/rpython/jit/metainterp/optimizeopt/dependency.py
+++ b/rpython/jit/metainterp/optimizeopt/dependency.py
@@ -94,6 +94,9 @@
     def getopname(self):
         return self.op.getopname()
 
+    def can_be_relaxed(self):
+        return self.op.getopnum() in (rop.GUARD_TRUE, rop.GUARD_FALSE)
+
     def getfailarg_set(self):
         op = self.getoperation()
         assert isinstance(op, GuardResOp)
@@ -330,13 +333,14 @@
 
 
 class Dependency(object):
-    def __init__(self, at, to, arg):
+    def __init__(self, at, to, arg, flow=True):
         assert at != to
         self.args = [] 
         if arg is not None:
             self.add_dependency(at, to, arg)
         self.at = at
         self.to = to
+        self.flow = True
 
     def because_of(self, var):
         for arg in self.args:
@@ -367,6 +371,12 @@
     def add_dependency(self, at, to, arg):
         self.args.append((at,arg))
 
+    def set_flow(self, flow):
+        self.flow = flow
+
+    def get_flow(self):
+        return self.flow
+
     def reverse_direction(self, ref):
         """ if the parameter index is the same as idx_to then
         this edge is in reverse direction.
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
@@ -48,20 +48,16 @@
         opt.propagate_all_forward()
         metainterp_sd.profiler.count(Counters.OPT_VECTORIZED)
     except NotAVectorizeableLoop:
-        # vectorization is not possible, propagate only normal optimizations
+        # vectorization is not possible
         loop.operations = orig_ops
     except Exception as e:
         loop.operations = orig_ops
-        print 'loop with %d instructions failed! ' % (len(orig_ops),)
-        print('--- loop instr numbered ---')
-        for i,op in enumerate(loop.operations):
-            print "[",i,"]",op,
-            if op.is_guard():
-                print op.getfailargs()
-            else:
-                print ""
-        #import traceback
-        #traceback.print_exc()
+        debug_start("failed to vec loop")
+        metainterp_sd.logger_noopt.log_loop(loop.inputargs, loop.operations)
+        from rpython.rtyper.lltypesystem import lltype
+        from rpython.rtyper.lltypesystem.lloperation import llop
+        llop.debug_print_traceback(lltype.Void)
+        debug_stop("failed to vec loop")
 
 class VectorizingOptimizer(Optimizer):
     """ Try to unroll the loop and find instructions to group """
@@ -81,8 +77,6 @@
         label = self.loop.operations[0]
         jump = self.loop.operations[-1]
         if jump.getopnum() not in (rop.LABEL, rop.JUMP):
-            # compile_loop appends a additional label to all loops
-            # we cannot optimize normal traces
             raise NotAVectorizeableLoop()
 
         self.linear_find_smallest_type(self.loop)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to