This is an archive of the discontinued LLVM Phabricator instance.

Make buffer hoisting/promotion passes use AllocationOpInterface
ClosedPublic

Authored by xiaoleis on Aug 21 2023, 1:37 AM.

Details

Summary

This update implements the usage of AllocationOpInterface in the buffer hoisting/promotion passes. Two interface methods, namely getHoistingKind and buildPromotedAlloc, have been added. The former indicates which kind of hoisting (loop, block) an allocation operation supports, while the latter builds a stack allocation operation for promotable allocations used by the promote-buffers-to-stack pass.

This update makes these passes be functional for user customized allocation operation.

Diff Detail

Event Timeline

xiaoleis created this revision.Aug 21 2023, 1:37 AM
Herald added a project: Restricted Project. · View Herald Transcript
xiaoleis requested review of this revision.Aug 21 2023, 1:37 AM
springerm accepted this revision.Aug 21 2023, 3:54 AM
springerm added inline comments.
mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h
25

I think we usually don't have this in the enum and instead write Loop | Block where HoistingKind is used.

This revision is now accepted and ready to land.Aug 21 2023, 3:54 AM
xiaoleis updated this revision to Diff 552195.Aug 21 2023, 8:35 PM
This comment was removed by xiaoleis.
xiaoleis updated this revision to Diff 552211.Aug 21 2023, 9:41 PM
xiaoleis marked an inline comment as not done.

Remove LoopAndBlock from HoistingKind as suggested

I do not have commit access, can anyone help me with this? Thanks

mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h
25

Sure, this make sense.

MaskRay added inline comments.
mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
649

In other places, we just write uint8_t and omit std::

xiaoleis updated this revision to Diff 552219.Aug 21 2023, 10:47 PM

Remove the std:: prefix for uint8_t

mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
649

Thanks, std:: is omitted.

xiaoleis updated this revision to Diff 552222.Aug 21 2023, 10:51 PM

Omit std:: for uint8_t in declaration of HoistingKind

xiaoleis updated this revision to Diff 552224.Aug 21 2023, 11:04 PM

Further formatting on std::uint8_t