[Mlir-commits] [mlir] [mlir] Declare promised interfaces for all dialects [2/3] (PR #78368)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jan 29 21:00:15 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-gpu
@llvm/pr-subscribers-mlir-shape

@llvm/pr-subscribers-mlir-affine

Author: Justin Fargnoli (justinfargnoli)

<details>
<summary>Changes</summary>

This PR adds promised interface declarations for all interfaces declared in `InitAllDialects.h`.

Promised interfaces allow a dialect to declare that it will have an implementation of a particular interface, crashing the program if one isn't provided when the interface is used.

---

Patch is 23.42 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/78368.diff


13 Files Affected:

- (modified) mlir/lib/Dialect/Affine/IR/AffineOps.cpp (+4) 
- (modified) mlir/lib/Dialect/Arith/IR/ArithDialect.cpp (+14) 
- (modified) mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp (+4) 
- (modified) mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp (+7) 
- (modified) mlir/lib/Dialect/GPU/IR/GPUDialect.cpp (+3) 
- (modified) mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp (+38) 
- (modified) mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp (+22) 
- (modified) mlir/lib/Dialect/SCF/IR/SCF.cpp (+21) 
- (modified) mlir/lib/Dialect/Shape/IR/Shape.cpp (+5) 
- (modified) mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp (+21) 
- (modified) mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp (+54) 
- (modified) mlir/lib/Dialect/Tosa/IR/TosaOps.cpp (+21) 
- (modified) mlir/lib/Dialect/Vector/IR/VectorOps.cpp (+15) 


``````````diff
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index adb56ab36438b..ebf4f97218f5d 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -17,6 +17,7 @@
 #include "mlir/IR/OpDefinition.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Interfaces/ShapedOpInterfaces.h"
+#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Support/MathExtras.h"
 #include "mlir/Transforms/InliningUtils.h"
 #include "llvm/ADT/ScopeExit.h"
@@ -220,6 +221,9 @@ void AffineDialect::initialize() {
 #include "mlir/Dialect/Affine/IR/AffineOps.cpp.inc"
                 >();
   addInterfaces<AffineInlinerInterface>();
+  declarePromisedInterface<AffineApplyOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<AffineMaxOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<AffineMinOp, ValueBoundsOpInterface>();
 }
 
 /// Materialize a single constant operation from a given attribute value with
diff --git a/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp b/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
index 745c5706a838c..1ebc4588bf9ea 100644
--- a/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
+++ b/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
@@ -8,9 +8,12 @@
 
 #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h"
+#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/UB/IR/UBOps.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/DialectImplementation.h"
+#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Transforms/InliningUtils.h"
 #include "llvm/ADT/TypeSwitch.h"
 
@@ -46,6 +49,17 @@ void arith::ArithDialect::initialize() {
       >();
   addInterfaces<ArithInlinerInterface>();
   declarePromisedInterface<ArithDialect, ConvertToLLVMPatternInterface>();
+  declarePromisedInterface<SelectOp,
+                           bufferization::BufferDeallocationOpInterface>();
+  declarePromisedInterface<ConstantOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<IndexCastOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<SelectOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<AddIOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<ConstantOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<SubIOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<MulIOp, ValueBoundsOpInterface>();
 }
 
 /// Materialize an integer or floating point constant.
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
index e5a0c3c45b09e..c4d91ba72daac 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
@@ -9,6 +9,7 @@
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Interfaces/FunctionInterfaces.h"
@@ -63,6 +64,9 @@ void mlir::bufferization::BufferizationDialect::initialize() {
 #include "mlir/Dialect/Bufferization/IR/BufferizationOps.cpp.inc"
       >();
   addInterfaces<BufferizationInlinerInterface>();
+  declarePromisedInterface<func::CallOp, BufferizableOpInterface>();
+  declarePromisedInterface<func::FuncOp, BufferizableOpInterface>();
+  declarePromisedInterface<func::ReturnOp, BufferizableOpInterface>();
 }
 
 LogicalResult BufferizationDialect::verifyRegionArgAttribute(
diff --git a/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp b/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
index d242d75bd51fa..95027fc52791f 100644
--- a/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
+++ b/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
@@ -10,6 +10,8 @@
 
 #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h"
+#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/IR/AffineExpr.h"
 #include "mlir/IR/AffineMap.h"
 #include "mlir/IR/Builders.h"
@@ -69,6 +71,11 @@ void ControlFlowDialect::initialize() {
       >();
   addInterfaces<ControlFlowInlinerInterface>();
   declarePromisedInterface<ControlFlowDialect, ConvertToLLVMPatternInterface>();
+  declarePromisedInterface<BranchOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<CondBranchOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<CondBranchOp,
+                           bufferization::BufferDeallocationOpInterface>();
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index 30b6cd74147e6..530ee44eb4288 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -13,6 +13,7 @@
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 
 #include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/IR/Attributes.h"
 #include "mlir/IR/Builders.h"
@@ -215,6 +216,8 @@ void GPUDialect::initialize() {
 #include "mlir/Dialect/GPU/IR/GPUOpsAttributes.cpp.inc"
       >();
   addInterfaces<GPUInlinerInterface>();
+  declarePromisedInterface<TerminatorOp,
+                           bufferization::BufferDeallocationOpInterface>();
 }
 
 static std::string getSparseHandleKeyword(SparseHandleKind kind) {
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
index 5069d43e7db95..2a68fb6d7ec77 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
@@ -20,7 +20,10 @@
 #include "mlir/IR/BuiltinTypes.h"
 #include "mlir/IR/Dialect.h"
 #include "mlir/IR/DialectImplementation.h"
+#include "mlir/Interfaces/DestinationStyleOpInterface.h"
 #include "mlir/Interfaces/FunctionInterfaces.h"
+#include "mlir/Interfaces/SubsetOpInterface.h"
+#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Parser/Parser.h"
 #include "mlir/Support/LLVM.h"
 #include "mlir/Transforms/InliningUtils.h"
@@ -97,6 +100,27 @@ void addNamedOpBuilders(
   (addNamedOpBuilderImpl<OpTypes>(map), ...);
 }
 
+template <typename... Ops>
+struct LinalgOpInterfaceHelper {
+  static void declareOpInterface(LinalgDialect *dialect) {
+    (dialect->declarePromisedInterface<
+         Ops, bufferization::BufferizableOpInterface>(),
+     ...);
+  }
+};
+
+template <typename OpType>
+static void declareOne(LinalgDialect *dialect) {
+  dialect->declarePromisedInterface<OpType, TilingInterface>();
+  dialect->declarePromisedInterface<OpType, PartialReductionOpInterface>();
+}
+
+/// Variadic helper function.
+template <typename... OpTypes>
+static void declareAll(LinalgDialect *dialect) {
+  (declareOne<OpTypes>(), ...);
+}
+
 void mlir::linalg::LinalgDialect::initialize() {
   addAttributes<
 #define GET_ATTRDEF_LIST
@@ -118,6 +142,20 @@ void mlir::linalg::LinalgDialect::initialize() {
       >(namedStructuredOpRegionBuilders);
 
   addInterfaces<LinalgInlinerInterface>();
+
+  declarePromisedInterface<CopyOp, SubsetOpInterface>();
+  declarePromisedInterface<CopyOp, SubsetInsertionOpInterface>();
+  declarePromisedInterface<IndexOp, ValueBoundsOpInterface>();
+
+  declareOne<linalg::GenericOp>(this);
+  declareAll<
+#include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc"
+      >(this);
+
+  LinalgOpInterfaceHelper<
+#define GET_OP_LIST
+#include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc"
+      >::declareOpInterface(this);
 }
 
 LogicalResult LinalgDialect::verifyOperationAttribute(Operation *op,
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
index d71669a274b8f..47c236a267ca9 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
@@ -8,8 +8,13 @@
 
 #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
+#include "mlir/IR/BuiltinTypes.h"
+#include "mlir/Interfaces/MemorySlotInterfaces.h"
+#include "mlir/Interfaces/RuntimeVerifiableOpInterface.h"
 #include "mlir/Interfaces/SideEffectInterfaces.h"
+#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Transforms/InliningUtils.h"
 #include <optional>
 
@@ -43,6 +48,23 @@ void mlir::memref::MemRefDialect::initialize() {
       >();
   addInterfaces<MemRefInlinerInterface>();
   declarePromisedInterface<MemRefDialect, ConvertToLLVMPatternInterface>();
+  declarePromisedInterface<AllocOp, bufferization::AllocationOpInterface>();
+  declarePromisedInterface<AllocaOp, bufferization::AllocationOpInterface>();
+  declarePromisedInterface<ReallocOp, bufferization::AllocationOpInterface>();
+  declarePromisedInterface<CastOp, RuntimeVerifiableOpInterface>();
+  declarePromisedInterface<ExpandShapeOp, RuntimeVerifiableOpInterface>();
+  declarePromisedInterface<LoadOp, RuntimeVerifiableOpInterface>();
+  declarePromisedInterface<ReinterpretCastOp, RuntimeVerifiableOpInterface>();
+  declarePromisedInterface<StoreOp, RuntimeVerifiableOpInterface>();
+  declarePromisedInterface<SubViewOp, RuntimeVerifiableOpInterface>();
+  declarePromisedInterface<AllocOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<AllocaOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<CastOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<DimOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<GetGlobalOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<RankOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<SubViewOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<MemRefType, DestructurableTypeInterface>();
 }
 
 /// Finds the unique dealloc operation (if one exists) for `allocValue`.
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 9822ee522c6ed..2146a42d5469c 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -9,6 +9,8 @@
 #include "mlir/Dialect/SCF/IR/SCF.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/Arith/Utils/Utils.h"
+#include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h"
+#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/SCF/IR/DeviceMappingInterface.h"
@@ -18,6 +20,7 @@
 #include "mlir/IR/Matchers.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Interfaces/FunctionInterfaces.h"
+#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Support/MathExtras.h"
 #include "mlir/Transforms/InliningUtils.h"
 #include "llvm/ADT/MapVector.h"
@@ -71,6 +74,24 @@ void SCFDialect::initialize() {
 #include "mlir/Dialect/SCF/IR/SCFOps.cpp.inc"
       >();
   addInterfaces<SCFInlinerInterface>();
+  declarePromisedInterface<InParallelOp,
+                           bufferization::BufferDeallocationOpInterface>();
+  declarePromisedInterface<ReduceReturnOp,
+                           bufferization::BufferDeallocationOpInterface>();
+  declarePromisedInterface<ConditionOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ExecuteRegionOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ForOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<IfOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<IndexSwitchOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ForallOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<InParallelOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<WhileOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<YieldOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ForOp, ValueBoundsOpInterface>();
 }
 
 /// Default callback for IfOp builders. Inserts a yield without arguments.
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index 4f829db1305c8..c26e0d4a119af 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -11,6 +11,7 @@
 #include "mlir/Dialect/Shape/IR/Shape.h"
 
 #include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/CommonFolders.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Traits.h"
@@ -143,6 +144,10 @@ void ShapeDialect::initialize() {
   // still evolving it makes it simple to start with an unregistered ops and
   // try different variants before actually defining the op.
   allowUnknownOperations();
+  declarePromisedInterface<AssumingOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<AssumingYieldOp,
+                           bufferization::BufferizableOpInterface>();
 }
 
 Operation *ShapeDialect::materializeConstant(OpBuilder &builder,
diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
index 6033ebf6897ce..91c90c7ea46e2 100644
--- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
+++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
@@ -16,6 +16,7 @@
 #include "mlir/Dialect/SparseTensor/IR/SparseTensorType.h"
 
 #include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Utils/StaticValueUtils.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/DialectImplementation.h"
@@ -1780,6 +1781,26 @@ void SparseTensorDialect::initialize() {
 #define GET_OP_LIST
 #include "mlir/Dialect/SparseTensor/IR/SparseTensorOps.cpp.inc"
       >();
+  declarePromisedInterface<ConcatenateOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ConvertOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<LoadOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<NewOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<InsertOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<NumberOfEntriesOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<AssembleOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<DisassembleOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ToCoordinatesBufferOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ToCoordinatesOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ToPositionsOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ToValuesOp,
+                           bufferization::BufferizableOpInterface>();
 }
 
 #define GET_OP_CLASSES
diff --git a/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp b/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp
index 62032ff301bec..8c215aae62d6d 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp
@@ -8,8 +8,11 @@
 
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
+#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Complex/IR/Complex.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
+#include "mlir/Dialect/Transform/IR/TransformInterfaces.h"
+#include "mlir/Interfaces/SubsetOpInterface.h"
 #include "mlir/Transforms/InliningUtils.h"
 
 using namespace mlir;
@@ -45,4 +48,55 @@ void TensorDialect::initialize() {
 #include "mlir/Dialect/Tensor/IR/TensorOps.cpp.inc"
       >();
   addInterfaces<TensorInlinerInterface>();
+  declarePromisedInterface<CastOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<CollapseShapeOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<DimOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<EmptyOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ExpandShapeOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ExtractSliceOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ExtractOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<FromElementsOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<GenerateOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<InsertOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<InsertSliceOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<PadOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ParallelInsertSliceOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<RankOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ReshapeOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<SplatOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<CollapseShapeOp,
+                           transform::FindPayloadReplacementOpInterface>();
+  declarePromisedInterface<ExpandShapeOp,
+                           transform::FindPayloadReplacementOpInterface>();
+  declarePromisedInterface<ExtractSliceOp,
+                           transform::FindPayloadReplacementOpInterface>();
+  declarePromisedInterface<InsertSliceOp,
+                           transform::FindPayloadReplacementOpInterface>();
+  declarePromisedInterface<ReshapeOp,
+                           transform::FindPayloadReplacementOpInterface>();
+  declarePromisedInterface<ExpandShapeOp, ReifyRankedShapedTypeOpInterface>();
+  declarePromisedInterface<CollapseShapeOp, ReifyRankedShapedTypeOpInterface>();
+  declarePromisedInterface<PadOp, ReifyRankedShapedTypeOpInterface>();
+  declarePromisedInterface<ExtractSliceOp, SubsetOpInterface>();
+  declarePromisedInterface<ExtractSliceOp, SubsetExtractionOpInterface>();
+  declarePromisedInterface<InsertSliceOp, SubsetOpInterface>();
+  declarePromisedInterface<InsertSliceOp, SubsetInsertionOpInterface>();
+  declarePromisedInterface<ParallelInsertSliceOp, SubsetOpInterface>();
+  declarePromisedInterface<ParallelInsertSliceOp, SubsetInsertionOpInterface>();
+  declarePromisedInterface<PadOp, TilingInterface>();
+  declarePromisedInterface<PackOp, TilingInterface>();
+  declarePromisedInterface<UnPackOp, TilingInterface>();
+  declarePromisedInterface<CastOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<DimOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<EmptyOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<ExtractSliceOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<PadOp, ValueBoundsOpInterface>();
+  declarePromisedInterface<RankOp, ValueBoundsOpInterface>();
 }
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index 729116da45e47..4aab051bd22b3 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Mesh/Interfaces/ShardingInterface.h"
 #include "mlir/Diale...
[truncated]

``````````

</details>


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


More information about the Mlir-commits mailing list