This is an archive of the discontinued LLVM Phabricator instance.

[mlir][bufferize] Support alloc hoisting across function boundaries
ClosedPublic

Authored by springerm on May 11 2022, 4:57 AM.

Details

Summary

This change integrates the BufferResultsToOutParamsPass into One-Shot Module Bufferization. This improves memory management (deallocation) when buffers are returned from a function.

Note: This currently only works with statically-sized tensors. The generated code is not very efficient yet and there are opportunities for improvment (fewer copies). By default, this new functionality is deactivated.

Depends On D125375

Diff Detail

Event Timeline

springerm created this revision.May 11 2022, 4:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2022, 4:57 AM
springerm requested review of this revision.May 11 2022, 4:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2022, 4:57 AM
tpopp accepted this revision.May 11 2022, 7:23 AM
tpopp added inline comments.
mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
273

I think this is duplicated.

274

What about having if (!hasLeakingAllocs) return success() before the following 2 cases?

This revision is now accepted and ready to land.May 11 2022, 7:23 AM
springerm updated this revision to Diff 428665.May 11 2022, 7:49 AM

address comments

springerm marked 2 inline comments as done.May 11 2022, 7:49 AM
springerm added inline comments.
mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
273

this is on purpose. both function calls need an options parameter

springerm marked an inline comment as done.May 12 2022, 12:43 AM
This revision was landed with ongoing or failed builds.May 12 2022, 12:47 AM
This revision was automatically updated to reflect the committed changes.