@@ -83,7 +83,6 @@ def _hoist_invariant(iet):
8383
8484 for it , halo_spots in iter_mapper .items ():
8585 for hs0 , hs1 in combinations (halo_spots , r = 2 ):
86-
8786 if _check_control_flow (hs0 , hs1 , cond_mapper ):
8887 continue
8988
@@ -129,10 +128,9 @@ def _hoist_invariant(iet):
129128
130129def _merge_halospots (iet ):
131130 """
132- Merge HaloSpots on the same Iteration tree level where all data dependencies
133- would be honored. Avoids redundant halo exchanges when the same data is
134- redundantly exchanged within the same Iteration tree level as well as to initiate
135- multiple halo exchanges at once.
131+ Using data dependence analysis, merge HaloSpots on the same IET level. This
132+ has two effects: anticipating communication over computation, and (potentially)
133+ avoiding redundant halo exchanges.
136134
137135 Example:
138136
@@ -141,7 +139,6 @@ def _merge_halospots(iet):
141139 W v[t1]- R v[t0] W v[t1]- R v[t0]
142140 haloupd v[t0], h
143141 W g[t1]- R v[t0], h W g[t1]- R v[t0], h
144-
145142 """
146143
147144 # Analysis
@@ -155,16 +152,15 @@ def _merge_halospots(iet):
155152 hs0 = halo_spots [0 ]
156153
157154 for hs1 in halo_spots [1 :]:
158-
159155 if _check_control_flow (hs0 , hs1 , cond_mapper ):
160156 continue
161157
162158 for f , v in hs1 .fmapper .items ():
163159 for dep in scope .d_flow .project (f ):
164- if not any (r (dep , hs1 , v .loc_indices ) for r in rules ):
160+ if not any (rule (dep , hs1 , v .loc_indices ) for rule in rules ):
165161 break
166162 else :
167- # hs1 is merged with hs0
163+ # All good -- ` hs1` can be merged with ` hs0`
168164 hs = hs1 .halo_scheme .project (f )
169165 mapper [hs0 ] = HaloScheme .union ([mapper .get (hs0 , hs0 .halo_scheme ), hs ])
170166 mapper [hs1 ] = mapper .get (hs1 , hs1 .halo_scheme ).drop (f )
0 commit comments