This is an archive of the discontinued LLVM Phabricator instance.

[mlir][bufferize] Fix missing copies when writing to a buffer in a loop
ClosedPublic

Authored by springerm on Apr 14 2022, 6:11 AM.

Details

Summary

Writes into tensors that are definied outside of a repetitive region, but with the write happening inside of the repetitive region were previously not considered conflicts. This was incorrect.

E.g.:

%0 = ... : tensor<?xf32>
scf.for ... {
  "reading_op"(%0) : tensor<?xf32>
  %1 = "writing_op"(%0) : tensor<?xf32> -> tensor<?xf32>
  ...
}

In the above example, "writing_op" should be out-of-place.

This commit fixes the bufferization for any op that declares its repetitive semantics via RegionBranchOpInterface.

Depends On D123790

Diff Detail

Event Timeline

springerm created this revision.Apr 14 2022, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2022, 6:11 AM
springerm requested review of this revision.Apr 14 2022, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2022, 6:11 AM
nicolasvasilache added inline comments.
mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
451

typo: dominance

This revision is now accepted and ready to land.Apr 20 2022, 12:10 AM