[Mlir-commits] [mlir] [mlir][bufferization] Use TensorLike, BufferLike type interfaces (PR #136736)
Andrei Golubev
llvmlistbot at llvm.org
Fri Apr 25 00:13:51 PDT 2025
================
@@ -1386,3 +1387,26 @@ TestMultiSlotAlloca::handleDestructuringComplete(
const DestructurableMemorySlot &slot, OpBuilder &builder) {
return createNewMultiAllocaWithoutSlot(slot, builder, *this);
}
+
+::mlir::LogicalResult test::TestDummyTensorOp::bufferize(
+ ::mlir::RewriterBase &rewriter,
+ const ::mlir::bufferization::BufferizationOptions &options) {
+ const auto inType = getInput().getType();
+ const auto bufferizedInType = test::TestMemrefType::get(
+ getContext(), inType.getShape(), inType.getElementType(), nullptr);
+ const auto outType = getOutput().getType();
+ const auto bufferizedOutType = test::TestMemrefType::get(
+ getContext(), outType.getShape(), outType.getElementType(), nullptr);
+
+ // replace op with memref analogy, preserve correct types at the boundaries
+ auto toMemref = rewriter.create<::mlir::bufferization::ToMemrefOp>(
+ getLoc(), bufferizedInType, getInput());
+ auto dummyMemrefOp = rewriter.create<test::TestDummyMemrefOp>(
----------------
andrey-golubev wrote:
self-review: to memref / to tensor calls must come from the infrastructure itself. here, one should just create the `TestDummyMemrefOp`?
https://github.com/llvm/llvm-project/pull/136736
More information about the Mlir-commits
mailing list