[MLIR] Fix memref get constant bound size and shape methodClosedPublicActions

Authored by bondhugula on Jun 29 2021, 10:20 PM.

Details

Reviewers
 dcaballe andydavis1 navdeepkk nicolasvasilache vinayaka-polymage
Commits
rG715137d0c8f9: [MLIR] Fix memref get constant bound size and shape method
Summary

Fix FlatAffineConstraints::getConstantBoundOnDimSize to ensure that
returned bounds on dim size are always non-negative regardless of the
constraints on that dimension. Add an assertion at the user.

Diff Detail

Event Timeline

bondhugula created this revision.Jun 29 2021, 10:20 PM
bondhugula requested review of this revision.Jun 29 2021, 10:20 PM
Herald added a project: Restricted Project.

Drop blank line. Update comment.

vinayaka-polymage accepted this revision.Jul 5 2021, 9:32 AM

It seems correct to me, that the constant bound is non-negative always, on principle. Was this bound being negative creating any problem in some cases ? If yes, it might be useful to mention that in comments.

This revision is now accepted and ready to land.Jul 5 2021, 9:32 AM

It seems correct to me, that the constant bound is non-negative always, on principle. Was this bound being negative creating any problem in some cases ? If yes, it might be useful to mention that in comments.

Yes, for any user of that method, a negative bound would be problematic and wrong by definition. For eg. MemRefRegion::getConstantBoundingSizeAndShape is in turn used by memref region compute, which is in turn used by many things including affineDataCopyGenerate. Since this is a lower-level API, we'd like to avoid referring to its users - since the latter change. By design/definition this bound has to be non-negative.

This revision was automatically updated to reflect the committed changes.