Skip to content

Commit 1edb9ff

Browse files
committed
compiler: Add normalize_syncs before rebuilding
1 parent 0102553 commit 1edb9ff

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎devito/passes/clusters/asynchrony.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,14 @@ def callback(self, clusters, prefix):
102102
protected = self._schedule_waitlocks(c0, d, clusters, locks, syncs)
103103
self._schedule_withlocks(c0, d, protected, locks, syncs)
104104

105-
processed = [c.rebuild(syncs={**c.syncs, **syncs[c]}) for c in clusters]
105+
# Tasking may run again after prefetching has attached input waits.
106+
# Preserve them when adding locks for asynchronous output readers.
107+
processed = []
108+
for c in clusters:
109+
waits = {d: [s for s in ops if isinstance(s, WaitLock)]
110+
for d, ops in c.syncs.items()}
111+
ops = normalize_syncs(waits, {**c.syncs, **syncs[c]})
112+
processed.append(c.rebuild(syncs=ops))
106113

107114
return processed
108115

0 commit comments

Comments
 (0)