You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[MLIR][Affine] Add functionality to demote invalid symbols to dims
Fixes: #120189
Introduce a method to demote a symoblic operand to a dimensional one
(the inverse of the current canonicalizePromotedSymbols).
Demote operands that could/should have been valid affine dimensional
values (affine loop IVs or their functions) from symbols to dims. This
is a general method that can be used to legalize a map + operands post
construction depending on its operands.
In several cases, affine.apply operands that could be dims for the
purpose of affine analysis were being used in symbolic positions
undetected. Fix the verifier so that affine dim-only SSA values aren't
used in symbolic positions; otherwise, it was possible for
`-canonicalize` to have generated invalid IR. This doesn't affect other
users in other context where the operands were neither valid dims or
symbols (for eg. in scf.for or other region ops).
In some cases, this change also leads to better simplified operands,
duplicates eliminated as shown in one of the test cases where the same
operand appeared as a symbol and as a dim.
This PR also fixes test cases where dimensional positions should have
been ideally used with affine.apply (for affine loop IVs for example).
For several use cases, the IR builder/user wouldn't need to worry about
dim/symbols since canonicalizeMapOrSetAndOperands is updated to
transparently take care of it to ensure valid IR. Users outside of
affine analyses/dialects remain unaffected.
0 commit comments