This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Simplex: support adding new variables dynamically
ClosedPublic

Authored by arjunp on Sep 17 2021, 5:58 AM.

Diff Detail

Event Timeline

arjunp created this revision.Sep 17 2021, 5:58 AM
arjunp requested review of this revision.Sep 17 2021, 5:58 AM
arjunp updated this revision to Diff 373202.Sep 17 2021, 6:11 AM

Fix a bug.

Added some comments.

mlir/include/mlir/Analysis/Presburger/Simplex.h
165

Please use triple / doc comments here.

mlir/lib/Analysis/Presburger/Simplex.cpp
348

An assert for i. j not exceeding number of columns would be useful here.

454–455

nit: Did you mean to write "Therefore, no constraint currently..." ?

arjunp updated this revision to Diff 373407.Sep 18 2021, 3:35 AM

Address Kunwar's comments.

arjunp marked 3 inline comments as done.Sep 18 2021, 3:37 AM

Thanks for the review!

This revision is now accepted and ready to land.Sep 18 2021, 8:58 AM
This revision was automatically updated to reflect the committed changes.
bondhugula added inline comments.Sep 19 2021, 8:54 PM
mlir/include/mlir/Analysis/Presburger/Simplex.h
166

This isn't appropriately named I think because you are allowing one or more variables. I'd prefer not having a default argument here and just naming it appendVariables. It addresses both the naming and makes it explicit for the single var case as well and is as compact.

mlir/lib/Analysis/Presburger/Simplex.cpp
485

You are missing an early:

if (count == 0)
  return
arjunp marked an inline comment as done.Sep 20 2021, 12:47 AM

Thanks for the review!

mlir/include/mlir/Analysis/Presburger/Simplex.h
166

I agree with you. I only named it this way for consistency with the insert*Id/append*Id functions that were already present in FlatAffineConstraints (https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Analysis/AffineStructures.h#L258-L269). Shall I rename all of these to plural?

mlir/lib/Analysis/Presburger/Simplex.cpp
485

Thanks, added.

bondhugula added inline comments.Sep 20 2021, 1:52 AM
mlir/include/mlir/Analysis/Presburger/Simplex.h
166

Oh, I see. We can leave it as is then - was a minor comment.