Skip to content

Commit

Permalink
compiler: fix partial lifting of scalar
Browse files Browse the repository at this point in the history
mloubout committed Jan 14, 2025
1 parent 47dbc37 commit fbbb470
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion devito/passes/clusters/misc.py
Original file line number Diff line number Diff line change
@@ -97,7 +97,8 @@ def callback(self, clusters, prefix):

# Lifted scalar clusters cannot be guarded
# as they would not be in the scope of the guarded clusters
if c.is_scalar:
# unless the guard is for an outer dimension
if c.is_scalar and not (prefix[:-1] and c.guards):
guards = {}
else:
guards = c.guards
2 changes: 1 addition & 1 deletion tests/test_dse.py
Original file line number Diff line number Diff line change
@@ -1218,7 +1218,7 @@ def test_catch_best_invariant_v2(self):
assert len(arrays) == 4

exprs = FindNodes(Expression).visit(op)
sqrt_exprs = exprs[2:4]
sqrt_exprs = exprs[:2]
assert all(e.write in arrays for e in sqrt_exprs)
assert all(e.expr.rhs.is_Pow for e in sqrt_exprs)
assert all(e.write._mem_heap and not e.write._mem_external for e in sqrt_exprs)

0 comments on commit fbbb470

Please sign in to comment.