This is an archive of the discontinued LLVM Phabricator instance.

[mlir][SCF] Fix off-by-one bug in affine analysis
ClosedPublic

Authored by springerm on Nov 17 2021, 9:49 PM.

Details

Summary

This change is NFC. There were two issues when passing/reading upper bounds into/from FlatAffineConstraints that negate each other, so the bug was not apparent. However, it made debugging harder because some constraints in the FlatAffineConstraints were off by one when dumping all constraints.

Diff Detail

Event Timeline

springerm created this revision.Nov 17 2021, 9:49 PM
springerm requested review of this revision.Nov 17 2021, 9:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 17 2021, 9:49 PM

LGTM, accept conditioned on writing an extra unittest to lock in the new behavior without things cancelling out.

This revision is now accepted and ready to land.Nov 24 2021, 12:16 AM

I tried adding a unit test, but the effect of this change is localized to canonicalizeMinMaxOp and not visible outside of the function. Basically, this was not a problem of FlatAffineConstraints itself, but just incorrect API usage. To test this change, I would have to split canonicalizeMinMaxOp into separate functions, so that I can call them separately from a unit test. Splitting the function in such a way does not make sense conceptually though and would pollute the loop specialization API with functions that should never be called by users. I'll land this commit as is.

This revision was automatically updated to reflect the committed changes.