This is an archive of the discontinued LLVM Phabricator instance.

[mlir][bufferization] Support general Attribute as memory space
ClosedPublic

Authored by antiagainst on Nov 18 2022, 1:39 PM.

Details

Summary

MemRef has been accepting a general Attribute as memory space for
a long time. This commits updates bufferization side to catch up,
which allows downstream users to plugin customized symbolic memory
space. This also eliminates quite a few getMemorySpaceAsInt
calls, which is deprecated.

Diff Detail

Event Timeline

antiagainst created this revision.Nov 18 2022, 1:39 PM
Herald added a project: Restricted Project. · View Herald Transcript
antiagainst requested review of this revision.Nov 18 2022, 1:39 PM

LGTM for sparse part, since it is purely mechanical

springerm accepted this revision.Nov 21 2022, 12:36 AM
springerm added inline comments.
mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
236–237

To avoid confusion, replace this with In case of llvm::None.

mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
117–121

Can you try rewriting this as:

allocTensorOp.setMemorySpaceAttr(copyBufferType->getMemorySpace());
This revision is now accepted and ready to land.Nov 21 2022, 12:36 AM
antiagainst marked an inline comment as done.

Rebase

antiagainst marked an inline comment as done.Nov 21 2022, 6:40 AM
antiagainst added inline comments.
mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
117–121

It would crash given that setMemorySapceAttr expects the argument to be not null.

antiagainst marked an inline comment as done.

Address comments

This revision was landed with ongoing or failed builds.Nov 21 2022, 6:43 AM
This revision was automatically updated to reflect the committed changes.