[Mlir-commits] [mlir] [mlir][bufferization] Support custom types at function boundaries (PR #159766)

Matthias Springer llvmlistbot at llvm.org
Mon Sep 22 02:58:50 PDT 2025


================
@@ -43,6 +43,18 @@ def Bufferization_TensorLikeTypeInterface
       /*args=*/(ins
         "::mlir::bufferization::BufferLikeType":$bufferType,
         "::llvm::function_ref<::mlir::InFlightDiagnostic()>":$emitError)
+    >,
+    InterfaceMethod<[{
----------------
matthias-springer wrote:

> i'm actually intrigued why the FunctionArgTypeConverterFn needs it

I don't know either. But it could be useful to get more context to do the type conversion.

> thought of the interface here because this seems to be aligned with what we've discussed before:

The problem that I'm seeing is that there are now two ways to configure the type conversion, which is a bit confusing. If we make this interface-based, we should delete the options callback. But I think that's not possible because you wouldn't be able to configure identity/fully dynamic layout maps at the function boundary.

Function boundaries are always a bit special, so I think having an options callback is desirable also for custom tensor/buffer types.

> doing this via options practically means users have to create their own "pass" (i.e. bufferizeOp()'s options have to be seeded with different functions that aren't really configurable outside of C++)

That is the case in every production compiler that I'm aware of. This is not the only flag that cannot be customized as a pass flag. `AllocationFn`, `MemCpyFn` is another one.


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


More information about the Mlir-commits mailing list