[Mlir-commits] [mlir] [mlir][bufferization] Support custom types (1/N) (PR #142986)
Matthias Springer
llvmlistbot at llvm.org
Sun Jun 15 23:14:05 PDT 2025
================
@@ -0,0 +1,72 @@
+//===- BufferizationConversionInterface.h - Dialect Interface ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_BUFFERIZATION_IR_BUFFERIZATIONCONVERSIONINTERFACE_H_
+#define MLIR_DIALECT_BUFFERIZATION_IR_BUFFERIZATIONCONVERSIONINTERFACE_H_
+
+#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
+#include "mlir/Dialect/Bufferization/IR/BufferizationTypeInterfaces.h"
+#include "mlir/IR/DialectInterface.h"
+
+namespace mlir {
+namespace bufferization {
+
+/// This class defines a virtual interface for conversions between tensor-like
+/// and buffer-like types.
+struct ConversionDialectInterface
----------------
matthias-springer wrote:
Sorry for the late reply, I just came back from vacation.
I expected `getBufferType` etc. to be part of the type interfaces.
A dialect interface would allow you to define different type conversions for each dialect. When is that useful? One-Shot Bufferize typically bufferizes operations from multiple dialects. You could now end up with different type conversion rules for the same type within the same program.
If you want different conversion rules for builtin types, the type conversion would have to be part of the `BufferizationOptions`.
https://github.com/llvm/llvm-project/pull/142986
More information about the Mlir-commits
mailing list