This is an archive of the discontinued LLVM Phabricator instance.

[mlir][linalg][bufferize] Always bufferize in-place with "out" operands by default
ClosedPublic

Authored by springerm on Feb 19 2022, 2:56 AM.

Details

Summary

In D115022, we introduced an optimization where OpResults of a linalg.generic may bufferize in-place with an "in" OpOperand if the corresponding "out" OpOperand is not used in the computation.

This optimization can lead to unexpected behavior if the newly chosen OpOperand is in the same alias set as another OpOperand (that is used in the computation). In that case, the newly chosen OpOperand must bufferize out-of-place. This can be confusing to users, as always choosing the "out" OpOperand (regardless of whether it is used) would be expected when having the notion of "destination-passing style" in mind.

With this change, we go back to always bufferizing in-place with "out" OpOperands by default, but letting users override the behavior with a bufferization option.

Diff Detail

Event Timeline

springerm created this revision.Feb 19 2022, 2:56 AM
springerm requested review of this revision.Feb 19 2022, 2:56 AM
mravishankar accepted this revision.Feb 23 2022, 3:42 PM
This revision is now accepted and ready to land.Feb 23 2022, 3:42 PM
This revision was landed with ongoing or failed builds.Feb 24 2022, 2:58 AM
This revision was automatically updated to reflect the committed changes.