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

Matthias Springer llvmlistbot at llvm.org
Wed Jun 18 01:34:41 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,
----------------
matthias-springer wrote:

The state can used during bufferization to store symbol tables, etc. We don't need it during type conversions.

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


More information about the Mlir-commits mailing list