[mli][linalg] Use CodegenStrategy to test interchange (NFC).
authorTobias Gysi <gysit@google.com>
Wed, 10 Nov 2021 15:38:15 +0000 (15:38 +0000)
committerTobias Gysi <gysit@google.com>
Wed, 10 Nov 2021 15:44:44 +0000 (15:44 +0000)
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

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

index 45424cf753fce3119ad39f07193d4a7ad3aad16c..12fb7865821a92e1f16fa3beacd23a09a5bc41a0 100644 (file)
@@ -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)>
index e394d3f0c4528180cfcba6b6991bf32ba10c7ec6..117e2e515beb46319b6818c6974022360fc9adab 100644 (file)
@@ -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());
 }