Skip to content

Commit

Permalink
compiler: Make generation of ComponentAccess deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioLuporini committed Jan 24, 2025
1 parent dba62be commit 21c3766
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion devito/types/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,11 @@ def dtype(self):

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

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

0 comments on commit 21c3766

Please sign in to comment.