Author: Richard Plangger <planri...@gmail.com> Branch: ppc-vsx-support Changeset: r86011:613b2a914410 Date: 2016-08-04 12:44 +0200 http://bitbucket.org/pypy/pypy/changeset/613b2a914410/
Log: moved setup_once for the vector extension, debug_print when NotAVectorizableLoop is raised diff --git a/rpython/jit/backend/llsupport/vector_ext.py b/rpython/jit/backend/llsupport/vector_ext.py --- a/rpython/jit/backend/llsupport/vector_ext.py +++ b/rpython/jit/backend/llsupport/vector_ext.py @@ -8,6 +8,9 @@ failnbail_transformation) from rpython.jit.metainterp.jitexc import NotAVectorizeableLoop from rpython.rlib.objectmodel import we_are_translated +from rpython.rtyper.lltypesystem.lloperation import llop +from rpython.rtyper.lltypesystem import lltype +from rpython.rlib.debug import debug_print class TypeRestrict(object): ANY_TYPE = '\x00' @@ -192,11 +195,11 @@ continue curvecinfo = forwarded_vecinfo(arg) if curvecinfo.bytesize != bytesize: - raise NotAVectorizeableLoop("op match size first type failed %d != %d" % \ - (curvecinfo.bytesize != bytesize)) + debug_print("op match size first type failed") + raise NotAVectorizeableLoop if curvecinfo.datatype != datatype: - raise NotAVectorizeableLoop("op match size first type failed (datatype). %s != %s" % \ - (curvecinfo.datatype != datatype)) + debug_print("op match size first type failed (datatype)") + raise NotAVectorizeableLoop return None TR_ANY = TypeRestrict() diff --git a/rpython/jit/metainterp/jitexc.py b/rpython/jit/metainterp/jitexc.py --- a/rpython/jit/metainterp/jitexc.py +++ b/rpython/jit/metainterp/jitexc.py @@ -62,10 +62,8 @@ self.red_int, self.red_ref, self.red_float) class NotAVectorizeableLoop(JitException): - def __init__(self, msg="<empty>"): - self.msg = msg def __str__(self): - return 'NotAVectorizeableLoop(%s)' % self.msg + return 'NotAVectorizeableLoop()' class NotAProfitableLoop(JitException): def __str__(self): diff --git a/rpython/jit/metainterp/optimizeopt/vector.py b/rpython/jit/metainterp/optimizeopt/vector.py --- a/rpython/jit/metainterp/optimizeopt/vector.py +++ b/rpython/jit/metainterp/optimizeopt/vector.py @@ -26,6 +26,7 @@ from rpython.rlib.objectmodel import we_are_translated from rpython.rlib.debug import debug_print, debug_start, debug_stop from rpython.rlib.jit import Counters +from rpython.rtyper.lltypesystem.lloperation import llop from rpython.rtyper.lltypesystem import lltype, rffi from rpython.jit.backend.llsupport.symbolic import (WORD as INT_WORD, SIZEOF_FLOAT as FLOAT_WORD) @@ -146,9 +147,8 @@ # info.label_op = loop.label return info, loop.finaloplist(jitcell_token=jitcell_token, reset_label_token=False) - except NotAVectorizeableLoop as e: + except NotAVectorizeableLoop: debug_stop("vec-opt-loop") - debug_print("failed to vectorize loop. reason: %s" % e.msg) # vectorization is not possible return loop_info, version.loop.finaloplist() except NotAProfitableLoop: @@ -160,8 +160,6 @@ debug_stop("vec-opt-loop") debug_print("failed to vectorize loop. THIS IS A FATAL ERROR!") if we_are_translated(): - from rpython.rtyper.lltypesystem import lltype - from rpython.rtyper.lltypesystem.lloperation import llop llop.debug_print_traceback(lltype.Void) else: raise @@ -230,12 +228,17 @@ self.linear_find_smallest_type(loop) byte_count = self.smallest_type_bytes vsize = self.vector_ext.vec_size() - if vsize == 0 or byte_count == 0 or loop.label.getopnum() != rop.LABEL: - # stop, there is no chance to vectorize this trace + # stop, there is no chance to vectorize this trace # we cannot optimize normal traces (if there is no label) - raise NotAVectorizeableLoop("vsize %d byte_count %d not label? %d" % \ - (vsize, byte_count, loop.label.getopnum() != rop.LABEL)) - + if vsize == 0: + debug_print("vector size is zero") + raise NotAVectorizeableLoop + if byte_count == 0: + debug_print("could not find smallest type") + raise NotAVectorizeableLoop + if loop.label.getopnum() != rop.LABEL: + debug_print("not a loop, can only vectorize loops") + raise NotAVectorizeableLoop # find index guards and move to the earliest position graph = self.analyse_index_calculations(loop) if graph is not None: @@ -432,7 +435,8 @@ intersecting edges. """ if len(self.packset.packs) == 0: - raise NotAVectorizeableLoop("packset is empty") + debug_print("packset is empty") + raise NotAVectorizeableLoop i = 0 j = 0 end_ij = len(self.packset.packs) @@ -664,7 +668,8 @@ if forward and origin_pack.is_accumulating(): # in this case the splitted accumulator must # be combined. This case is not supported - raise NotAVectorizeableLoop("splitted accum must be flushed here (not supported)") + debug_print("splitted accum must be flushed here (not supported)") + raise NotAVectorizeableLoop # if self.contains_pair(lnode, rnode): return None diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -1857,7 +1857,8 @@ self.jitlog.setup_once() debug_print(self.jit_starting_line) self.cpu.setup_once() - self.cpu.vector_ext.setup_once(self.cpu.assembler) + if self.cpu.vector_ext: + self.cpu.vector_ext.setup_once(self.cpu.assembler) if not self.profiler.initialized: self.profiler.start() self.profiler.initialized = True _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit