This is an archive of the discontinued LLVM Phabricator instance.

[mlir][bufferize] Better analysis for return values of CallOps
ClosedPublic

Authored by springerm on Feb 7 2022, 2:22 AM.

Details

Summary

Support returning arbitrary tensors from functions. Even those that are not equivalent. To that end, additional information is gathered during the analysis phase. In particular, which function args are aliasing with which return values.

Also fix bugs in the current implementation when returning equivalent tensors. Various unit tests are added to ensure that we have better test coverage.

Note: Returning non-equivalent tensors is only allowed when allowReturnAllocs is enabled. This functionality is useful for unit testing and compatibility with other bufferizations such as the sparse compiler. This is also towards using ModuleBufferization as a replacement for --func-bufferize.

Depends On D123208

Diff Detail

Event Timeline

springerm created this revision.Feb 7 2022, 2:22 AM
springerm requested review of this revision.Feb 7 2022, 2:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2022, 2:22 AM
springerm retitled this revision from [mlir][linalg][bufferize] Support returning memrefs to [mlir][bufferize] Support returning non-equivalent memrefs during function calls.Mar 16 2022, 12:59 AM
springerm edited the summary of this revision. (Show Details)
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2022, 12:59 AM
springerm retitled this revision from [mlir][bufferize] Support returning non-equivalent memrefs during function calls to [mlir][bufferize] Better analysis for return values of CallOps.Mar 22 2022, 6:57 AM
springerm edited the summary of this revision. (Show Details)
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp
117

Please add a meaningfully named type, e.g. using MeaningfulTypeName = int64_t

122–123

Please add detailed comment as to why this is needed and the operand / bbArg ordering assumption behind it.

126

This seems like an independent change that could be split out and reduce the load-bearing footprint of this PR.
Please feel free to land the NFC without further review.

470–471

This seems like an independent change that could be split out and reduce the load-bearing footprint of this PR.
Please feel free to land the PR without further review.

springerm marked 4 inline comments as done.Apr 6 2022, 7:13 AM
springerm added inline comments.
mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp
122–123

Added comment at the beginning of the struct.

springerm updated this revision to Diff 420861.Apr 6 2022, 7:42 AM
springerm marked an inline comment as done.

rebase

nicolasvasilache accepted this revision.Apr 6 2022, 7:48 AM
This revision is now accepted and ready to land.Apr 6 2022, 7:48 AM
This revision was landed with ongoing or failed builds.Apr 6 2022, 7:56 AM
This revision was automatically updated to reflect the committed changes.