Skip to content

Commit f35e59d

Browse files
committed
compiler: Guard cond_mapper lookup in halo hoisting
_hoist_redundant_from_conditionals iterated every halo_spot from _filter_iter_mapper and did an unguarded cond_mapper[hs0], which raised KeyError for a nested HaloSpot (one whose subtree contains another HaloSpot), since _make_cond_mapper does not register nested HaloSpots as keys. Use the defensive cond_mapper.get(hs0) (as already done in _merge_halospots); the existing 'if not conditions: continue' handles the absent-key case. Fixes #2943.
1 parent 870a160 commit f35e59d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

devito/passes/iet/mpi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _hoist_redundant_from_conditionals(iet):
8888
scope = Scope(e.expr for e in FindNodes(Expression).visit(it))
8989

9090
for hs0 in halo_spots:
91-
conditions = cond_mapper[hs0]
91+
conditions = cond_mapper.get(hs0)
9292
if not conditions:
9393
continue
9494
condition = conditions[-1] # Take the innermost Conditional

0 commit comments

Comments
 (0)