def vectorize(self, loop, unroll_factor=-1): info = FakeLoopInfo(loop) info.snapshot(loop) opt, graph = self.vectoroptimizer_unrolled(loop, unroll_factor) opt.find_adjacent_memory_refs(graph) opt.extend_packset() opt.combine_packset() costmodel = GenericCostModel(self.cpu, 0) state = VecScheduleState(graph, opt.packset, self.cpu, costmodel) opt.schedule(state) if not costmodel.profitable(): raise NotAProfitableLoop() gso = GuardStrengthenOpt(graph.index_vars) gso.propagate_all_forward(info, loop) # # re-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[:] if loop.prefix_label: loop.operations += [loop.prefix_label] loop.operations += oplist return opt
def schedule(self, loop, unroll_factor=-1, with_guard_opt=False): info = FakeLoopInfo(loop) info.snapshot(loop) opt, graph = self.vectoroptimizer_unrolled(loop, unroll_factor) opt.find_adjacent_memory_refs(graph) opt.extend_packset() opt.combine_packset() costmodel = FakeCostModel(self.cpu) state = VecScheduleState(graph, opt.packset, self.cpu, costmodel) opt.schedule(state) if with_guard_opt: gso = GuardStrengthenOpt(graph.index_vars) gso.propagate_all_forward(info, loop) return opt
def schedule(self, loop, unroll_factor = -1, with_guard_opt=False): info = FakeLoopInfo(loop) info.snapshot(loop) opt, graph = self.vectoroptimizer_unrolled(loop, unroll_factor) opt.find_adjacent_memory_refs(graph) opt.extend_packset() opt.combine_packset() costmodel = FakeCostModel(self.cpu) state = VecScheduleState(graph, opt.packset, self.cpu, costmodel) opt.schedule(state) if with_guard_opt: gso = GuardStrengthenOpt(graph.index_vars) gso.propagate_all_forward(info, loop) return opt
def vectorize(self, loop, unroll_factor = -1): info = FakeLoopInfo(loop) info.snapshot(loop) opt, graph = self.vectoroptimizer_unrolled(loop, unroll_factor) opt.find_adjacent_memory_refs(graph) opt.extend_packset() opt.combine_packset() costmodel = X86_CostModel(self.cpu, 0) state = VecScheduleState(graph, opt.packset, self.cpu, costmodel) opt.schedule(state) if not costmodel.profitable(): raise NotAProfitableLoop() gso = GuardStrengthenOpt(graph.index_vars) gso.propagate_all_forward(info, loop) oplist = loop.operations loop.operations = loop.prefix[:] if loop.prefix_label: loop.operations += [loop.prefix_label] loop.operations += oplist return opt