This is an archive of the discontinued LLVM Phabricator instance.

[mlir][bufferization] BufferDeallocationOpInterface: support custom ownership update logic
ClosedPublic

Authored by maerhart on Aug 25 2023, 2:44 AM.

Details

Summary

Add a method to the BufferDeallocationOpInterface that allows operations to
implement the interface and provide custom logic to compute the ownership
indicators of values it defines. As a demonstrating example, this new method is
implemented by the arith.select operation.

Depends on D158756

Diff Detail

Event Timeline

maerhart created this revision.Aug 25 2023, 2:44 AM
Herald added a reviewer: kuhar. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
maerhart requested review of this revision.Aug 25 2023, 2:44 AM
springerm added inline comments.Aug 31 2023, 8:07 AM
mlir/include/mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.td
46–47

the given MemRef typed value

50

and avoid

mlir/lib/Dialect/Arith/Transforms/BufferDeallocationOpInterfaceImpl.cpp
43

materializes

54

I think you still have to call the other handlers in handleAllInterfaces. They are skipped at the moment. A nullptr return value could indicate that the other interface handlers should be skipped. (A non-null op means, they should not be skipped.)

maerhart updated this revision to Diff 556569.Sep 12 2023, 6:19 AM
maerhart marked 3 inline comments as done.

address comments

mlir/lib/Dialect/Arith/Transforms/BufferDeallocationOpInterfaceImpl.cpp
54

I'm not quite sure if I understand. Which handlers should I call here? arith.select does not implement any interfaces that the handlers care about. According to my understanding, the current implementation is correct.

springerm accepted this revision.Sep 12 2023, 6:27 AM
This revision is now accepted and ready to land.Sep 12 2023, 6:27 AM
This revision was landed with ongoing or failed builds.Sep 13 2023, 2:31 AM
This revision was automatically updated to reflect the committed changes.