[mlir] [clang] [clang-tools-extra] [llvm] [mlir] Declare promised interfaces for all dialects [2/3] (PR #78368)

Justin Fargnoli via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 27 19:53:37 PST 2024


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

>From 7edcf1ad0820457cc2c6530668dd30a758cf42f7 Mon Sep 17 00:00:00 2001
From: justinfargnoli <justinfargnoli at gmail.com>
Date: Thu, 11 Jan 2024 20:00:53 -0800
Subject: [PATCH 1/6] Declare Affine Interfaces

---
 mlir/lib/Dialect/Affine/IR/AffineOps.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index d5be2e906989fa..72ac9f30c2af54 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -8,6 +8,7 @@
 
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/IR/AffineValueMap.h"
+#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/UB/IR/UBOps.h"
 #include "mlir/IR/AffineExprVisitor.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

>From fcee97c95daea0687cbbfc2e9d40e9bec089bf21 Mon Sep 17 00:00:00 2001
From: justinfargnoli <justinfargnoli at gmail.com>
Date: Tue, 16 Jan 2024 15:58:28 -0800
Subject: [PATCH 2/6] Declare most other dialect interface implementations

---
 mlir/lib/Dialect/Arith/IR/ArithDialect.cpp    | 13 +++++
 .../Bufferization/IR/BufferizationDialect.cpp |  4 ++
 .../Dialect/ControlFlow/IR/ControlFlowOps.cpp |  7 +++
 mlir/lib/Dialect/GPU/IR/GPUDialect.cpp        |  2 +
 mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp  |  5 ++
 mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp  | 22 +++++++++
 mlir/lib/Dialect/SCF/IR/SCF.cpp               | 15 ++++++
 mlir/lib/Dialect/Shape/IR/Shape.cpp           |  3 ++
 .../SparseTensor/IR/SparseTensorDialect.cpp   | 25 ++++++++++
 mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp  | 47 +++++++++++++++++++
 mlir/lib/Dialect/Vector/IR/VectorOps.cpp      | 17 +++++++
 11 files changed, 160 insertions(+)

diff --git a/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp b/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
index ed4b91cbe516c9..fea7ab05a69418 100644
--- a/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
+++ b/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
@@ -7,7 +7,10 @@
 //===----------------------------------------------------------------------===//
 
 #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/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/IR/Builders.h"
 #include "mlir/IR/DialectImplementation.h"
 #include "mlir/Transforms/InliningUtils.h"
@@ -44,6 +47,16 @@ void arith::ArithDialect::initialize() {
 #include "mlir/Dialect/Arith/IR/ArithOpsAttributes.cpp.inc"
       >();
   addInterfaces<ArithInlinerInterface>();
+  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 e5a0c3c45b09e2..d8a38868ac862a 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
@@ -10,6 +10,7 @@
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Interfaces/FunctionInterfaces.h"
 #include "mlir/Transforms/InliningUtils.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 fab6f341699908..6bbfb37d988549 100644
--- a/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
+++ b/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
@@ -9,6 +9,8 @@
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.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"
@@ -67,6 +69,11 @@ void ControlFlowDialect::initialize() {
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.cpp.inc"
       >();
   addInterfaces<ControlFlowInlinerInterface>();
+  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 dd482f305fcbc8..36a17ae823d2ca 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,7 @@ 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 5069d43e7db95f..875fe8278fef53 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
@@ -21,6 +21,8 @@
 #include "mlir/IR/Dialect.h"
 #include "mlir/IR/DialectImplementation.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"
@@ -118,6 +120,9 @@ void mlir::linalg::LinalgDialect::initialize() {
       >(namedStructuredOpRegionBuilders);
 
   addInterfaces<LinalgInlinerInterface>();
+  declarePromisedInterface<CopyOp, SubsetOpInterface>();
+  declarePromisedInterface<CopyOp, SubsetInsertionOpInterface>();
+  declarePromisedInterface<IndexOp, ValueBoundsOpInterface>();
 }
 
 LogicalResult LinalgDialect::verifyOperationAttribute(Operation *op,
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
index 8304000bbcfd16..6f51a5625adfc4 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp
@@ -7,8 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 #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>
 
@@ -41,6 +46,23 @@ void mlir::memref::MemRefDialect::initialize() {
 #include "mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc"
       >();
   addInterfaces<MemRefInlinerInterface>();
+  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 5570c2ec688c8a..2a861754a22a3a 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -9,10 +9,13 @@
 #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"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
+#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/IR/BuiltinAttributes.h"
 #include "mlir/IR/IRMapping.h"
 #include "mlir/IR/Matchers.h"
@@ -71,6 +74,18 @@ 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 4f829db1305c85..625fd0cd5082c5 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,8 @@ 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 6033ebf6897ce0..54f62d28ce1256 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,30 @@ 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 62032ff301bece..ad7f288f6223f2 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,48 @@ 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/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
index f257728a7b947c..7f70da03d74bbd 100644
--- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -16,6 +16,7 @@
 #include "mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h"
 #include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/Arith/Utils/Utils.h"
+#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Utils/IndexingUtils.h"
@@ -31,6 +32,7 @@
 #include "mlir/IR/OpImplementation.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/IR/TypeUtilities.h"
+#include "mlir/Interfaces/SubsetOpInterface.h"
 #include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Support/LLVM.h"
 #include "mlir/Transforms/InliningUtils.h"
@@ -374,6 +376,21 @@ void VectorDialect::initialize() {
       >();
 
   addInterfaces<VectorInlinerInterface>();
+
+  declarePromisedInterface<TransferReadOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<TransferWriteOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<GatherOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<MaskOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<YieldOp, bufferization::BufferizableOpInterface>();
+
+  declarePromisedInterface<TransferReadOp, SubsetOpInterface>();
+  declarePromisedInterface<TransferReadOp, SubsetExtractionOpInterface>();
+  declarePromisedInterface<TransferWriteOp, SubsetOpInterface>();
+  declarePromisedInterface<TransferWriteOp, SubsetInsertionOpInterface>();
 }
 
 /// Materialize a single constant operation from a given attribute value with

>From 794749558f133034d34c176aa84ad0e03100fe6a Mon Sep 17 00:00:00 2001
From: justinfargnoli <justinfargnoli at gmail.com>
Date: Tue, 16 Jan 2024 16:23:49 -0800
Subject: [PATCH 3/6] clang-format changes

---
 mlir/lib/Dialect/Arith/IR/ArithDialect.cpp    |  5 +++--
 .../Bufferization/IR/BufferizationDialect.cpp |  2 +-
 mlir/lib/Dialect/GPU/IR/GPUDialect.cpp        |  3 ++-
 mlir/lib/Dialect/SCF/IR/SCF.cpp               | 20 +++++++++++-------
 mlir/lib/Dialect/Shape/IR/Shape.cpp           |  6 ++++--
 .../SparseTensor/IR/SparseTensorDialect.cpp   | 12 ++++-------
 mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp  | 21 ++++++++++++-------
 mlir/lib/Dialect/Vector/IR/VectorOps.cpp      |  6 ++----
 8 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp b/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
index fea7ab05a69418..d721ffa977a5c9 100644
--- a/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
+++ b/mlir/lib/Dialect/Arith/IR/ArithDialect.cpp
@@ -10,9 +10,9 @@
 #include "mlir/Dialect/Bufferization/IR/BufferDeallocationOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/UB/IR/UBOps.h"
-#include "mlir/Interfaces/ValueBoundsOpInterface.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"
 
@@ -47,7 +47,8 @@ void arith::ArithDialect::initialize() {
 #include "mlir/Dialect/Arith/IR/ArithOpsAttributes.cpp.inc"
       >();
   addInterfaces<ArithInlinerInterface>();
-  declarePromisedInterface<SelectOp, bufferization::BufferDeallocationOpInterface>();
+  declarePromisedInterface<SelectOp,
+                           bufferization::BufferDeallocationOpInterface>();
   declarePromisedInterface<ConstantOp,
                            bufferization::BufferizableOpInterface>();
   declarePromisedInterface<IndexCastOp,
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
index d8a38868ac862a..c4d91ba72daac4 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationDialect.cpp
@@ -9,8 +9,8 @@
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
 #include "mlir/Dialect/Bufferization/IR/Bufferization.h"
-#include "mlir/Dialect/MemRef/IR/MemRef.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"
 #include "mlir/Transforms/InliningUtils.h"
diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index 36a17ae823d2ca..eb7613b07ef4d4 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -216,7 +216,8 @@ void GPUDialect::initialize() {
 #include "mlir/Dialect/GPU/IR/GPUOpsAttributes.cpp.inc"
       >();
   addInterfaces<GPUInlinerInterface>();
-  declarePromisedInterface<TerminatorOp, bufferization::BufferDeallocationOpInterface>();
+  declarePromisedInterface<TerminatorOp,
+                           bufferization::BufferDeallocationOpInterface>();
 }
 
 static std::string getSparseHandleKeyword(SparseHandleKind kind) {
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 2a861754a22a3a..dd35509d17f050 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -15,12 +15,12 @@
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/SCF/IR/DeviceMappingInterface.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
-#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/IR/BuiltinAttributes.h"
 #include "mlir/IR/IRMapping.h"
 #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"
@@ -74,15 +74,21 @@ 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<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<IndexSwitchOp,
+                           bufferization::BufferizableOpInterface>();
   declarePromisedInterface<ForallOp, bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<InParallelOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<InParallelOp,
+                           bufferization::BufferizableOpInterface>();
   declarePromisedInterface<WhileOp, bufferization::BufferizableOpInterface>();
   declarePromisedInterface<YieldOp, bufferization::BufferizableOpInterface>();
   declarePromisedInterface<ForOp, ValueBoundsOpInterface>();
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index 625fd0cd5082c5..c26e0d4a119af9 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -144,8 +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>();
+  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 54f62d28ce1256..91c90c7ea46e27 100644
--- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
+++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
@@ -1783,14 +1783,10 @@ void SparseTensorDialect::initialize() {
       >();
   declarePromisedInterface<ConcatenateOp,
                            bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<ConvertOp,
-                           bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<LoadOp,
-                           bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<NewOp,
-                           bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<InsertOp,
-                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ConvertOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<LoadOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<NewOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<InsertOp, bufferization::BufferizableOpInterface>();
   declarePromisedInterface<NumberOfEntriesOp,
                            bufferization::BufferizableOpInterface>();
   declarePromisedInterface<AssembleOp,
diff --git a/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp b/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp
index ad7f288f6223f2..8c215aae62d6d2 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp
@@ -49,18 +49,25 @@ void TensorDialect::initialize() {
       >();
   addInterfaces<TensorInlinerInterface>();
   declarePromisedInterface<CastOp, bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<CollapseShapeOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<CollapseShapeOp,
+                           bufferization::BufferizableOpInterface>();
   declarePromisedInterface<DimOp, bufferization::BufferizableOpInterface>();
   declarePromisedInterface<EmptyOp, bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<ExpandShapeOp, bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<ExtractSliceOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ExpandShapeOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ExtractSliceOp,
+                           bufferization::BufferizableOpInterface>();
   declarePromisedInterface<ExtractOp, bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<FromElementsOp, bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<GenerateOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<FromElementsOp,
+                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<GenerateOp,
+                           bufferization::BufferizableOpInterface>();
   declarePromisedInterface<InsertOp, bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<InsertSliceOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<InsertSliceOp,
+                           bufferization::BufferizableOpInterface>();
   declarePromisedInterface<PadOp, bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<ParallelInsertSliceOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<ParallelInsertSliceOp,
+                           bufferization::BufferizableOpInterface>();
   declarePromisedInterface<RankOp, bufferization::BufferizableOpInterface>();
   declarePromisedInterface<ReshapeOp, bufferization::BufferizableOpInterface>();
   declarePromisedInterface<SplatOp, bufferization::BufferizableOpInterface>();
diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
index 7f70da03d74bbd..ad6e9709f2fdb9 100644
--- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -381,10 +381,8 @@ void VectorDialect::initialize() {
                            bufferization::BufferizableOpInterface>();
   declarePromisedInterface<TransferWriteOp,
                            bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<GatherOp,
-                           bufferization::BufferizableOpInterface>();
-  declarePromisedInterface<MaskOp,
-                           bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<GatherOp, bufferization::BufferizableOpInterface>();
+  declarePromisedInterface<MaskOp, bufferization::BufferizableOpInterface>();
   declarePromisedInterface<YieldOp, bufferization::BufferizableOpInterface>();
 
   declarePromisedInterface<TransferReadOp, SubsetOpInterface>();

>From f6a94903b6d217b2abb48251d713984927109c9c Mon Sep 17 00:00:00 2001
From: justinfargnoli <justinfargnoli at gmail.com>
Date: Tue, 16 Jan 2024 16:29:04 -0800
Subject: [PATCH 4/6] clang-format changes

---
 mlir/lib/Dialect/Affine/IR/AffineOps.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 72ac9f30c2af54..84dc3b4dd69772 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -8,7 +8,6 @@
 
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/IR/AffineValueMap.h"
-#include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
 #include "mlir/Dialect/UB/IR/UBOps.h"
 #include "mlir/IR/AffineExprVisitor.h"
@@ -18,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"

>From 3b668755e29cd3a3e09e899397e28ad77816ffbc Mon Sep 17 00:00:00 2001
From: justinfargnoli <justinfargnoli at gmail.com>
Date: Sat, 27 Jan 2024 18:32:40 -0800
Subject: [PATCH 5/6] Declare multiple interfaces at once for Linalg and Tosa

---
 mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp | 31 ++++++++++++++++++++
 mlir/lib/Dialect/Tosa/IR/TosaOps.cpp         | 20 +++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
index 875fe8278fef53..7ca8c1eb4b2a3e 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
@@ -20,6 +20,7 @@
 #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"
@@ -99,6 +100,25 @@ 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
@@ -120,9 +140,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/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index 661126f4df9976..33ce55dea8e4ab 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -12,6 +12,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "mlir/Dialect/Mesh/Interfaces/ShardingInterface.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
 #include "mlir/Dialect/Quant/QuantOps.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
@@ -125,6 +126,17 @@ SmallVector<Region *> tosa::WhileOp::getLoopRegions() { return {&getBody()}; }
 // Tosa dialect initialization.
 //===----------------------------------------------------------------------===//
 
+template <typename OpType>
+static void declareElemwiseOne(TosaDialect *dialect) {
+  dialect->declarePromisedInterface<OpType, mesh::ShardingInterface>();
+}
+
+/// Variadic helper function.
+template <typename... OpTypes>
+static void declareElemwiseAll(TosaDialect *dialect) {
+  (declareElemwiseOne<OpTypes>(dialect), ...);
+}
+
 void TosaDialect::initialize() {
   addOperations<
 #define GET_OP_LIST
@@ -135,6 +147,14 @@ void TosaDialect::initialize() {
 #include "mlir/Dialect/Tosa/IR/TosaAttributes.cpp.inc"
       >();
   addInterfaces<TosaDialectBytecodeInterface, TosaInlinerInterface>();
+  declareElemwiseAll<ClampOp, SigmoidOp, TanhOp, AddOp, ArithmeticRightShiftOp,
+                     BitwiseAndOp, BitwiseOrOp, BitwiseXorOp, DivOp,
+                     LogicalAndOp, LogicalLeftShiftOp, LogicalRightShiftOp,
+                     LogicalOrOp, LogicalXorOp, MaximumOp, MinimumOp, MulOp,
+                     PowOp, SubOp, AbsOp, BitwiseNotOp, CeilOp, ClzOp, ExpOp,
+                     FloorOp, LogOp, LogicalNotOp, NegateOp, ReciprocalOp,
+                     RsqrtOp, SelectOp, EqualOp, GreaterOp, GreaterEqualOp>(this);
+  declarePromisedInterface<MatMulOp, mesh::ShardingInterface>();
 }
 
 Operation *TosaDialect::materializeConstant(OpBuilder &builder, Attribute value,

>From 430c787d4702651853c58f66bb3c450a21ec6523 Mon Sep 17 00:00:00 2001
From: justinfargnoli <justinfargnoli at gmail.com>
Date: Sat, 27 Jan 2024 19:53:23 -0800
Subject: [PATCH 6/6] clang-format changes

---
 mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp | 6 ++++--
 mlir/lib/Dialect/Tosa/IR/TosaOps.cpp         | 5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
index 7ca8c1eb4b2a3e..2a68fb6d7ec77f 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
@@ -103,7 +103,9 @@ void addNamedOpBuilders(
 template <typename... Ops>
 struct LinalgOpInterfaceHelper {
   static void declareOpInterface(LinalgDialect *dialect) {
-    (dialect->declarePromisedInterface<Ops, bufferization::BufferizableOpInterface>(), ...);
+    (dialect->declarePromisedInterface<
+         Ops, bufferization::BufferizableOpInterface>(),
+     ...);
   }
 };
 
@@ -153,7 +155,7 @@ void mlir::linalg::LinalgDialect::initialize() {
   LinalgOpInterfaceHelper<
 #define GET_OP_LIST
 #include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc"
-        >::declareOpInterface(this);
+      >::declareOpInterface(this);
 }
 
 LogicalResult LinalgDialect::verifyOperationAttribute(Operation *op,
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index 33ce55dea8e4ab..64a1c30c630f8d 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Dialect/Mesh/Interfaces/ShardingInterface.h"
 #include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Mesh/Interfaces/ShardingInterface.h"
 #include "mlir/Dialect/Quant/QuantOps.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
@@ -153,7 +153,8 @@ void TosaDialect::initialize() {
                      LogicalOrOp, LogicalXorOp, MaximumOp, MinimumOp, MulOp,
                      PowOp, SubOp, AbsOp, BitwiseNotOp, CeilOp, ClzOp, ExpOp,
                      FloorOp, LogOp, LogicalNotOp, NegateOp, ReciprocalOp,
-                     RsqrtOp, SelectOp, EqualOp, GreaterOp, GreaterEqualOp>(this);
+                     RsqrtOp, SelectOp, EqualOp, GreaterOp, GreaterEqualOp>(
+      this);
   declarePromisedInterface<MatMulOp, mesh::ShardingInterface>();
 }
 



More information about the cfe-commits mailing list