This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Presburger] LexSimplex::addEquality: add equalities as fixed columns
ClosedPublic

Authored by arjunp on Mar 21 2022, 11:27 AM.

Details

Summary

In LexSimplex, instead of adding equalities as a pair of inequalities,
add them as a single row, move them into the basis, and keep them there.

There will always be a valid basis involving all non-redundant equalities. Such
equalities will then be ignored in some other operations, such as when looking
for pivot columns. This speeds them up a little bit.

More importantly, this is an important precursor patch to adding support for
symbolic integer lexmin, as this heuristic can sometimes make a big difference there.

Diff Detail

Event Timeline

arjunp created this revision.Mar 21 2022, 11:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2022, 11:27 AM
arjunp requested review of this revision.Mar 21 2022, 11:27 AM
Groverkss edited the summary of this revision. (Show Details)Mar 23 2022, 3:19 AM
Groverkss added inline comments.Mar 23 2022, 3:25 AM
mlir/include/mlir/Analysis/Presburger/Simplex.h
311–314

I don't think you need to delete this. You can return numFixedCols here instead and keep using this function.

arjunp updated this revision to Diff 417569.Mar 23 2022, 4:57 AM
  • address comments
  • clang-format
Groverkss added inline comments.Mar 23 2022, 2:30 PM
mlir/include/mlir/Analysis/Presburger/Simplex.h
455

Can you please write a doc comment specifying how this is different from SimplexBase::addEquality?

arjunp updated this revision to Diff 417773.Mar 23 2022, 4:04 PM

Fix a bug by making addEquality virtual. Moved the implementation of addEquality from SimplexBase to Simplex.

arjunp added inline comments.Mar 23 2022, 4:05 PM
mlir/include/mlir/Analysis/Presburger/Simplex.h
455

Moved SimplexBase::addEquality to Simplex::addEquality. Added a doc comment to explain what LexSimplex::addEquality is doing. Simplex and LexSimplex just do things differently. I think these implementation details needn't be mentioned in the header.

This revision is now accepted and ready to land.Mar 23 2022, 5:08 PM
This revision was landed with ongoing or failed builds.Mar 23 2022, 5:41 PM
This revision was automatically updated to reflect the committed changes.