[Mlir-commits] [mlir] [mlir][linalg][NFC] Drop redundant rankReductionStrategy (PR #107875)

Longsheng Mou llvmlistbot at llvm.org
Mon Sep 9 08:20:15 PDT 2024


https://github.com/CoTinker created https://github.com/llvm/llvm-project/pull/107875

This patch drop redundant rankReductionStrategy in `populateFoldUnitExtentDimsViaSlicesPatterns` and fixes comment typos.

>From 1ede4f3435cac8d013f4574a8c57aa34a2055fc7 Mon Sep 17 00:00:00 2001
From: Longsheng Mou <moulongsheng at huawei.com>
Date: Mon, 9 Sep 2024 23:15:40 +0800
Subject: [PATCH] [mlir][linalg][NFC] Drop redundant rankReductionStrategy

This patch drop redundant rankReductionStrategy in
`populateFoldUnitExtentDimsViaSlicesPatterns` and fixes
comment typos.
---
 mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
index 88ef82fb38d67b..90ee0fb3bf0b6b 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
@@ -526,12 +526,11 @@ linalg::dropUnitDims(RewriterBase &rewriter, GenericOp genericOp,
   rewriter.inlineRegionBefore(genericOp.getRegion(), replacementOp.getRegion(),
                               replacementOp.getRegion().begin());
   // 5a. Replace `linalg.index` operations that refer to the dropped unit
-  // dimensions.
+  //     dimensions.
   replaceUnitDimIndexOps(replacementOp, unitDims, rewriter);
 
   // 6. If any result type changes, insert a reshape/slice to convert from the
-  // original
-  //    type to the new type.
+  //    original type to the new type.
   SmallVector<Value> resultReplacements;
   for (auto [index, result] : llvm::enumerate(replacementOp.getResults())) {
     unsigned opOperandIndex = index + replacementOp.getNumDpsInputs();
@@ -789,8 +788,6 @@ static void
 populateFoldUnitExtentDimsViaSlicesPatterns(RewritePatternSet &patterns,
                                             ControlDropUnitDims &options) {
   auto *context = patterns.getContext();
-  options.rankReductionStrategy =
-      ControlDropUnitDims::RankReductionStrategy::ExtractInsertSlice;
   patterns.add<DropUnitDims>(context, options);
   patterns.add<DropPadUnitDims>(context, options);
   // TODO: Patterns unrelated to unit dim folding should be factored out.



More information about the Mlir-commits mailing list