This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Presburger] subtract: improve redundant constraint detection
ClosedPublic

Authored by arjunp on Jun 7 2022, 11:03 AM.

Details

Summary

When constraints in the two operands make each other redundant, prefer constraints of the second because this affects the number of sets in the output at each level; reducing these can help prevent exponential blowup.

This is accomplished by adding extra overloads to Simplex::detectRedundant that only scan a subrange of the constraints for redundancy.

Diff Detail

Event Timeline

arjunp created this revision.Jun 7 2022, 11:03 AM
arjunp requested review of this revision.Jun 7 2022, 11:03 AM
Groverkss accepted this revision.Jun 7 2022, 1:47 PM
Groverkss edited the summary of this revision. (Show Details)

LGTM with a minor comment

mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
297–305

I feel this comment can explain the code better. Currently, it explains why we do detectRedundant(offset, count) instead of detectRedundant(). I think only the first paragraph is fine.

This revision is now accepted and ready to land.Jun 7 2022, 1:47 PM
arjunp added inline comments.Jun 7 2022, 8:00 PM
mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
297–305

I didn't understand the first sentence. What do you mean by "can explain the code better"?

I think just the first paragraph is not sufficient to explain why we are specifically calling detectrRedundant (offset, count)?

arjunp updated this revision to Diff 435198.Jun 8 2022, 8:56 AM

clang-format

Groverkss added inline comments.Jun 8 2022, 9:30 AM
mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
297–305

I just meant it's already clear that you are checking if the inequalities from the range offset, offset + totalNewInequalities are redundant from the first comment.

For the second paragraph, if you could write "The reason we use detectRedundant(offset, count) instead of detectRedundant() ..."

arjunp updated this revision to Diff 435232.Jun 8 2022, 10:03 AM

Address Kunwar's comment