This is an archive of the discontinued LLVM Phabricator instance.

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

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

Details

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.Mar 24 2020, 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.Mar 24 2020, 6:37 AM
andydavis1 accepted this revision.Mar 25 2020, 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.Mar 25 2020, 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.Mar 25 2020, 10:03 PM

Cleanup - getNumDimIds() -> numDims

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

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