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

Andrei Golubev llvmlistbot at llvm.org
Wed Jun 18 01:20:45 PDT 2025


================
@@ -267,7 +268,7 @@ struct BufferizationOptions {
   /// Tensor -> MemRef type converter.
   /// Parameters: Value, memory space, bufferization options
   using UnknownTypeConverterFn = std::function<BaseMemRefType(
-      Value, Attribute memorySpace, const BufferizationOptions &)>;
+      TensorType, Attribute memorySpace, const BufferizationOptions &)>;
----------------
andrey-golubev wrote:

I need this together with `getMemRefType()` API change since TensorLike::getBufferType() works with *types* (there are no values). see https://github.com/llvm/llvm-project/pull/142986/files#diff-93e08b1e03259ffa2ff33aec1bd8f907f066e1d86cf83cf140fb031fb31c6f3aR71-R72:
```cpp
llvm::FailureOr<BufferLikeType> getBufferType(mlir::Type tensor, // mlir::Type here now
  const BufferizationOptions &options,
  const BufferizationState &state,
  llvm::function_ref<mlir::InFlightDiagnostic()> emitError) const {
  auto tensorType = cast<TensorType>(type);

  // ...
      
  return cast<BufferLikeType>(
    getMemRefType(tensorType, options, /*layout=*/{}, *memSpace));
}
```

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


More information about the Mlir-commits mailing list