[Mlir-commits] [mlir] [mlir][Affine] affine-super-vectorize transform op (PR #177755)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Jan 24 04:02:44 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/Affine/Utils.h mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp mlir/lib/Dialect/Affine/Transforms/SuperVectorize.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/Affine/Utils.h b/mlir/include/mlir/Dialect/Affine/Utils.h
index 50a240d2e..d44d13894 100644
--- a/mlir/include/mlir/Dialect/Affine/Utils.h
+++ b/mlir/include/mlir/Dialect/Affine/Utils.h
@@ -104,10 +104,9 @@ struct VectorizationStrategy {
 };
 
 /// Vectorize affine loops that are children of parentOp (including itself)
-void vectorizeChildAffineLoops(Operation* parentOp,
-                                bool vectorizeReductions,
-                                ArrayRef<int64_t> vectorSizes,
-                                ArrayRef<int64_t> fastestVaryingPattern);
+void vectorizeChildAffineLoops(Operation *parentOp, bool vectorizeReductions,
+                               ArrayRef<int64_t> vectorSizes,
+                               ArrayRef<int64_t> fastestVaryingPattern);
 
 /// Replace affine store and load accesses by scalars by forwarding stores to
 /// loads and eliminate invariant affine loads; consequently, eliminate dead
diff --git a/mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp b/mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp
index c2420b838..a4918f13c 100644
--- a/mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp
+++ b/mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp
@@ -154,23 +154,21 @@ void SimplifyBoundedAffineOpsOp::getEffects(
 
 DiagnosedSilenceableFailure
 SuperVectorizeOp::apply(transform::TransformRewriter &rewriter,
-                        TransformResults &results,
-                        TransformState &state) {
+                        TransformResults &results, TransformState &state) {
   ArrayRef<int64_t> fastestVaryingPattern;
   if (getFastestVaryingPattern().has_value()) {
     if (getFastestVaryingPattern()->size() != getVectorSizes().size())
-      return emitSilenceableFailure(getLoc(), 
-                "Fastest varying pattern specified with different size than "
-                "the vector size.");
+      return emitSilenceableFailure(
+          getLoc(),
+          "Fastest varying pattern specified with different size than "
+          "the vector size.");
     fastestVaryingPattern = getFastestVaryingPattern().value();
   }
-  
-  for (Operation* target : state.getPayloadOps(getTarget()))
+
+  for (Operation *target : state.getPayloadOps(getTarget()))
     if (!target->getParentOfType<affine::AffineForOp>())
-      vectorizeChildAffineLoops(target, 
-                                getVectorizeReductions(), 
-                                getVectorSizes(), 
-                                fastestVaryingPattern);
+      vectorizeChildAffineLoops(target, getVectorizeReductions(),
+                                getVectorSizes(), fastestVaryingPattern);
 
   return DiagnosedSilenceableFailure::success();
 }
diff --git a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
index ce19df704..2e9611453 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
@@ -1775,10 +1775,9 @@ static void vectorizeLoops(Operation *parentOp, DenseSet<Operation *> &loops,
   LLVM_DEBUG(dbgs() << "\n");
 }
 
-void affine::vectorizeChildAffineLoops(Operation* parentOp,
-                                      bool vectorizeReductions,
-                                      ArrayRef<int64_t> vectorSizes,
-                                      ArrayRef<int64_t> fastestVaryingPattern) {
+void affine::vectorizeChildAffineLoops(
+    Operation *parentOp, bool vectorizeReductions,
+    ArrayRef<int64_t> vectorSizes, ArrayRef<int64_t> fastestVaryingPattern) {
   DenseSet<Operation *> parallelLoops;
   ReductionLoopMap reductionLoops;
 
@@ -1828,7 +1827,8 @@ void Vectorize::runOnOperation() {
     return signalPassFailure();
   }
 
-  vectorizeChildAffineLoops(f, vectorizeReductions, vectorSizes, fastestVaryingPattern);
+  vectorizeChildAffineLoops(f, vectorizeReductions, vectorSizes,
+                            fastestVaryingPattern);
 }
 
 /// Verify that affine loops in 'loops' meet the nesting criteria expected by

``````````

</details>


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


More information about the Mlir-commits mailing list