Skip to content
Snippets Groups Projects
Commit 967414c7 authored by Matt Wala's avatar Matt Wala
Browse files

find_most_recent_global_barrier(): Simplify by using

recursive_insn_dep_map().
parent 1a838063
No related branches found
No related tags found
1 merge request!101Add global barrier helper functions to loopy
Pipeline #
......@@ -901,20 +901,14 @@ class LoopKernel(ImmutableRecordWithoutPickling):
global_barrier_to_ordinal = dict(
(b, i) for i, b in enumerate(self.global_barrier_order))
def get_barrier_ordinal(barrier_id):
return (global_barrier_to_ordinal[barrier_id]
if barrier_id is not None
else -1)
barriers = set(dep
for dep in self.recursive_insn_dep_map()[insn_id]
if is_barrier(dep))
direct_barrier_dependencies = set(
dep for dep in insn.depends_on if is_barrier(dep))
if len(direct_barrier_dependencies) > 0:
return max(direct_barrier_dependencies, key=get_barrier_ordinal)
if len(barriers) > 0:
return max(barriers, key=lambda b: global_barrier_to_ordinal[b])
else:
return max((self.find_most_recent_global_barrier(dep)
for dep in insn.depends_on),
key=get_barrier_ordinal)
return None
@property
@memoize_method
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment