Page MenuHomePhabricator

[MLIR] Add flat affine constraints method to round trip integer set
ClosedPublic

Authored by bondhugula on Tue, Mar 24, 6:31 AM.

Details

Reviewers
andydavis1
flaub
Summary
  • add method to get back an integer set from flat affine constraints; this allows a round trip
  • use this to complete the simplification of integer sets in -simplify-affine-structures
  • update FlatAffineConstraints::removeTrivialRedundancy to also do GCD tightening and normalize by GCD (while still keeping it linear time).

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>

Diff Detail

Event Timeline

bondhugula created this revision.Tue, Mar 24, 6:31 AM
bondhugula retitled this revision from [MLIR] add flat affine constraints method to round trip integer set to [MLIR] Add flat affine constraints method to round trip integer set.Tue, Mar 24, 6:37 AM
andydavis1 accepted this revision.Wed, Mar 25, 2:43 PM
andydavis1 added inline comments.
mlir/lib/Analysis/AffineStructures.cpp
2718

What assures that this doesn't loop forever?

2728

Thought we had a method that did this already? Or was it just checking for all ones? If so, maybe it could be combined.

This revision is now accepted and ready to land.Wed, Mar 25, 2:43 PM
bondhugula marked 3 inline comments as done.

Address review comments

Thanks for the review, Andy.

mlir/lib/Analysis/AffineStructures.cpp
2718

Good question. Each time changed stays true at the end of body,
one or more new positions (identifiers) have been detected as a floordiv, and memo[<those positions>] becomes non-null; so, the number of null entries for local var positions in memo strictly reduces each iteration (starting from getNumLocalIds()); so this will converge. Added a comment.

2728

Just scanned through - we do have a findConstraintWithNonZeroAt (which also sets the row position if we find one) - it has to be called for either equalities or inequalities. I can actually reuse it from isColZero. Thanks.

bondhugula marked an inline comment as done.Wed, Mar 25, 10:03 PM

Cleanup - getNumDimIds() -> numDims

bondhugula closed this revision.Thu, Mar 26, 6:31 PM

Closed by commit rG92744f624783 [MLIR] Add flat affine constraints method to round trip integer set (authored by bondhugula)