Skip to content

Commit

Permalink
Transformations: Use SubstituteExpression to apply range normalisation
Browse files Browse the repository at this point in the history
This prevents updated delcarations being appended to the end of the spec.
  • Loading branch information
mlange05 committed Aug 23, 2024
1 parent f98c44e commit f17d8c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion loki/transformations/array_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def is_one_index(dim):
new_shape = [d.upper if is_one_index(d) else d for d in v.shape]
new_type = v.type.clone(shape=as_tuple(new_shape))
vmap[v] = v.clone(dimensions=as_tuple(new_dims), type=new_type)
routine.variables = [vmap.get(v, v) for v in routine.variables]
routine.spec = SubstituteExpressions(vmap).visit(routine.spec)
routine.body = SubstituteExpressions(vmap).visit(routine.body)


def promote_variables(routine, variable_names, pos, index=None, size=None):
Expand Down

0 comments on commit f17d8c7

Please sign in to comment.