Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Induction variables ordering #46

Closed
mscuttari opened this issue Oct 14, 2024 · 1 comment
Closed

Induction variables ordering #46

mscuttari opened this issue Oct 14, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mscuttari
Copy link
Member

mscuttari commented Oct 14, 2024

The MCIM data structure is able to handle generic access functions, but it has been designed - and is efficient for - roto-translation accesses (i.e., in the [i +- constant] form) having an identity-like structure (i.e., with the induction variables being accessed in the same order of their declaration).
For this reason, code like the following would lead to inefficiencies because of the identified (d0,d1) -> (d1,d0) affine accesses, in which the induction variables d0 and d1 are ordered differently within the access.

for i in 1:10 loop
  for j in 1:20 loop
    x[j,i] = y[j,i];
  end for;
end for;

However, such code is equivalent to the following, in which only the declaration of the induction variables has been flipped.

for j in 1:20 loop
  for i in 1:10 loop
    x[j,i] = y[j,i];
  end for;
end for;

Here, the affine accesses have become (d0,d1) -> (d0,d1) without any change in the semantics of the model.
A transformation pass should be created to detect such optimization opportunity and reorder the induction variables accordingly. Such pass should iterate on each equation template and analyze all the accesses within, understanding if the amount of accesses that would benefit from this optimization is higher than the amount of accesses that would become non optimizable. Of course, the iteration ranges of equation instances should also be modified accordingly.

@mscuttari mscuttari added the enhancement New feature or request label Oct 14, 2024
@mscuttari
Copy link
Member Author

a4fc44d solves the problem by replacing the Delta data structure with the already existing local matching generator for access functions and by addressing the individual point modifications in a separate IndexSet. The access function groups generator is already capable of handling out-of-order (and also unused) induction variables, making this optimization unneeded.

@mscuttari mscuttari closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant