[Mlir-commits] [mlir] 608a663 - [MLIR] Clean up pass options for test-loop-fusion and affine-super-vectorizer-test (#87606)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Apr 4 03:26:36 PDT 2024
Author: Philip Lassen
Date: 2024-04-04T12:26:33+02:00
New Revision: 608a663c8ee485c42637d021d554c8d264d556b1
URL: https://github.com/llvm/llvm-project/commit/608a663c8ee485c42637d021d554c8d264d556b1
DIFF: https://github.com/llvm/llvm-project/commit/608a663c8ee485c42637d021d554c8d264d556b1.diff
LOG: [MLIR] Clean up pass options for test-loop-fusion and affine-super-vectorizer-test (#87606)
Before the change `test-loop-fusion` and `affine-super-vectorizer-test`
options were in their own category. This was because they used the
standard llvm command line parsing with `llvm::cl::opt`. This PR moves
them over to the mlir `Pass::Option` class.
Before the change
```
$ mlir-opt --help
...
General options:
...
Compiler passes to run
Passes:
...
Pass Pipelines:
...
Generic Options:
....
affine-super-vectorizer-test options:
--backward-slicing
...
--vectorize-affine-loop-nest
test-loop-fusion options:
--test-loop-fusion-dependence-check
...
--test-loop-fusion-transformation
```
After the change
```
$ mlir-opt --help
...
General options:
...
Compiler passes to run
Passes:
...
--affine-super-vectorizer-test
--backward-slicing
...
--vectorize-affine-loop-nest
...
--test-loop-fusion options:
--test-loop-fusion-dependence-check
...
--test-loop-fusion-transformation
...
Pass Pipelines:
...
Generic Options:
...
```
---------
Signed-off-by: philass <plassen at groq.com>
Added:
Modified:
mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir
mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir
mlir/test/Dialect/Affine/SuperVectorize/vectorize_unsupported.mlir
mlir/test/Dialect/Affine/loop-fusion-dependence-check.mlir
mlir/test/Dialect/Affine/loop-fusion-slice-computation.mlir
mlir/test/Dialect/Affine/loop-fusion-transformation.mlir
mlir/test/Dialect/Affine/slicing-utils.mlir
mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp
mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
Removed:
################################################################################
diff --git a/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir b/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir
index b53fc55fdac910..d998ed874f416f 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt -allow-unregistered-dialect %s -affine-super-vectorizer-test -compose-maps -split-input-file 2>&1 | FileCheck %s
+// RUN: mlir-opt -allow-unregistered-dialect %s -affine-super-vectorizer-test=compose-maps -split-input-file 2>&1 | FileCheck %s
// For all these cases, the test traverses the `test_affine_map` ops and
// composes them in order one-by-one.
diff --git a/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir
index e58de9fdaa762e..bd71164244c00b 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/vector_utils.mlir
@@ -1,6 +1,6 @@
-// RUN: mlir-opt %s -affine-super-vectorizer-test -vector-shape-ratio 4 -vector-shape-ratio 8 2>&1 | FileCheck %s
-// RUN: mlir-opt %s -affine-super-vectorizer-test -vector-shape-ratio 2 -vector-shape-ratio 5 -vector-shape-ratio 2 2>&1 | FileCheck %s -check-prefix=TEST-3x4x5x8
-// RUN: mlir-opt %s -affine-super-vectorizer-test -vectorize-affine-loop-nest 2>&1 | FileCheck %s -check-prefix=VECNEST
+// RUN: mlir-opt %s -affine-super-vectorizer-test="vector-shape-ratio=4,8" 2>&1 | FileCheck %s
+// RUN: mlir-opt %s -affine-super-vectorizer-test="vector-shape-ratio=2,5,2" 2>&1 | FileCheck %s -check-prefix=TEST-3x4x5x8
+// RUN: mlir-opt %s -affine-super-vectorizer-test=vectorize-affine-loop-nest 2>&1 | FileCheck %s -check-prefix=VECNEST
func.func @vector_add_2d(%arg0: index, %arg1: index) -> f32 {
// Nothing should be matched in this first block.
diff --git a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_unsupported.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_unsupported.mlir
index c117bfc82ca079..6c1a7c48c4cb13 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_unsupported.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_unsupported.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s -affine-super-vectorizer-test -vectorize-affine-loop-nest -split-input-file 2>&1 | FileCheck %s
+// RUN: mlir-opt %s -affine-super-vectorizer-test=vectorize-affine-loop-nest -split-input-file 2>&1 | FileCheck %s
func.func @unparallel_loop_reduction_unsupported(%in: memref<256x512xf32>, %out: memref<256xf32>) {
// CHECK: Outermost loop cannot be parallel
diff --git a/mlir/test/Dialect/Affine/loop-fusion-dependence-check.mlir b/mlir/test/Dialect/Affine/loop-fusion-dependence-check.mlir
index aa872b0f6911ac..2c53852a8cec9f 100644
--- a/mlir/test/Dialect/Affine/loop-fusion-dependence-check.mlir
+++ b/mlir/test/Dialect/Affine/loop-fusion-dependence-check.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-fusion -test-loop-fusion-dependence-check -split-input-file -verify-diagnostics | FileCheck %s
+// RUN: mlir-opt -allow-unregistered-dialect %s -test-loop-fusion=test-loop-fusion-dependence-check -split-input-file -verify-diagnostics | FileCheck %s
// -----
diff --git a/mlir/test/Dialect/Affine/loop-fusion-slice-computation.mlir b/mlir/test/Dialect/Affine/loop-fusion-slice-computation.mlir
index c303dd0c01eced..aa79ee26928e29 100644
--- a/mlir/test/Dialect/Affine/loop-fusion-slice-computation.mlir
+++ b/mlir/test/Dialect/Affine/loop-fusion-slice-computation.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s -test-loop-fusion -test-loop-fusion-slice-computation -split-input-file -verify-diagnostics | FileCheck %s
+// RUN: mlir-opt %s -test-loop-fusion=test-loop-fusion-slice-computation -split-input-file -verify-diagnostics | FileCheck %s
// -----
diff --git a/mlir/test/Dialect/Affine/loop-fusion-transformation.mlir b/mlir/test/Dialect/Affine/loop-fusion-transformation.mlir
index c8e0918e6bfd6f..4f4163a2bbd528 100644
--- a/mlir/test/Dialect/Affine/loop-fusion-transformation.mlir
+++ b/mlir/test/Dialect/Affine/loop-fusion-transformation.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s -allow-unregistered-dialect -test-loop-fusion -test-loop-fusion-transformation -split-input-file -canonicalize | FileCheck %s
+// RUN: mlir-opt %s -allow-unregistered-dialect -test-loop-fusion=test-loop-fusion-transformation -split-input-file -canonicalize | FileCheck %s
// CHECK-LABEL: func @slice_depth1_loop_nest() {
func.func @slice_depth1_loop_nest() {
diff --git a/mlir/test/Dialect/Affine/slicing-utils.mlir b/mlir/test/Dialect/Affine/slicing-utils.mlir
index 71bd8ad4ef9daa..74379978fdf8c3 100644
--- a/mlir/test/Dialect/Affine/slicing-utils.mlir
+++ b/mlir/test/Dialect/Affine/slicing-utils.mlir
@@ -1,6 +1,6 @@
-// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-super-vectorizer-test -forward-slicing=true 2>&1 | FileCheck %s --check-prefix=FWD
-// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-super-vectorizer-test -backward-slicing=true 2>&1 | FileCheck %s --check-prefix=BWD
-// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-super-vectorizer-test -slicing=true 2>&1 | FileCheck %s --check-prefix=FWDBWD
+// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-super-vectorizer-test="forward-slicing=true" 2>&1 | FileCheck %s --check-prefix=FWD
+// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-super-vectorizer-test="backward-slicing=true" 2>&1 | FileCheck %s --check-prefix=BWD
+// RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -affine-super-vectorizer-test="slicing=true" 2>&1 | FileCheck %s --check-prefix=FWDBWD
/// 1 2 3 4
/// |_______| |______|
diff --git a/mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp b/mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp
index f4f1593dc53e2b..19011803a793ac 100644
--- a/mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestLoopFusion.cpp
@@ -22,23 +22,6 @@
using namespace mlir;
using namespace mlir::affine;
-static llvm::cl::OptionCategory clOptionsCategory(DEBUG_TYPE " options");
-
-static llvm::cl::opt<bool> clTestDependenceCheck(
- "test-loop-fusion-dependence-check",
- llvm::cl::desc("Enable testing of loop fusion dependence check"),
- llvm::cl::cat(clOptionsCategory));
-
-static llvm::cl::opt<bool> clTestSliceComputation(
- "test-loop-fusion-slice-computation",
- llvm::cl::desc("Enable testing of loop fusion slice computation"),
- llvm::cl::cat(clOptionsCategory));
-
-static llvm::cl::opt<bool> clTestLoopFusionTransformation(
- "test-loop-fusion-transformation",
- llvm::cl::desc("Enable testing of loop fusion transformation"),
- llvm::cl::cat(clOptionsCategory));
-
namespace {
struct TestLoopFusion
@@ -50,6 +33,24 @@ struct TestLoopFusion
return "Tests loop fusion utility functions.";
}
void runOnOperation() override;
+
+ TestLoopFusion() = default;
+ TestLoopFusion(const TestLoopFusion &pass) : PassWrapper(pass){};
+
+ Option<bool> clTestDependenceCheck{
+ *this, "test-loop-fusion-dependence-check",
+ llvm::cl::desc("Enable testing of loop fusion dependence check"),
+ llvm::cl::init(false)};
+
+ Option<bool> clTestSliceComputation{
+ *this, "test-loop-fusion-slice-computation",
+ llvm::cl::desc("Enable testing of loop fusion slice computation"),
+ llvm::cl::init(false)};
+
+ Option<bool> clTestLoopFusionTransformation{
+ *this, "test-loop-fusion-transformation",
+ llvm::cl::desc("Enable testing of loop fusion transformation"),
+ llvm::cl::init(false)};
};
} // namespace
diff --git a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
index b497f8d75fde75..598678f64cb467 100644
--- a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
@@ -37,39 +37,6 @@ using namespace mlir::affine;
static llvm::cl::OptionCategory clOptionsCategory(DEBUG_TYPE " options");
-static llvm::cl::list<int> clTestVectorShapeRatio(
- "vector-shape-ratio",
- llvm::cl::desc("Specify the HW vector size for vectorization"),
- llvm::cl::cat(clOptionsCategory));
-static llvm::cl::opt<bool> clTestForwardSlicingAnalysis(
- "forward-slicing",
- llvm::cl::desc("Enable testing forward static slicing and topological sort "
- "functionalities"),
- llvm::cl::cat(clOptionsCategory));
-static llvm::cl::opt<bool> clTestBackwardSlicingAnalysis(
- "backward-slicing",
- llvm::cl::desc("Enable testing backward static slicing and "
- "topological sort functionalities"),
- llvm::cl::cat(clOptionsCategory));
-static llvm::cl::opt<bool> clTestSlicingAnalysis(
- "slicing",
- llvm::cl::desc("Enable testing static slicing and topological sort "
- "functionalities"),
- llvm::cl::cat(clOptionsCategory));
-static llvm::cl::opt<bool> clTestComposeMaps(
- "compose-maps",
- llvm::cl::desc(
- "Enable testing the composition of AffineMap where each "
- "AffineMap in the composition is specified as the affine_map attribute "
- "in a constant op."),
- llvm::cl::cat(clOptionsCategory));
-static llvm::cl::opt<bool> clTestVecAffineLoopNest(
- "vectorize-affine-loop-nest",
- llvm::cl::desc(
- "Enable testing for the 'vectorizeAffineLoopNest' utility by "
- "vectorizing the outermost loops found"),
- llvm::cl::cat(clOptionsCategory));
-
namespace {
struct VectorizerTestPass
: public PassWrapper<VectorizerTestPass, OperationPass<func::FuncOp>> {
@@ -85,6 +52,37 @@ struct VectorizerTestPass
return "Tests vectorizer standalone functionality.";
}
+ VectorizerTestPass() = default;
+ VectorizerTestPass(const VectorizerTestPass &pass) : PassWrapper(pass){};
+
+ ListOption<int> clTestVectorShapeRatio{
+ *this, "vector-shape-ratio",
+ llvm::cl::desc("Specify the HW vector size for vectorization")};
+ Option<bool> clTestForwardSlicingAnalysis{
+ *this, "forward-slicing",
+ llvm::cl::desc(
+ "Enable testing forward static slicing and topological sort "
+ "functionalities")};
+ Option<bool> clTestBackwardSlicingAnalysis{
+ *this, "backward-slicing",
+ llvm::cl::desc("Enable testing backward static slicing and "
+ "topological sort functionalities")};
+ Option<bool> clTestSlicingAnalysis{
+ *this, "slicing",
+ llvm::cl::desc("Enable testing static slicing and topological sort "
+ "functionalities")};
+ Option<bool> clTestComposeMaps{
+ *this, "compose-maps",
+ llvm::cl::desc("Enable testing the composition of AffineMap where each "
+ "AffineMap in the composition is specified as the "
+ "affine_map attribute "
+ "in a constant op.")};
+ Option<bool> clTestVecAffineLoopNest{
+ *this, "vectorize-affine-loop-nest",
+ llvm::cl::desc(
+ "Enable testing for the 'vectorizeAffineLoopNest' utility by "
+ "vectorizing the outermost loops found")};
+
void runOnOperation() override;
void testVectorShapeRatio(llvm::raw_ostream &outs);
void testForwardSlicing(llvm::raw_ostream &outs);
More information about the Mlir-commits
mailing list