This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] FlatAffineConstraints: Ensure dimensionalities match when calling mergeLocalIds
ClosedPublic

Authored by Groverkss on Oct 29 2021, 12:48 PM.

Details

Summary

This patch reorders mergeLocalIds usage to merge locals only after number of
dimensions and symbols are same. This does not change any functionality
because it does not matter in what order identifiers are merged, since
the reason to do it is to ensure that two FACs are aligned.

The order ensured in this patch simplifies a subsequent patch to improve
mergeLocalIds which requires dimensions and symbols to be aligned.

Diff Detail

Event Timeline

Groverkss created this revision.Oct 29 2021, 12:48 PM
Groverkss requested review of this revision.Oct 29 2021, 12:48 PM
bondhugula added inline comments.Oct 29 2021, 11:26 PM
mlir/lib/Analysis/AffineStructures.cpp
1877–1884

Do you rule out a use case for merging local ids where the number of dim and symbol ids do not match? Note that this is just merge the local id's in the system as opposed to touching the constraints.

Groverkss added inline comments.Oct 30 2021, 1:18 AM
mlir/lib/Analysis/AffineStructures.cpp
1877–1884

Yes, that case is not supported by mergeLocalIds after this patch. Although, I don't see any use case as of now where the implementation cannot be changed to match dim and symbol ids before matching local ids. The reason to ensure this dimension/symbol matching is shown more in this child revision: https://reviews.llvm.org/D112867.

Groverkss retitled this revision from [MLIR][NFC] FlatAffineConstraints: Ensure dimensionalities match when calling mergeLocalIds to [MLIR] FlatAffineConstraints: Ensure dimensionalities match when calling mergeLocalIds.Oct 30 2021, 1:26 AM
bondhugula added inline comments.Oct 30 2021, 5:01 AM
mlir/lib/Analysis/AffineStructures.cpp
1877–1884

I too tend to agree - I don't see such uses cases. It's in general systematic to merge/align dims/symbols first and then merge local IDs. So this patch looks good.

bondhugula accepted this revision.Oct 30 2021, 5:02 AM
This revision is now accepted and ready to land.Oct 30 2021, 5:02 AM