@@ -95,6 +95,21 @@ def __init__(self, name, val=None):
9595A Dimension along which shared-memory prefetching is feasible and beneficial.
9696"""
9797
98+ INIT_CORE_SHM = Property ('init-core-shm' )
99+ """
100+ A Dimension along which the shared-memory CORE data region is initialized.
101+ """
102+
103+ INIT_HALO_LEFT_SHM = Property ('init-halo-left-shm' )
104+ """
105+ A Dimension along which the shared-memory left-HALO data region is initialized.
106+ """
107+
108+ INIT_HALO_RIGHT_SHM = Property ('init-halo-right-shm' )
109+ """
110+ A Dimension along which the shared-memory right-HALO data region is initialized.
111+ """
112+
98113
99114# Bundles
100115PARALLELS = {PARALLEL , PARALLEL_INDEP , PARALLEL_IF_ATOMIC , PARALLEL_IF_PVT }
@@ -122,9 +137,13 @@ def normalize_properties(*args):
122137 else :
123138 drop = set ()
124139
125- # SEPARABLE <=> all are SEPARABLE
126- if not all (SEPARABLE in p for p in args ):
127- drop .add (SEPARABLE )
140+ # A property X must be dropped if not all set of properties in `args`
141+ # contain X. For example, if one set of properties contains SEPARABLE and
142+ # another does not, then the resulting set of properties should not contain
143+ # SEPARABLE.
144+ for i in (SEPARABLE , INIT_CORE_SHM , INIT_HALO_LEFT_SHM , INIT_HALO_RIGHT_SHM ):
145+ if not all (i in p for p in args ):
146+ drop .add (i )
128147
129148 properties = set ()
130149 for p in args :
@@ -190,6 +209,11 @@ def update_properties(properties, exprs):
190209 else :
191210 properties = properties .drop (properties = PREFETCHABLE_SHM )
192211
212+ # Remove properties that are trivially incompatible with `exprs`
213+ if not all (e .lhs .function ._mem_shared for e in as_tuple (exprs )):
214+ drop = {INIT_CORE_SHM , INIT_HALO_LEFT_SHM , INIT_HALO_RIGHT_SHM }
215+ properties = properties .drop (properties = drop )
216+
193217 return properties
194218
195219
@@ -269,10 +293,16 @@ def block(self, dims, kind='default'):
269293 return Properties (m )
270294
271295 def inbound (self , dims ):
272- m = dict (self )
273- for d in as_tuple (dims ):
274- m [d ] = set (m .get (d , [])) | {INBOUND }
275- return Properties (m )
296+ return self .add (dims , INBOUND )
297+
298+ def init_core_shm (self , dims ):
299+ return self .add (dims , INIT_CORE_SHM )
300+
301+ def init_halo_left_shm (self , dims ):
302+ return self .add (dims , INIT_HALO_LEFT_SHM )
303+
304+ def init_halo_right_shm (self , dims ):
305+ return self .add (dims , INIT_HALO_RIGHT_SHM )
276306
277307 def is_parallel (self , dims ):
278308 return any (len (self [d ] & {PARALLEL , PARALLEL_INDEP }) > 0
@@ -299,13 +329,28 @@ def is_blockable(self, d):
299329 def is_blockable_small (self , d ):
300330 return TILABLE_SMALL in self .get (d , set ())
301331
302- def is_prefetchable (self , dims = None , v = PREFETCHABLE ):
332+ def _is_property_any (self , dims , v ):
303333 if dims is None :
304334 dims = list (self )
305335 return any (v in self .get (d , set ()) for d in as_tuple (dims ))
306336
337+ def is_prefetchable (self , dims = None , v = PREFETCHABLE ):
338+ return self ._is_property_any (dims , PREFETCHABLE )
339+
307340 def is_prefetchable_shm (self , dims = None ):
308- return self .is_prefetchable (dims , PREFETCHABLE_SHM )
341+ return self ._is_property_any (dims , PREFETCHABLE_SHM )
342+
343+ def is_core_init (self , dims = None ):
344+ return self ._is_property_any (dims , INIT_CORE_SHM )
345+
346+ def is_halo_left_init (self , dims = None ):
347+ return self ._is_property_any (dims , INIT_HALO_LEFT_SHM )
348+
349+ def is_halo_right_init (self , dims = None ):
350+ return self ._is_property_any (dims , INIT_HALO_RIGHT_SHM )
351+
352+ def is_halo_init (self , dims = None ):
353+ return self .is_halo_left_init (dims ) or self .is_halo_right_init (dims )
309354
310355 @property
311356 def nblockable (self ):
0 commit comments