[Mlir-commits] [mlir] Users/jianhui li/xe gpu/generic softmax matmul fusion (PR #204961)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Jun 20 22:31:29 PDT 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/lib/Dialect/Linalg/Transforms/SoftmaxMatmulFusion.cpp mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h mlir/include/mlir/Dialect/Tensor/IR/TensorTilingInterfaceImpl.h mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.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/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index cec9db46d..3ff9dbbfc 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -2102,7 +2102,7 @@ void populateTransposeMatmulPatterns(RewritePatternSet &patterns,
 /// Patterns to rewrite softmax -> matmul into online softmax form:
 /// local_softmax + rescaling matmul (linalg.generic).
 void populateSoftmaxMatmulFusionPatterns(RewritePatternSet &patterns,
-                                   int64_t tileSize = 32);
+                                         int64_t tileSize = 32);
 
 /// Patterns to block pack Linalg matmul ops.
 void populateBlockPackMatmulPatterns(RewritePatternSet &patterns,
diff --git a/mlir/lib/Dialect/Linalg/Transforms/SoftmaxMatmulFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/SoftmaxMatmulFusion.cpp
index 073e1186a..95950c536 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/SoftmaxMatmulFusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/SoftmaxMatmulFusion.cpp
@@ -1,4 +1,5 @@
-//===- SoftmaxMatmulFusion.cpp - Rewrite softmax+matmul to online softmax -------===//
+//===- SoftmaxMatmulFusion.cpp - Rewrite softmax+matmul to online softmax
+//-------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -29,7 +30,8 @@ namespace {
 
 /// Find a matmul/batch_matmul user of the softmax result where:
 /// - The softmax result is the LHS (input 0) of the matmul
-/// - The softmax dimension matches the matmul contraction dimension (last dim of LHS)
+/// - The softmax dimension matches the matmul contraction dimension (last dim
+/// of LHS)
 static Operation *findMatchingMatmulUser(linalg::SoftmaxOp softmaxOp) {
   Value softmaxResult = softmaxOp.getResult()[0];
   int64_t softmaxDim = softmaxOp.getDimension();
@@ -75,12 +77,12 @@ static Operation *findMatchingMatmulUser(linalg::SoftmaxOp softmaxOp) {
 /// Per tile (reduce over tn):
 ///   M_new = max(M_acc, m_local)
 ///   alpha = exp(M_acc - M_new)         // rescale prior running state
-///   beta  = exp(m_local - M_new)       // rebase this tile: local -> running max
-///   O_new = O_acc * alpha + beta * pv
-///   L_new = L_acc * alpha + beta * lsum
+///   beta  = exp(m_local - M_new)       // rebase this tile: local -> running
+///   max O_new = O_acc * alpha + beta * pv L_new = L_acc * alpha + beta * lsum
 ///
 /// Args layout: [pv_val, m_tile, lsum_tile, O_acc, M_acc, L_acc]
-static void buildRescaleReduceBody(OpBuilder &b, Location loc, ValueRange args) {
+static void buildRescaleReduceBody(OpBuilder &b, Location loc,
+                                   ValueRange args) {
   Value pv_val = args[0], m_tile = args[1], lsum_tile = args[2];
   Value O_acc = args[3], M_acc = args[4], L_acc = args[5];
 
@@ -110,8 +112,7 @@ static void buildRescaleReduceBody(OpBuilder &b, Location loc, ValueRange args)
 static Value createFilledTensor(OpBuilder &b, Location loc,
                                 ArrayRef<int64_t> shape, Type elementType,
                                 Value fillValue) {
-  Value empty =
-      tensor::EmptyOp::create(b, loc, shape, elementType).getResult();
+  Value empty = tensor::EmptyOp::create(b, loc, shape, elementType).getResult();
   return linalg::FillOp::create(b, loc, fillValue, empty).getResult(0);
 }
 
@@ -149,8 +150,7 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
 
     // Require static shape and divisibility.
     if (ShapedType::isDynamic(N))
-      return rewriter.notifyMatchFailure(softmaxOp,
-                                         "softmax dim is dynamic");
+      return rewriter.notifyMatchFailure(softmaxOp, "softmax dim is dynamic");
     if (N % tileSize != 0)
       return rewriter.notifyMatchFailure(
           softmaxOp, "softmax dim not divisible by tile size");
@@ -231,7 +231,7 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
 
     // Iterator types: all parallel except last (ts) which varies
     SmallVector<utils::IteratorType> allParallel(numLocalDims,
-                                                  utils::IteratorType::parallel);
+                                                 utils::IteratorType::parallel);
     SmallVector<utils::IteratorType> lastReduction(allParallel);
     lastReduction.back() = utils::IteratorType::reduction;
 
@@ -249,33 +249,33 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
     Value negInfScalar = arith::ConstantOp::create(
         rewriter, loc,
         rewriter.getFloatAttr(
-            elemType, APFloat::getInf(
-                          cast<FloatType>(elemType).getFloatSemantics(), true)));
-    Value m_init = createFilledTensor(rewriter, loc, mlShape, elemType, negInfScalar);
+            elemType,
+            APFloat::getInf(cast<FloatType>(elemType).getFloatSemantics(),
+                            true)));
+    Value m_init =
+        createFilledTensor(rewriter, loc, mlShape, elemType, negInfScalar);
 
     auto maxGeneric = linalg::GenericOp::create(
-        rewriter, loc,
-        TypeRange{RankedTensorType::get(mlShape, elemType)},
+        rewriter, loc, TypeRange{RankedTensorType::get(mlShape, elemType)},
         /*inputs=*/ValueRange{S_tiled},
         /*outputs=*/ValueRange{m_init},
-        SmallVector<AffineMap>{fullMap, reducedMap},
-        lastReduction,
+        SmallVector<AffineMap>{fullMap, reducedMap}, lastReduction,
         [&](OpBuilder &b, Location nestedLoc, ValueRange args) {
-          Value result = arith::MaxNumFOp::create(b, nestedLoc, args[0], args[1]);
+          Value result =
+              arith::MaxNumFOp::create(b, nestedLoc, args[0], args[1]);
           linalg::YieldOp::create(b, nestedLoc, result);
         });
     Value m = maxGeneric.getResult(0);
 
     // (c) Compute num = exp(S_tiled - m): elementwise
-    Value num_init = tensor::EmptyOp::create(rewriter, loc, expandedSShape, elemType)
-                         .getResult();
+    Value num_init =
+        tensor::EmptyOp::create(rewriter, loc, expandedSShape, elemType)
+            .getResult();
     auto expGeneric = linalg::GenericOp::create(
-        rewriter, loc,
-        TypeRange{expandedSType},
+        rewriter, loc, TypeRange{expandedSType},
         /*inputs=*/ValueRange{S_tiled, m},
         /*outputs=*/ValueRange{num_init},
-        SmallVector<AffineMap>{fullMap, reducedMap, fullMap},
-        allParallel,
+        SmallVector<AffineMap>{fullMap, reducedMap, fullMap}, allParallel,
         [&](OpBuilder &b, Location nestedLoc, ValueRange args) {
           Value diff = arith::SubFOp::create(b, nestedLoc, args[0], args[1]);
           Value result = math::ExpOp::create(b, nestedLoc, diff);
@@ -286,15 +286,14 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
     // (d) Compute per-tile sum: l[..., M, tn] = sum over ts
     Value zeroScalar = arith::ConstantOp::create(
         rewriter, loc, rewriter.getFloatAttr(elemType, 0.0));
-    Value l_init = createFilledTensor(rewriter, loc, mlShape, elemType, zeroScalar);
+    Value l_init =
+        createFilledTensor(rewriter, loc, mlShape, elemType, zeroScalar);
 
     auto sumGeneric = linalg::GenericOp::create(
-        rewriter, loc,
-        TypeRange{RankedTensorType::get(mlShape, elemType)},
+        rewriter, loc, TypeRange{RankedTensorType::get(mlShape, elemType)},
         /*inputs=*/ValueRange{num},
         /*outputs=*/ValueRange{l_init},
-        SmallVector<AffineMap>{fullMap, reducedMap},
-        lastReduction,
+        SmallVector<AffineMap>{fullMap, reducedMap}, lastReduction,
         [&](OpBuilder &b, Location nestedLoc, ValueRange args) {
           Value result = arith::AddFOp::create(b, nestedLoc, args[0], args[1]);
           linalg::YieldOp::create(b, nestedLoc, result);
@@ -317,18 +316,19 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
     // Split the N dim into [tn, ts].
     expandedVShape.push_back(tn);
     expandedVShape.push_back(ts);
-    vReassoc.push_back({static_cast<int>(inputRank - 2),
-                        static_cast<int>(inputRank - 1)});
+    vReassoc.push_back(
+        {static_cast<int>(inputRank - 2), static_cast<int>(inputRank - 1)});
     // Keep Kv.
     expandedVShape.push_back(Kv);
     vReassoc.push_back({static_cast<int>(inputRank)});
 
     auto expandedVType = RankedTensorType::get(expandedVShape, elemType);
-    Value V_tiled =
-        tensor::ExpandShapeOp::create(rewriter, loc, expandedVType, V, vReassoc);
+    Value V_tiled = tensor::ExpandShapeOp::create(rewriter, loc, expandedVType,
+                                                  V, vReassoc);
 
     // (g) Create init tensors for rescaling matmul:
-    //     O: [...batch, M, Kv], M_run: [...batch, M, Kv], L_run: [...batch, M, Kv]
+    //     O: [...batch, M, Kv], M_run: [...batch, M, Kv], L_run: [...batch, M,
+    //     Kv]
     Value O_init =
         createFilledTensor(rewriter, loc, oShape, elemType, zeroScalar);
     Value M_init =
@@ -378,7 +378,8 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
     SmallVector<utils::IteratorType> mmIters(numMmDims,
                                              utils::IteratorType::parallel);
     mmIters[mm_ts] = utils::IteratorType::reduction;
-    Value pvInit = createFilledTensor(rewriter, loc, pvShape, elemType, zeroScalar);
+    Value pvInit =
+        createFilledTensor(rewriter, loc, pvShape, elemType, zeroScalar);
     auto pvOp = linalg::GenericOp::create(
         rewriter, loc, TypeRange{pvType}, ValueRange{num, V_tiled},
         ValueRange{pvInit},
@@ -430,11 +431,13 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
       recDims.push_back(rewriter.getAffineDimExpr(i));
     int64_t rec_tn = nBatchAndM, rec_kv = nBatchAndM + 1;
     // pv: (batch..., m, tn, kv)
-    SmallVector<AffineExpr> recPv(recDims.begin(), recDims.begin() + nBatchAndM);
+    SmallVector<AffineExpr> recPv(recDims.begin(),
+                                  recDims.begin() + nBatchAndM);
     recPv.push_back(recDims[rec_tn]);
     recPv.push_back(recDims[rec_kv]);
     // m/lsum: (batch..., m, tn)
-    SmallVector<AffineExpr> recMl(recDims.begin(), recDims.begin() + nBatchAndM);
+    SmallVector<AffineExpr> recMl(recDims.begin(),
+                                  recDims.begin() + nBatchAndM);
     recMl.push_back(recDims[rec_tn]);
     // O/M/L: (batch..., m, kv)
     SmallVector<AffineExpr> recO(recDims.begin(), recDims.begin() + nBatchAndM);
@@ -492,14 +495,17 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
     }
 
     if (hasOtherUsers) {
-      // Recover global softmax from (P, m, l) using two generics + collapse_shape:
+      // Recover global softmax from (P, m, l) using two generics +
+      // collapse_shape:
       //
-      // Generic 1: Reduce (m, l) over tn to get M_global[..., M] and L_global[..., M]
+      // Generic 1: Reduce (m, l) over tn to get M_global[..., M] and
+      // L_global[..., M]
       //   M_global = max over all tn of m[..., tn]
       //   L_global = sum over all tn of l[..., tn] * exp(m[..., tn] - M_global)
       //
       // Generic 2: Elementwise correction of P
-      //   corrected_P[..., tn, ts] = P[..., tn, ts] * l[..., tn] * exp(m[..., tn] - M_global) / L_global
+      //   corrected_P[..., tn, ts] = P[..., tn, ts] * l[..., tn] * exp(m[...,
+      //   tn] - M_global) / L_global
       //
       // collapse_shape: [..., tn, ts] -> [..., N]
 
@@ -515,48 +521,58 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
         reduceDims.push_back(rewriter.getAffineDimExpr(i));
 
       // Input map (m, l): identity over all dims [..., M, tn]
-      AffineMap reduceFullMap = AffineMap::get(numReduceDims, 0, reduceDims, ctx);
+      AffineMap reduceFullMap =
+          AffineMap::get(numReduceDims, 0, reduceDims, ctx);
       // Output map (M_global, L_global): drop last dim (tn)
-      SmallVector<AffineExpr> reduceOutExprs(reduceDims.begin(), reduceDims.end() - 1);
-      AffineMap reduceOutMap = AffineMap::get(numReduceDims, 0, reduceOutExprs, ctx);
+      SmallVector<AffineExpr> reduceOutExprs(reduceDims.begin(),
+                                             reduceDims.end() - 1);
+      AffineMap reduceOutMap =
+          AffineMap::get(numReduceDims, 0, reduceOutExprs, ctx);
 
-      SmallVector<utils::IteratorType> reduceIters(numReduceDims,
-                                                    utils::IteratorType::parallel);
+      SmallVector<utils::IteratorType> reduceIters(
+          numReduceDims, utils::IteratorType::parallel);
       reduceIters.back() = utils::IteratorType::reduction;
 
-      Value Mg_init = createFilledTensor(rewriter, loc, mGlobalShape, elemType, negInfScalar);
-      Value Lg_init = createFilledTensor(rewriter, loc, mGlobalShape, elemType, zeroScalar);
+      Value Mg_init = createFilledTensor(rewriter, loc, mGlobalShape, elemType,
+                                         negInfScalar);
+      Value Lg_init =
+          createFilledTensor(rewriter, loc, mGlobalShape, elemType, zeroScalar);
 
       auto globalReduceOp = linalg::GenericOp::create(
-          rewriter, loc,
-          TypeRange{mGlobalType, mGlobalType},
+          rewriter, loc, TypeRange{mGlobalType, mGlobalType},
           /*inputs=*/ValueRange{m, l},
           /*outputs=*/ValueRange{Mg_init, Lg_init},
-          SmallVector<AffineMap>{reduceFullMap, reduceFullMap, reduceOutMap, reduceOutMap},
-          reduceIters,
-          [&](OpBuilder &b, Location nestedLoc, ValueRange args) {
-            Value m_i = args[0], l_i = args[1], Mg_acc = args[2], Lg_acc = args[3];
+          SmallVector<AffineMap>{reduceFullMap, reduceFullMap, reduceOutMap,
+                                 reduceOutMap},
+          reduceIters, [&](OpBuilder &b, Location nestedLoc, ValueRange args) {
+            Value m_i = args[0], l_i = args[1], Mg_acc = args[2],
+                  Lg_acc = args[3];
             // M_new = max(Mg_acc, m_i)
             Value Mg_new = arith::MaxNumFOp::create(b, nestedLoc, Mg_acc, m_i);
             // L_new = Lg_acc * exp(Mg_acc - Mg_new) + l_i * exp(m_i - Mg_new)
             Value diff1 = arith::SubFOp::create(b, nestedLoc, Mg_acc, Mg_new);
             Value corr = math::ExpOp::create(b, nestedLoc, diff1);
-            Value Lg_rescaled = arith::MulFOp::create(b, nestedLoc, Lg_acc, corr);
+            Value Lg_rescaled =
+                arith::MulFOp::create(b, nestedLoc, Lg_acc, corr);
             Value diff2 = arith::SubFOp::create(b, nestedLoc, m_i, Mg_new);
             Value exp2 = math::ExpOp::create(b, nestedLoc, diff2);
             Value contrib = arith::MulFOp::create(b, nestedLoc, l_i, exp2);
-            Value Lg_new = arith::AddFOp::create(b, nestedLoc, Lg_rescaled, contrib);
+            Value Lg_new =
+                arith::AddFOp::create(b, nestedLoc, Lg_rescaled, contrib);
             linalg::YieldOp::create(b, nestedLoc, ValueRange{Mg_new, Lg_new});
           });
       Value M_global = globalReduceOp.getResult(0);
       Value L_global = globalReduceOp.getResult(1);
 
       // --- Generic 2: Correct P elementwise ---
-      // corrected_P[..., M, tn, ts] = P[..., M, tn, ts] * l[..., M, tn] * exp(m[..., M, tn] - M_global[..., M]) / L_global[..., M]
-      // Dims: (batch..., M, tn, ts) — all parallel
-      // expandedSShape = [...batch, M, tn, ts]
+      // corrected_P[..., M, tn, ts] = P[..., M, tn, ts] * l[..., M, tn] *
+      // exp(m[..., M, tn] - M_global[..., M]) / L_global[..., M] Dims:
+      // (batch..., M, tn, ts) — all parallel expandedSShape = [...batch, M, tn,
+      // ts]
       auto correctedType = RankedTensorType::get(expandedSShape, elemType);
-      Value corrected_init = tensor::EmptyOp::create(rewriter, loc, expandedSShape, elemType).getResult();
+      Value corrected_init =
+          tensor::EmptyOp::create(rewriter, loc, expandedSShape, elemType)
+              .getResult();
 
       // Maps for the correction generic:
       // P:        fullMap = identity over all dims
@@ -565,20 +581,20 @@ struct SoftmaxMatmulToSoftmaxMatmulFusion
       // M_global: [..., M] (drop tn and ts)
       // L_global: [..., M] (drop tn and ts)
       // output:   fullMap = identity
-      SmallVector<AffineExpr> globalExprs(allDims.begin(), allDims.end() - 2); // drop tn and ts
+      SmallVector<AffineExpr> globalExprs(allDims.begin(),
+                                          allDims.end() - 2); // drop tn and ts
       AffineMap globalMap = AffineMap::get(numLocalDims, 0, globalExprs, ctx);
 
       // softmax[..., tn, ts] = num * exp(m - Mg) / Lg.
       // (Since num = exp(S - m_local) and P = num/l_local, the local l cancels:
       //  P * l * exp(m - Mg)/Lg = num * exp(m - Mg)/Lg.)
       auto correctionOp = linalg::GenericOp::create(
-          rewriter, loc,
-          TypeRange{correctedType},
+          rewriter, loc, TypeRange{correctedType},
           /*inputs=*/ValueRange{num, m, M_global, L_global},
           /*outputs=*/ValueRange{corrected_init},
-          SmallVector<AffineMap>{fullMap, reducedMap, globalMap, globalMap, fullMap},
-          allParallel,
-          [&](OpBuilder &b, Location nestedLoc, ValueRange args) {
+          SmallVector<AffineMap>{fullMap, reducedMap, globalMap, globalMap,
+                                 fullMap},
+          allParallel, [&](OpBuilder &b, Location nestedLoc, ValueRange args) {
             Value num_v = args[0], m_i = args[1];
             Value Mg = args[2], Lg = args[3];
             // w = exp(m_i - Mg) / Lg
@@ -624,7 +640,8 @@ private:
 
 } // namespace
 
-void mlir::linalg::populateSoftmaxMatmulFusionPatterns(RewritePatternSet &patterns,
-                                                  int64_t tileSize) {
-  patterns.add<SoftmaxMatmulToSoftmaxMatmulFusion>(patterns.getContext(), tileSize);
+void mlir::linalg::populateSoftmaxMatmulFusionPatterns(
+    RewritePatternSet &patterns, int64_t tileSize) {
+  patterns.add<SoftmaxMatmulToSoftmaxMatmulFusion>(patterns.getContext(),
+                                                   tileSize);
 }
diff --git a/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
index 454e32d4c..88e0eb2ed 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
@@ -372,9 +372,10 @@ struct ExpandShapeOpTiling
         inputSizes[srcDim] = sizes[expandedDims[0]];
       } else {
         // 1-to-many mapping: compute linearized offset and size.
-        // offset = sum_i(offset[expandedDims[i]] * product(sizes[expandedDims[i+1:]]))
-        // size = product(sizes[expandedDims[i]])
-        // This only works correctly when slicing selects contiguous elements.
+        // offset = sum_i(offset[expandedDims[i]] *
+        // product(sizes[expandedDims[i+1:]])) size =
+        // product(sizes[expandedDims[i]]) This only works correctly when
+        // slicing selects contiguous elements.
         AffineExpr offsetExpr = b.getAffineConstantExpr(0);
         AffineExpr sizeExpr = b.getAffineConstantExpr(1);
         SmallVector<OpFoldResult> symbolOperands;
@@ -387,8 +388,7 @@ struct ExpandShapeOpTiling
           // Accumulate offset: offset += expandedOffset[i] * stride
           unsigned symIdx = symbolOperands.size();
           symbolOperands.push_back(offsets[expandedDim]);
-          offsetExpr = offsetExpr +
-                       b.getAffineSymbolExpr(symIdx) * stride;
+          offsetExpr = offsetExpr + b.getAffineSymbolExpr(symIdx) * stride;
 
           // Accumulate size: size *= expandedSize[i]
           unsigned sizeSymIdx = symbolOperands.size();
@@ -398,8 +398,8 @@ struct ExpandShapeOpTiling
           stride *= dimSize;
         }
 
-        AffineMap offsetMap =
-            AffineMap::get(0, symbolOperands.size(), offsetExpr, b.getContext());
+        AffineMap offsetMap = AffineMap::get(0, symbolOperands.size(),
+                                             offsetExpr, b.getContext());
         AffineMap sizeMap =
             AffineMap::get(0, symbolOperands.size(), sizeExpr, b.getContext());
 
@@ -424,8 +424,8 @@ struct ExpandShapeOpTiling
     }
     auto tiledResultType =
         RankedTensorType::get(tiledResultShape, resultType.getElementType());
-    Value tiledExpand = b.create<tensor::ExpandShapeOp>(
-        loc, tiledResultType, inputSlice, reassoc);
+    Value tiledExpand = b.create<tensor::ExpandShapeOp>(loc, tiledResultType,
+                                                        inputSlice, reassoc);
 
     return TilingResult{{op}, {tiledExpand}, {inputSlice.getDefiningOp()}};
   }
diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
index 3ee73928b..fb8931fae 100644
--- a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
+++ b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
@@ -242,9 +242,8 @@ static void applyDecomposeWinogradOps(func::FuncOp funcOp) {
   (void)applyPatternsGreedily(funcOp, std::move(patterns));
 }
 
-
 static void applySoftmaxMatmulFusionRewrite(func::FuncOp funcOp,
-                                       int64_t tileSize) {
+                                            int64_t tileSize) {
   MLIRContext *ctx = funcOp.getContext();
   RewritePatternSet patterns(ctx);
   linalg::populateSoftmaxMatmulFusionPatterns(patterns, tileSize);
@@ -292,7 +291,8 @@ void TestLinalgTransforms::runOnOperation() {
   if (testDecomposeWinogradOps)
     return applyDecomposeWinogradOps(getOperation());
   if (testSoftmaxMatmulFusionRewrite)
-    return applySoftmaxMatmulFusionRewrite(getOperation(), softmaxMatmulFusionTileSize);
+    return applySoftmaxMatmulFusionRewrite(getOperation(),
+                                           softmaxMatmulFusionTileSize);
   Operation *rootOp = getOperation();
   if (testFoldIntoPackAndUnpack)
     applyFoldIntoPackAndUnpackPatterns(rootOp);

``````````

</details>


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


More information about the Mlir-commits mailing list