[Mlir-commits] [mlir] [mlir][bufferization] Return BufferLikeType in BufferizableOpInterface (PR #144867)

Matthias Springer llvmlistbot at llvm.org
Mon Jun 30 02:26:49 PDT 2025


================
@@ -3606,4 +3606,57 @@ def TestDummyMemrefOp : TEST_Op<"dummy_memref_op", []> {
   );
 }
 
+def TestCreateTensorOp : TEST_Op<"create_tensor_op", [BufferizableOpInterface]> {
+  let arguments = (ins);
+  let results = (outs Arg<TestTensorType>:$output);
+  let extraClassDeclaration = [{
+    // BufferizableOpInterface
+    bool bufferizesToMemoryRead(mlir::OpOperand&,
+      const mlir::bufferization::AnalysisState&);
+
+    bool bufferizesToMemoryWrite(mlir::OpOperand&,
+      const mlir::bufferization::AnalysisState&);
+
+    bool bufferizesToAllocation(mlir::Value value);
+
+    mlir::bufferization::AliasingValueList getAliasingValues(mlir::OpOperand&,
----------------
matthias-springer wrote:

You can use `DeclareOpInterfaceMethods` instead of pre-declaring these here.

https://github.com/llvm/llvm-project/pull/144867


More information about the Mlir-commits mailing list