There was a bug in scf.for loop bufferization that could lead to a missing buffer copy (alloc was there, but not the copy).
Depends On D135052
Paths
| Differential D135053
[mlir][scf][bufferize] Fix bufferizesToMemoryRead with 0 loop iterations ClosedPublic Authored by springerm on Oct 2 2022, 7:20 PM.
Details Summary There was a bug in scf.for loop bufferization that could lead to a missing buffer copy (alloc was there, but not the copy). Depends On D135052
Diff Detail
Event Timelinespringerm added a child revision: D135054: [mlir][bufferize] Remove alias consistency check.Oct 2 2022, 7:21 PM nicolasvasilache added inline comments.
This revision now requires changes to proceed.Oct 13 2022, 1:08 AM This revision is now accepted and ready to land.Oct 24 2022, 5:17 AM Closed by commit rGc9b3638126e5: [mlir][scf][bufferize] Fix bufferizesToMemoryRead with 0 loop iterations (authored by springerm). · Explain WhyOct 24 2022, 5:34 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 470122 mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
mlir/test/Dialect/SCF/one-shot-bufferize-analysis.mlir
mlir/test/Dialect/SCF/one-shot-bufferize.mlir
|
This feels too brutal to me.
I'd add a method on loop-like interface that distinguishes whether the loop is statically known to have 0 or at least 1 iteration.
The statically know 0-iteration case should be plumbed through properly in canonicalizers, folding patterns etc.
Then, if we don't statically know there is at least 1 iteration we would return true here to be conservative.
I imagine this would be costly and that the proper solution in the longer term is to have ref counting.