[Mlir-commits] [mlir] b326eb6 - [mli][linalg] Use CodegenStrategy to test interchange (NFC).

Tobias Gysi llvmlistbot at llvm.org
Wed Nov 10 07:48:18 PST 2021


Author: Tobias Gysi
Date: 2021-11-10T15:44:44Z
New Revision: b326eb64fd2fcb478992df6a4d163a1fc01ca870

URL: https://github.com/llvm/llvm-project/commit/b326eb64fd2fcb478992df6a4d163a1fc01ca870
DIFF: https://github.com/llvm/llvm-project/commit/b326eb64fd2fcb478992df6a4d163a1fc01ca870.diff

LOG: [mli][linalg] Use CodegenStrategy to test interchange (NFC).

Use CodegenStrategy instead of a separate test pass to test iterator interchange.

Depends On D113409

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D113550

Added: 
    

Modified: 
    mlir/test/Dialect/Linalg/interchange.mlir
    mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/Dialect/Linalg/interchange.mlir b/mlir/test/Dialect/Linalg/interchange.mlir
index 45424cf753fc..12fb7865821a 100644
--- a/mlir/test/Dialect/Linalg/interchange.mlir
+++ b/mlir/test/Dialect/Linalg/interchange.mlir
@@ -1,5 +1,5 @@
-// RUN: mlir-opt %s -test-linalg-transform-patterns=test-interchange-pattern=4,0,3,1,2 | FileCheck %s
-// RUN: mlir-opt %s -test-linalg-transform-patterns=test-interchange-pattern=4,0,3,1,2 -test-linalg-transform-patterns=test-interchange-pattern=1,3,4,2,0 | FileCheck --check-prefix=CANCEL-OUT %s
+// RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-op=linalg.generic iterator-interchange=4,0,3,1,2" | FileCheck %s
+// RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-op=linalg.generic iterator-interchange=4,0,3,1,2" -test-linalg-codegen-strategy="anchor-op=linalg.generic iterator-interchange=1,3,4,2,0" | FileCheck --check-prefix=CANCEL-OUT %s
 
 #map0 = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d2, d3, d4)>
 #map1 = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d3)>

diff  --git a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
index e394d3f0c452..117e2e515beb 100644
--- a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
+++ b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
@@ -114,9 +114,6 @@ struct TestLinalgTransforms
       *this, "tile-sizes",
       llvm::cl::desc("Linalg tile sizes for test-tile-pattern"),
       llvm::cl::ZeroOrMore, llvm::cl::MiscFlags::CommaSeparated};
-  ListOption<unsigned> testInterchangePattern{
-      *this, "test-interchange-pattern", llvm::cl::MiscFlags::CommaSeparated,
-      llvm::cl::desc("Test the interchange pattern.")};
   ListOption<unsigned> testTiledLoopPeeling{
       *this, "test-tiled-loop-peeling",
       llvm::cl::desc("Test peeling of linalg.tiled_loop ops"),
@@ -612,17 +609,6 @@ static void applyTilePattern(FuncOp funcOp, std::string loopType,
   (void)applyPatternsAndFoldGreedily(funcOp, std::move(tilingPattern));
 }
 
-static void applyInterchangePattern(FuncOp funcOp,
-                                    ArrayRef<unsigned> interchangeVector) {
-  MLIRContext *context = funcOp.getContext();
-  RewritePatternSet interchangePattern(context);
-  interchangePattern.add<GenericOpInterchangePattern>(
-      context, interchangeVector,
-      LinalgTransformationFilter(ArrayRef<Identifier>{},
-                                 Identifier::get("interchange", context)));
-  (void)applyPatternsAndFoldGreedily(funcOp, std::move(interchangePattern));
-}
-
 static constexpr char kPeeledLoopsLabel[] = "__peeled_loops__";
 static constexpr char kPartialIterationLabel[] = "__partial_iteration__";
 
@@ -742,8 +728,6 @@ void TestLinalgTransforms::runOnFunction() {
   if (testTileScalarizeDynamicDims)
     return applyTilePattern(getFunction(), loopType, tileSizes,
                             /*peeledLoops=*/{}, /*scalarizeDynamicDims=*/true);
-  if (testInterchangePattern.hasValue())
-    return applyInterchangePattern(getFunction(), testInterchangePattern);
   if (testDecomposeConvolutionPattern)
     return applyDecomposeConvolutionPatterns(getFunction());
 }


        


More information about the Mlir-commits mailing list