[Mlir-commits] [mlir] [mlir][bufferization] Support custom types (1/N) (PR #142986)

Andrei Golubev llvmlistbot at llvm.org
Wed Jun 18 01:13:17 PDT 2025


================
@@ -21,10 +21,31 @@ def Bufferization_TensorLikeTypeInterface
   let description = [{
     Indicates that this type is a tensor type (similarly to a MLIR builtin
     tensor) for bufferization purposes.
-
-    The interface currently has no methods as it is used by types to opt into
-    being supported by the bufferization procedures.
   }];
+
+  let methods = [
+    InterfaceMethod<[{
+        Returns a BufferLike type for this TensorLike type.
+      }],
+      /*retTy=*/"::mlir::FailureOr<::mlir::bufferization::BufferLikeType>",
+      /*methodName=*/"getBufferType",
+      /*args=*/(ins
+        "const ::mlir::bufferization::BufferizationOptions &":$options,
+        "const ::mlir::bufferization::BufferizationState &":$state,
----------------
andrey-golubev wrote:

honestly, i have no idea what this state thing is... I don't really need it myself, imho options is enough. I saw that `getBufferType` accepts it now, so there's a chance it's actually used by something? (no clue). let me try to make some sense out of it.

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


More information about the Mlir-commits mailing list