[Mlir-commits] [mlir] [mlir][shard, bufferization] Adding sharding extensions for bufferization ops (PR #177378)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Jan 22 07:25:57 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h mlir/include/mlir/Dialect/Bufferization/Extensions/ShardingExtensions.h mlir/lib/Dialect/Bufferization/Extensions/AllExtensions.cpp mlir/lib/Dialect/Bufferization/Extensions/ShardingExtensions.cpp mlir/lib/RegisterAllExtensions.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h b/mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h
index 2552a5ecd..b55a973be 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Extensions/AllExtensions.h
@@ -1,4 +1,5 @@
-//===- AllExtensions.h - All bufferization Extensions ------------------*- C++ -*-===//
+//===- AllExtensions.h - All bufferization Extensions ------------------*- C++
+//-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -18,10 +19,10 @@ namespace mlir {
 class DialectRegistry;
 
 namespace bufferization {
-/// Register all extensions of the bufferization dialect. This should generally only be
-/// used by tools, or other use cases that really do want *all* extensions of
-/// the dialect. All other cases should prefer to instead register the specific
-/// extensions they intend to take advantage of.
+/// Register all extensions of the bufferization dialect. This should generally
+/// only be used by tools, or other use cases that really do want *all*
+/// extensions of the dialect. All other cases should prefer to instead register
+/// the specific extensions they intend to take advantage of.
 void registerAllExtensions(DialectRegistry &registry);
 } // namespace bufferization
 
diff --git a/mlir/lib/Dialect/Bufferization/Extensions/ShardingExtensions.cpp b/mlir/lib/Dialect/Bufferization/Extensions/ShardingExtensions.cpp
index e8a430569..41812e7a5 100644
--- a/mlir/lib/Dialect/Bufferization/Extensions/ShardingExtensions.cpp
+++ b/mlir/lib/Dialect/Bufferization/Extensions/ShardingExtensions.cpp
@@ -7,26 +7,27 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/Bufferization/Extensions/ShardingExtensions.h"
+#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 #include "mlir/Dialect/Shard/Interfaces/ShardingInterfaceImpl.h"
 #include "mlir/IR/DialectRegistry.h"
-#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
 
 using namespace mlir;
 
 /// Variadic helper function.
 template <typename... OpTypes>
 static void registerAll(MLIRContext *ctx) {
-  (OpTypes::template attachInterface<shard::IndependentParallelIteratorDomainShardingInterface<OpTypes>>(*ctx), ...);
+  (OpTypes::template attachInterface<
+       shard::IndependentParallelIteratorDomainShardingInterface<OpTypes>>(
+       *ctx),
+   ...);
 }
 
 void mlir::bufferization::shard_ext::registerShardingInterfaceExternalModels(
     DialectRegistry &registry) {
 
-  registry.addExtension(+[](MLIRContext *ctx, bufferization::BufferizationDialect *dialect) {
-        registerAll<
-          bufferization::AllocTensorOp,
-          bufferization::DeallocTensorOp,
-          bufferization::MaterializeInDestinationOp
-        >(ctx);
+  registry.addExtension(+[](MLIRContext *ctx,
+                            bufferization::BufferizationDialect *dialect) {
+    registerAll<bufferization::AllocTensorOp, bufferization::DeallocTensorOp,
+                bufferization::MaterializeInDestinationOp>(ctx);
   });
 }
diff --git a/mlir/lib/RegisterAllExtensions.cpp b/mlir/lib/RegisterAllExtensions.cpp
index f8a22403c..d5693db23 100644
--- a/mlir/lib/RegisterAllExtensions.cpp
+++ b/mlir/lib/RegisterAllExtensions.cpp
@@ -37,8 +37,8 @@
 #include "mlir/Dialect/Affine/TransformOps/AffineTransformOps.h"
 #include "mlir/Dialect/ArmNeon/TransformOps/ArmNeonVectorTransformOps.h"
 #include "mlir/Dialect/ArmSVE/TransformOps/ArmSVEVectorTransformOps.h"
-#include "mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h"
 #include "mlir/Dialect/Bufferization/Extensions/AllExtensions.h"
+#include "mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.h"
 #include "mlir/Dialect/DLTI/TransformOps/DLTITransformOps.h"
 #include "mlir/Dialect/Func/Extensions/AllExtensions.h"
 #include "mlir/Dialect/Func/TransformOps/FuncTransformOps.h"

``````````

</details>


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


More information about the Mlir-commits mailing list