Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions devito/passes/clusters/fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,17 @@ def _build_dag(self, cgroups, prefix):
# Track whether there is any fence between `cg0` and the current `cg1`.
fenced = cg0.scope.has_barrier

# Functions `cg0` waits on, e.g. a prefetched buffer: reading them
# is no data hazard, but no reader may be scheduled before the wait
waited = {s.target for s in flatten(cg0.syncs.values())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so what's s.target, and why does it not appear among cg0's equations?

if isinstance(s, WaitLock)}

for n1, cg1 in enumerate(cgroups[n+1:], start=n+1):
fenced = fenced or cg1.scope.has_barrier

hazard = _fusion_hazards(cg0.scope, cg1.scope, prefix)
if waited & set(cg1.scope.reads):
dag.add_edge(cg0, cg1)
if not (hazard or fenced):
continue

Expand Down
Loading