Skip to content

Commit 21c3766

Browse files
committed
compiler: Make generation of ComponentAccess deterministic
1 parent dba62be commit 21c3766

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

devito/types/array.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,11 @@ def dtype(self):
558558

559559
@cacheit
560560
def sort_key(self, order=None):
561-
return self.base.sort_key(order=order)
561+
# Ensure that the ComponentAccess is sorted as the base
562+
# Also ensure that e.g. `fg[x+1].x` appears before `fg[x+1].y`
563+
class_key, args, exp, coeff = self.base.sort_key(order=order)
564+
args = (len(args[1]) + 1, args[1] + (self.index,))
565+
return class_key, args, exp, coeff
562566

563567
# Default assumptions correspond to those of the `base`
564568
for i in ('is_real', 'is_imaginary', 'is_commutative'):

0 commit comments

Comments
 (0)