This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] FlatAffineConstraints: Use Matrix objects to store the constraints
ClosedPublic

Authored by arjunp on Jun 29 2021, 2:25 PM.

Details

Summary

This results in significant deduplication of code. This patch is not expected to change any functionality, it's just some simplification in preparation for future work. Also slightly simplified some code that was being touched anyway and added some unit tests for some functions that were touched.

Diff Detail

Event Timeline

arjunp created this revision.Jun 29 2021, 2:25 PM
arjunp requested review of this revision.Jun 29 2021, 2:25 PM
arjunp added a subscriber: grosser.
arjunp updated this revision to Diff 355369.Jun 29 2021, 2:32 PM

This patch is not expected to change any functionality, it's just some simplification in preparation for future work.

mlir/lib/Analysis/AffineStructures.cpp
146–147

Is there a reason the default copy constructor was not used?

This patch is not expected to change any functionality, it's just some simplification in preparation for future work.

Thanks @arjunp Could you please add this line to the commit summary and add an additional line there on this patch itself?

This looks good in general. Some minor comments below.

mlir/include/mlir/Analysis/AffineStructures.h
70–76

Thanks for cleaning this up - this looks unrelated to the patch. This should at least be mentioned in the summary. "FlatAffineConstraints cleanup"?

88–93

Thanks for removing duplication here. Please also use the "/*....=*/" form wherever constant integers, etc. are being passed - for readability. I think numReservedRows/Cols was earlier uninitialized?

mlir/include/mlir/Analysis/Presburger/Matrix.h
65–66

It would be good to have a doc comment for these.

130

Doc comment please.

130–132

nReservedColumns needs a doc comment at least.

mlir/lib/Analysis/Presburger/Matrix.cpp
96
mlir/unittests/Analysis/Presburger/MatrixTest.cpp
94–115

A bit weird that these tests are under Analysis/Presburger. Is there a better place for them?

bondhugula accepted this revision.Jun 29 2021, 3:09 PM
bondhugula added inline comments.
mlir/include/mlir/Analysis/Presburger/Matrix.h
67–101

All doc comments should be triple ///.

This revision is now accepted and ready to land.Jun 29 2021, 3:09 PM

Nit: the commit title says "Marix" instead of (I think) "Matrix"

arjunp retitled this revision from [MLIR] FlatAffineConstraints: Use Marix objects to store the constraints to [MLIR] FlatAffineConstraints: Use Matrix objects to store the constraints.Jun 30 2021, 1:15 AM
arjunp edited the summary of this revision. (Show Details)
arjunp updated this revision to Diff 355857.Jul 1 2021, 6:37 AM
arjunp marked 7 inline comments as done.

Addressed review comments and fixed some bugs.

arjunp added a comment.Jul 1 2021, 6:39 AM

Thanks for the quick review!

mlir/include/mlir/Analysis/AffineStructures.h
70–76

My primary reason to touch this code was to fix the usage of inequalities.reserve and the reference to nReservedColumns in accordance with the change to Matrix. I did slightly simplify the code since I was touching it anyway; I've mentioned this in the summary now.

mlir/unittests/Analysis/Presburger/MatrixTest.cpp
94–115

Not sure where else to put it since Matrix is under Analysis/Presburger too at the moment. I'm happy to have them both moved in another patch if there's a better place for them.

arjunp updated this revision to Diff 355870.EditedJul 1 2021, 7:16 AM

Fixed another bug, the tests should pass now.

arjunp updated this revision to Diff 355878.Jul 1 2021, 7:44 AM

Added regression tests for the bugs in the patch I fixed.

arjunp edited the summary of this revision. (Show Details)Jul 1 2021, 7:46 AM