Author: Richard Plangger <planri...@gmail.com> Branch: ppc-vsx-support Changeset: r87045:f7f829beb5bb Date: 2016-09-12 16:47 +0200 http://bitbucket.org/pypy/pypy/changeset/f7f829beb5bb/
Log: vector operations (load/store) where not considered in dep. construction (was not needed up to now) 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 @@ -13,6 +13,7 @@ MODIFY_COMPLEX_OBJ = [ (rop.SETARRAYITEM_GC, 0, 1) , (rop.SETARRAYITEM_RAW, 0, 1) , (rop.RAW_STORE, 0, 1) + , (rop.VEC_STORE, 0, 1) , (rop.SETINTERIORFIELD_GC, 0, -1) , (rop.SETINTERIORFIELD_RAW, 0, -1) , (rop.SETFIELD_GC, 0, -1) @@ -31,6 +32,8 @@ , (rop.GETARRAYITEM_RAW_F, 0, 1) , (rop.RAW_LOAD_I, 0, 1) , (rop.RAW_LOAD_F, 0, 1) + , (rop.VEC_LOAD_I, 0, 1) + , (rop.VEC_LOAD_F, 0, 1) , (rop.GETINTERIORFIELD_GC_I, 0, 1) , (rop.GETINTERIORFIELD_GC_F, 0, 1) , (rop.GETINTERIORFIELD_GC_R, 0, 1) diff --git a/rpython/jit/metainterp/optimizeopt/schedule.py b/rpython/jit/metainterp/optimizeopt/schedule.py --- a/rpython/jit/metainterp/optimizeopt/schedule.py +++ b/rpython/jit/metainterp/optimizeopt/schedule.py @@ -43,11 +43,14 @@ if not delayed: return args = op.getarglist() + if op.is_guard(): + args = args[:] + op.getfailargs() for arg in args: if arg.is_constant() or arg.is_inputarg(): continue if arg not in self.seen: needs_resolving[arg] = None + indexvars = self.graph.index_vars i = len(delayed)-1 while i >= 0: @@ -118,8 +121,6 @@ self.worklist.insert(0, node) def try_emit_or_delay(self, node): - # implement me in subclass. e.g. as in VecScheduleState - if not node.is_imaginary() and node.is_pure(): # this operation might never be emitted. only if it is really needed self.delay_emit(node) diff --git a/rpython/jit/metainterp/optimizeopt/test/test_dependency.py b/rpython/jit/metainterp/optimizeopt/test/test_dependency.py --- a/rpython/jit/metainterp/optimizeopt/test/test_dependency.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_dependency.py @@ -540,6 +540,15 @@ """) self.assert_dependencies(graph, full_check=True) + def test_dep_on_vector_op(self): + graph = self.build_dependency(""" + [p0, i1] # 0: 1,2,3 + i19 = int_mul(i1, 8) # 1: 2 + v20[2xi64] = vec_load_i(p0, i19, 1, 0, descr=arraydescr) # 2: + jump(p0, i1) # 3: + """) + self.assert_dependencies(graph, full_check=True) + def test_iterate(self): n1,n2,n3,n4,n5 = [FakeNode(i+1) for i in range(5)] diff --git a/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py b/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py @@ -175,13 +175,11 @@ gso = GuardStrengthenOpt(graph.index_vars) gso.propagate_all_forward(info, loop) # re-schedule - #vsize = self.cpu.vector_ext.vec_size() - #graph = DependencyGraph(loop) - #state = VecScheduleState(graph, PackSet(vsize), self.cpu, costmodel) - #state.prepare() - #scheduler = Scheduler() - #scheduler.walk_and_emit(state) - #state.post_schedule() + graph = DependencyGraph(loop) + state = SchedulerState(self.cpu, graph) + state.prepare() + Scheduler().walk_and_emit(state) + state.post_schedule() return opt def vectorize(self, loop, unroll_factor = -1): @@ -200,13 +198,11 @@ gso.propagate_all_forward(info, loop) # # re-schedule - #vsize = self.cpu.vector_ext.vec_size() - #graph = DependencyGraph(loop) - #state = VecScheduleState(graph, PackSet(vsize), self.cpu, costmodel) - #state.prepare() - #scheduler = Scheduler() - #scheduler.walk_and_emit(state) - #state.post_schedule() + graph = DependencyGraph(loop) + state = SchedulerState(self.cpu, graph) + state.prepare() + Scheduler().walk_and_emit(state) + state.post_schedule() # oplist = loop.operations loop.operations = loop.prefix[:] 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 @@ -261,14 +261,13 @@ gso.propagate_all_forward(info, loop, user_code) # re-schedule the trace -> removes index operations - # work in progress - #graph = DependencyGraph(loop) - #costmodel = GenericCostModel(self.cpu, self.cost_threshold) - #state = VecScheduleState(graph, PackSet(vsize), self.cpu, costmodel) - #state.prepare() - #scheduler = Scheduler() - #scheduler.walk_and_emit(state) - #state.post_schedule() + graph = DependencyGraph(loop) + costmodel = GenericCostModel(self.cpu, self.cost_threshold) + state = ScheduleState(self.cpu, graph) + state.prepare() + scheduler = Scheduler() + scheduler.walk_and_emit(state) + state.post_schedule() def unroll_loop_iterations(self, loop, unroll_count): """ Unroll the loop X times. unroll_count + 1 = unroll_factor """ _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit