[mlir] Linalg: add tile interchange flag to test-linalg-codegen-strategy pass
authorEugene Zhulenev <ezhulenev@google.com>
Fri, 26 Mar 2021 02:49:27 +0000 (19:49 -0700)
committerEugene Zhulenev <ezhulenev@google.com>
Tue, 30 Mar 2021 17:48:34 +0000 (10:48 -0700)
Interchange options was missing in the pass flags.

Reviewed By: nicolasvasilache

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

mlir/test/Dialect/Linalg/codegen-strategy.mlir
mlir/test/lib/Transforms/TestLinalgCodegenStrategy.cpp

index 5affbdc..e08d99e 100644 (file)
@@ -1,5 +1,6 @@
 // Test that both anchor-op name and MatmulOp-based codegen strategy produce the same result.
 // RUN: mlir-opt %s -test-linalg-codegen-strategy="tile-sizes=2,4,8 vectorize vectorize-contraction-to=matrixintrinsics unroll-vector-transfers=true" | FileCheck %s
+// RUN: mlir-opt %s -test-linalg-codegen-strategy="tile-sizes=2,4,8 tile-interchange=1,2,0 vectorize vectorize-contraction-to=matrixintrinsics unroll-vector-transfers=true" | FileCheck %s
 // RUN: mlir-opt %s -test-linalg-codegen-strategy="tile-sizes=16,32,64 promote promote-full-tile-pad register-tile-sizes=2,4,8 vectorize vectorize-contraction-to=outerproduct split-transfers=true unroll-vector-transfers=false" | FileCheck %s --check-prefix=OUTER
 // RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-op=linalg.matmul tile-sizes=2,4,8 vectorize vectorize-contraction-to=matrixintrinsics unroll-vector-transfers=true" | FileCheck %s
 // RUN: mlir-opt %s -test-linalg-codegen-strategy="anchor-op=linalg.matmul tile-sizes=16,32,64 promote promote-full-tile-pad register-tile-sizes=2,4,8 vectorize vectorize-contraction-to=outerproduct split-transfers=true unroll-vector-transfers=false" | FileCheck %s --check-prefix=OUTER
index 11a22bd..fc92835 100644 (file)
@@ -57,6 +57,10 @@ struct TestLinalgCodegenStrategy
   ListOption<int64_t> tileSizes{*this, "tile-sizes",
                                 llvm::cl::MiscFlags::CommaSeparated,
                                 llvm::cl::desc("Specifies the tile sizes.")};
+  ListOption<unsigned> tileInterchange{
+      *this, "tile-interchange", llvm::cl::MiscFlags::CommaSeparated,
+      llvm::cl::desc("Specifies the tile interchange.")};
+
   Option<bool> promote{
       *this, "promote",
       llvm::cl::desc("Promote the tile into a small aligned memory buffer."),
@@ -187,6 +191,8 @@ void TestLinalgCodegenStrategy::runOnFunction() {
   LinalgTilingOptions tilingOptions;
   if (!tileSizes.empty())
     tilingOptions = tilingOptions.setTileSizes(tileSizes);
+  if (!tileInterchange.empty())
+    tilingOptions = tilingOptions.setInterchange(tileInterchange);
 
   LinalgTilingOptions registerTilingOptions;
   if (!registerTileSizes.empty())