This is an archive of the discontinued LLVM Phabricator instance.

[mlir][bufferization][NFC] Make `escape` a dialect attribute
ClosedPublic

Authored by springerm on Jun 19 2022, 4:24 AM.

Details

Summary

All bufferizable ops that bufferize to an allocation receive a bufferization.escape attribute during TensorCopyInsertion.

Diff Detail

Event Timeline

springerm created this revision.Jun 19 2022, 4:24 AM
springerm requested review of this revision.Jun 19 2022, 4:24 AM
aartbik added inline comments.Jun 22 2022, 9:51 AM
mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
31

did you really intent, "may bufferize to", or will "bufferizes to" be better?

mlir/include/mlir/Dialect/Bufferization/IR/BufferizationBase.td
43

perhaps add one more sentence on clarifying "escape", for example

which means the buffer needs to be allocated outside this method

or

which means the allocation "escape" the scope of the method to the caller

(or something like that

mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp
69

Can't we use this condition to guard the whole analysis?

springerm marked 2 inline comments as done.Jun 23 2022, 4:09 AM
springerm added inline comments.
mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
31

Yes, this is on purpose. Sometimes we don't know what's going to happen at runtime. Then we should return true here. Extended the comment.

springerm updated this revision to Diff 439325.Jun 23 2022, 4:10 AM

address comments

aartbik accepted this revision.Jun 23 2022, 9:41 AM
This revision is now accepted and ready to land.Jun 23 2022, 9:41 AM
This revision was landed with ongoing or failed builds.Jun 23 2022, 10:34 AM
This revision was automatically updated to reflect the committed changes.