@@ -259,10 +259,17 @@ def guard(clusters):
259259 # Separate out the indirect ConditionalDimensions, which only serve
260260 # the purpose of protecting from OOB accesses
261261 cds = [d for d in cds if not d .indirect ]
262+ modes = [cd .relation for cd in cds ]
263+ if len ({m == 'strict' for m in modes }) > 1 :
264+ raise CompilationError ("Only one `strict` condition"
265+ "can be used in an equation" )
266+ elif 'strict' in modes :
267+ mode = 'strict'
268+ else :
269+ mode = sympy .And if sympy .And in modes else sympy .Or
262270
263271 # Chain together all `cds` conditions from all expressions in `c`
264272 guards = {}
265- mode = sympy .Or
266273 for cd in cds :
267274 # `BOTTOM` parent implies a guard that lives outside of
268275 # any iteration space, which corresponds to the placeholder None
@@ -279,7 +286,6 @@ def guard(clusters):
279286
280287 # Pull `cd` from any expr
281288 condition = guards .setdefault (k , [])
282- mode = mode and cd .relation
283289 for e in exprs :
284290 try :
285291 condition .append (e .conditionals [cd ])
@@ -296,7 +302,10 @@ def guard(clusters):
296302
297303 # Combination `mode` is And by default.
298304 # If all conditions are Or then Or combination `mode` is used.
299- guards = {d : mode (* v , evaluate = False ) for d , v in guards .items ()}
305+ if mode == 'strict' :
306+ guards = {d : v [0 ] for d , v in guards .items ()}
307+ else :
308+ guards = {d : mode (* v , evaluate = False ) for d , v in guards .items ()}
300309
301310 # Construct a guarded Cluster
302311 processed .append (c .rebuild (exprs = exprs , guards = guards ))
0 commit comments