@@ -385,14 +385,19 @@ def distance(self, other):
385385 # it's provable that they never intersect
386386 if sai and sit == oit and disjoint_test (self [n ], other [n ], sai , sit ):
387387 return Vector (S .ImaginaryUnit )
388+
389+ # if 'p_bck_xx,[t, x + 9, y + 16, z + 16' in str(self):
390+ # from IPython import embed; embed()
388391
389392 # Compute the distance along the current IterationInterval
390393 if self .function ._mem_shared :
391394 # Special case: the distance between two regular, thread-shared
392395 # objects falls back to zero, as any other value would be
393396 # nonsensical
394397 ret .append (S .Zero )
395- elif degenerating_dimensions (sai , oai ):
398+ # FIXME: This should have returned True
399+ # elif degenerating_indices(sai, oai):
400+ elif degenerating_indices (self [n ], other [n ], self .function ):
396401 # Special case: `sai` and `oai` may be different symbolic objects
397402 # but they can be proved to systematically generate the same value
398403 ret .append (S .Zero )
@@ -1425,17 +1430,38 @@ def disjoint_test(e0, e1, d, it):
14251430 return not bool (i0 .intersect (i1 ))
14261431
14271432
1428- def degenerating_dimensions ( d0 , d1 ):
1433+ def degenerating_indices ( i0 , i1 , function ):
14291434 """
1430- True if `d0 ` and `d1 ` are Dimensions that are possibly symbolically
1435+ True if `i0 ` and `i1 ` are indices that are possibly symbolically
14311436 different, but they can be proved to systematically degenerate to the
14321437 same value, False otherwise.
14331438 """
14341439 # Case 1: ModuloDimensions of size 1
14351440 try :
1436- if d0 .is_Modulo and d1 .is_Modulo and d0 .modulo == d1 .modulo == 1 :
1441+ if i0 .is_Modulo and i1 .is_Modulo and i0 .modulo == i1 .modulo == 1 :
14371442 return True
14381443 except AttributeError :
14391444 pass
14401445
1446+ # Case 2: SteppingDimension corresponding to buffer of size 1
1447+ # if str(i1) == "t - 1" and str(i0) == 't':
1448+ # from IPython import embed; embed()
1449+
1450+ # Extract dimension from both IndexAccessFunctions -> d0, d1
1451+ try :
1452+ d0 = i0 .d
1453+ except AttributeError :
1454+ d0 = i0
1455+
1456+ try :
1457+ d1 = i1 .d
1458+ except AttributeError :
1459+ d1 = i1
1460+
1461+ with suppress (AttributeError ):
1462+ if d0 is d1 and d0 .is_Stepping :
1463+ # Buffer is size 1
1464+ if function ._size_domain [d0 ] == 1 :
1465+ return True
1466+
14411467 return False
0 commit comments