@@ -40,7 +40,7 @@ def _drop_reduction_halospots(iet):
4040
4141 # If all HaloSpot reads pertain to reductions, then the HaloSpot is useless
4242 for hs , expressions in MapNodes (HaloSpot , Expression ).visit (iet ).items ():
43- scope = Scope ( i .expr for i in expressions )
43+ scope = Scope . maybe_cached ( tuple ( i .expr for i in expressions ) )
4444 for k , v in hs .fmapper .items ():
4545 f = v .bundle or k
4646 if f not in scope .reads :
@@ -82,7 +82,7 @@ def _hoist_redundant_from_conditionals(iet):
8282
8383 mapper = HaloSpotMapper ()
8484 for it , halo_spots in iter_mapper .items ():
85- scope = Scope ( e .expr for e in FindNodes (Expression ).visit (it ))
85+ scope = Scope . maybe_cached ( tuple ( e .expr for e in FindNodes (Expression ).visit (it ) ))
8686
8787 for hs0 in halo_spots :
8888 conditions = cond_mapper [hs0 ]
@@ -282,7 +282,7 @@ def _mark_overlappable(iet):
282282 if not expressions :
283283 continue
284284
285- scope = Scope ( i .expr for i in expressions )
285+ scope = Scope . maybe_cached ( tuple ( i .expr for i in expressions ) )
286286
287287 # Comp/comm overlaps is legal only if the OWNED regions can grow
288288 # arbitrarly, which means all of the dependences must be carried
@@ -462,7 +462,7 @@ def _derive_scope(it, hs0, hs1):
462462 and ends at the HaloSpot `hs1`.
463463 """
464464 expressions = FindWithin (Expression , hs0 , stop = hs1 ).visit (it )
465- return Scope ( e .expr for e in expressions )
465+ return Scope . maybe_cached ( tuple ( e .expr for e in expressions ) )
466466
467467
468468def _check_control_flow (hs0 , hs1 , cond_mapper ):
0 commit comments