[Mlir-commits] [mlir] [mlir][bufferization] Add tensor-like and memref-like interfaces (PR #134220)

Matthias Springer llvmlistbot at llvm.org
Mon Apr 7 01:01:36 PDT 2025


================
@@ -0,0 +1,51 @@
+//===- BufferizationTypeInterfaces.td - Bufferization type interfaces -*- tablegen -*-===//
+//
+// 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
+//
+//===---------------------------------------------------------------------------------===//
+//
+// This is the definition file for type interfaces used in Bufferization.
+//
+//===---------------------------------------------------------------------------------===//
+
+#ifndef BUFFERIZATION_TYPE_INTERFACES
+#define BUFFERIZATION_TYPE_INTERFACES
+
+include "mlir/IR/OpBase.td"
+include "mlir/IR/BuiltinTypeInterfaces.td"
+
+def Bufferization_TensorLikeTypeInterface
+    : TypeInterface<"TensorLikeType", [ShapedTypeInterface]> {
----------------
matthias-springer wrote:

Which functions require these? The main places to look at are in `BufferizableOpInterface.cpp`. There are functions such as `bufferization::getMemRefType`. These will probably have to become interface methods on `TensorTypeInterface`. Apart from that, I don't think the bufferization driver itself really needs anything from the shape type interface.

So I would recommend to go without `ShapeTypeInterface` for now. Are there any places where you'd have to insert explicit casts because of this today?


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


More information about the Mlir-commits mailing list