Skip to content

Commit 23502c0

Browse files
committed
compiler: Only skip copy-backs overwritten from a different buffer
1 parent 7798352 commit 23502c0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎devito/passes/clusters/buffering.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,10 @@ def _overwritten(v, c, idxf, descriptors, order, d):
10151015
for v1 in descriptors.flat_values():
10161016
if v1.f is not v.f or v1.is_readonly:
10171017
continue
1018+
# Copy-backs out of the same buffer are already serialized, since the
1019+
# buffer cannot be refilled before its previous copy-back is completed
1020+
if v1.b is v.b:
1021+
continue
10181022

10191023
for c1 in v1.lastwrite:
10201024
if order.get(c1, -1) <= order[c]:
@@ -1038,7 +1042,9 @@ def _overwritten(v, c, idxf, descriptors, order, d):
10381042
else:
10391043
coincide = CondEq(shift, 0)
10401044

1041-
conditions.append(And(c1.guards.get(d, true), coincide))
1045+
# The later copy-back fires under all of its guards, which may be
1046+
# keyed on Dimensions derived from `d` (e.g., a layer Dimension)
1047+
conditions.append(And(*c1.guards.values(), coincide))
10421048

10431049
if not conditions:
10441050
return None

0 commit comments

Comments
 (0)