[Mlir-commits] [mlir] [MLIR] Add continuous tiling to TileUsingForOp (PR #82792)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Feb 23 09:00:17 PST 2024


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 5cb2ebc08f6fa42341409b88466c5c266e5839cc 4c89934000a76923d4caedcae5734d4aa8fc99d2 -- mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h b/mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h
index b40291b5a8..cd345c84a1 100644
--- a/mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h
+++ b/mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h
@@ -104,7 +104,7 @@ FailureOr<SCFTilingResult> tileUsingSCF(RewriterBase &rewriter,
 /// using `scf.for` for iterating over the tiles.
 FailureOr<SCFTilingResult>
 continuousTileUsingSCF(RewriterBase &rewriter, TilingInterface op,
-                            const SCFTilingOptions &options);
+                       const SCFTilingOptions &options);
 
 /// Options used to control tile + fuse.
 struct SCFTileAndFuseOptions {
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 75080ea772..e8095c20d5 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -2492,7 +2492,8 @@ void transform::TileUsingForOp::build(
     std::optional<ArrayRef<bool>> scalableSizes) {
   build(builder, result, target,
         getAsOpFoldResult(builder.getI64ArrayAttr(staticTileSizes)),
-        builder.getDenseBoolArrayAttr(continuousTiles), interchange, scalableSizes);
+        builder.getDenseBoolArrayAttr(continuousTiles), interchange,
+        scalableSizes);
 }
 
 void transform::TileUsingForOp::build(
@@ -2503,8 +2504,8 @@ void transform::TileUsingForOp::build(
   // Loop types are automaticaly splat by the callee, setting up one is
   // enough.
   SmallVector<Type> loopTypes(1, builder.getType<transform::AnyOpType>());
-  build(builder, result, loopTypes, target, mixedTileSizes, continuousTiles, interchange,
-        scalableSizes);
+  build(builder, result, loopTypes, target, mixedTileSizes, continuousTiles,
+        interchange, scalableSizes);
 }
 
 void transform::TileUsingForOp::build(
@@ -2684,7 +2685,7 @@ transform::TileUsingForOp::apply(transform::TransformRewriter &rewriter,
     FailureOr<scf::SCFTilingResult> maybeTilingResult;
     if (tilingOptions.continuousTileMappingVector.empty())
       maybeTilingResult =
-        tileUsingSCF(rewriter, tilingInterface, tilingOptions);
+          tileUsingSCF(rewriter, tilingInterface, tilingOptions);
     else
       maybeTilingResult =
           continuousTileUsingSCF(rewriter, tilingInterface, tilingOptions);
diff --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
index f81a901c82..c8b265467a 100644
--- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
@@ -313,9 +313,9 @@ static LogicalResult generateLoopNest(RewriterBase &rewriter, Location loc,
 
 static void continuousLoopNestHelper(
     OpBuilder &builder, Location loc, ArrayRef<Range> loopRanges,
-    SmallVector<LoopLikeOpInterface> &loops, uint64_t loopLevelIdx, uint64_t &loopIdx,
-    ArrayRef<OpFoldResult> tileSizes, SmallVector<bool> &CTileVector,
-    std::map<int, OpFoldResult> &sizesMap,
+    SmallVector<LoopLikeOpInterface> &loops, uint64_t loopLevelIdx,
+    uint64_t &loopIdx, ArrayRef<OpFoldResult> tileSizes,
+    SmallVector<bool> &CTileVector, std::map<int, OpFoldResult> &sizesMap,
     SmallVector<scf::ForOp> &innermostLoops, ValueRange destinationTensors = {},
     bool isHeadOrInsideHeadLoop = false) {
 
@@ -493,7 +493,6 @@ static SmallVector<LoopLikeOpInterface> generateContinuousTileLoopNest(
   return loops;
 }
 
-
 /// Append the specified additional `newInitOperands` operands to the
 /// loops existing `init` operands (or similar), and replace `loopOp` with
 /// the new loop that has the additional init operands. The loop body of
@@ -912,9 +911,8 @@ mlir::scf::tileUsingSCF(RewriterBase &rewriter, TilingInterface op,
 /// All tail-loops can be converted to IFs as they execute at-most once.
 ///
 FailureOr<scf::SCFTilingResult>
-mlir::scf::continuousTileUsingSCF(RewriterBase &rewriter,
-                                       TilingInterface op,
-                                       const scf::SCFTilingOptions &options) {
+mlir::scf::continuousTileUsingSCF(RewriterBase &rewriter, TilingInterface op,
+                                  const scf::SCFTilingOptions &options) {
   OpBuilder::InsertionGuard guard(rewriter);
   rewriter.setInsertionPointAfter(op);
 
@@ -1074,8 +1072,7 @@ mlir::scf::continuousTileUsingSCF(RewriterBase &rewriter,
     // If loops are empty, the tiled op is used as the replacement for the
     // untiled op.
     if (forLoops.empty()) {
-      return scf::SCFTilingResult{tiledImplementation->tiledOps,
-                                  forLoops,
+      return scf::SCFTilingResult{tiledImplementation->tiledOps, forLoops,
                                   tiledImplementation->tiledValues};
     }
 
@@ -1131,9 +1128,9 @@ mlir::scf::continuousTileUsingSCF(RewriterBase &rewriter,
       loopOp->removeAttr(kLoopIndexLabel);
   });
 
-  return scf::SCFTilingResult{
-      origTiledImplementation.tiledOps, forLoops,
-      op->getNumResults() == 0 ? SmallVector<Value>({}) : replacements};
+  return scf::SCFTilingResult{origTiledImplementation.tiledOps, forLoops,
+                              op->getNumResults() == 0 ? SmallVector<Value>({})
+                                                       : replacements};
 }
 
 FailureOr<scf::SCFReductionTilingResult>

``````````

</details>


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


More information about the Mlir-commits mailing list