Skip to content

Commit b861a48

Browse files
committed
compiler: Patch fissioning in presence of scalars
1 parent 1d94ad5 commit b861a48

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎devito/passes/clusters/misc.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def callback(self, clusters, prefix):
132132

133133
# Analyze and abort if fissioning would break a dependence
134134
scope = Scope(flatten(c.exprs for c in clusters))
135-
if any(d._defines & dep.cause or dep.is_reduce(d) for dep in scope.d_all_gen()):
135+
if any(d._defines & dep.cause or dep.is_reduce(d) or dep.is_local
136+
for dep in scope.d_all_gen()):
136137
return clusters
137138

138139
processed = []

‎tests/test_fission.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,25 @@ def test_nofission_as_illegal():
8080
assert_structure(op, ['t,x,y', 't,x,y'], 't,x,y,y')
8181

8282

83+
def test_nofission_local_scalar_dependence():
84+
"""
85+
Test there's no fission across a local scalar dependence.
86+
"""
87+
grid = Grid(shape=(3, 3))
88+
time = grid.time_dim
89+
x, y = grid.dimensions
90+
91+
g = Function(name='g', grid=grid, dtype=np.int32, space_order=0)
92+
h = Function(name='h', grid=grid, space_order=0)
93+
94+
eqns = [Eq(y.symbolic_max, g[x, 0], implicit_dims=(time, x)),
95+
Eq(h, y, implicit_dims=(time, x, y))]
96+
97+
op = Operator(eqns, opt='fission')
98+
99+
assert_structure(op, ['t,x', 't,x,y'], 't,x,y')
100+
101+
83102
def test_fission_partial():
84103
"""
85104
Test there's no fission if no increase in number of collapsible loops.

0 commit comments

Comments
 (0)