Make sure they all define getArgument()/getDescription().
Depends On D104421
Differential Revision: https://reviews.llvm.org/D104426
public:
SerializeToCubinPass();
+ StringRef getArgument() const override { return "gpu-to-cubin"; }
+ StringRef getDescription() const override {
+ return "Lower GPU kernel function to CUBIN binary annotations";
+ }
+
private:
void getDependentDialects(DialectRegistry ®istry) const override;
// Register pass to serialize GPU kernel functions to a CUBIN binary annotation.
void mlir::registerGpuSerializeToCubinPass() {
PassRegistration<SerializeToCubinPass> registerSerializeToCubin(
- "gpu-to-cubin", "Lower GPU kernel function to CUBIN binary annotations",
[] {
// Initialize LLVM NVPTX backend.
LLVMInitializeNVPTXTarget();
public:
SerializeToHsacoPass();
+ StringRef getArgument() const override { return "gpu-to-hsaco"; }
+ StringRef getDescription() const override {
+ return "Lower GPU kernel function to HSACO binary annotations";
+ }
+
private:
void getDependentDialects(DialectRegistry ®istry) const override;
// Register pass to serialize GPU kernel functions to a HSACO binary annotation.
void mlir::registerGpuSerializeToHsacoPass() {
PassRegistration<SerializeToHsacoPass> registerSerializeToHSACO(
- "gpu-to-hsaco", "Lower GPU kernel function to HSACO binary annotations",
[] {
// Initialize LLVM AMDGPU backend.
LLVMInitializeAMDGPUAsmParser();
namespace {
struct TestAliasAnalysisPass
: public PassWrapper<TestAliasAnalysisPass, OperationPass<>> {
+ StringRef getArgument() const final { return "test-alias-analysis"; }
+ StringRef getDescription() const final {
+ return "Test alias analysis results.";
+ }
void runOnOperation() override {
llvm::errs() << "Testing : " << getOperation()->getAttr("sym_name") << "\n";
namespace {
struct TestAliasAnalysisModRefPass
: public PassWrapper<TestAliasAnalysisModRefPass, OperationPass<>> {
+ StringRef getArgument() const final { return "test-alias-analysis-modref"; }
+ StringRef getDescription() const final {
+ return "Test alias analysis ModRef results.";
+ }
void runOnOperation() override {
llvm::errs() << "Testing : " << getOperation()->getAttr("sym_name") << "\n";
namespace mlir {
namespace test {
void registerTestAliasAnalysisPass() {
- PassRegistration<TestAliasAnalysisPass> aliasPass(
- "test-alias-analysis", "Test alias analysis results.");
- PassRegistration<TestAliasAnalysisModRefPass> modRefPass(
- "test-alias-analysis-modref", "Test alias analysis ModRef results.");
+ PassRegistration<TestAliasAnalysisPass>();
+ PassRegistration<TestAliasAnalysisModRefPass>();
}
} // namespace test
} // namespace mlir
namespace {
struct TestCallGraphPass
: public PassWrapper<TestCallGraphPass, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-print-callgraph"; }
+ StringRef getDescription() const final {
+ return "Print the contents of a constructed callgraph.";
+ }
void runOnOperation() override {
llvm::errs() << "Testing : " << getOperation()->getAttr("test.name")
<< "\n";
namespace mlir {
namespace test {
-void registerTestCallGraphPass() {
- PassRegistration<TestCallGraphPass> pass(
- "test-print-callgraph", "Print the contents of a constructed callgraph.");
-}
+void registerTestCallGraphPass() { PassRegistration<TestCallGraphPass>(); }
} // namespace test
} // namespace mlir
namespace {
struct TestLivenessPass : public PassWrapper<TestLivenessPass, FunctionPass> {
+ StringRef getArgument() const final { return "test-print-liveness"; }
+ StringRef getDescription() const final {
+ return "Print the contents of a constructed liveness information.";
+ }
void runOnFunction() override {
llvm::errs() << "Testing : " << getFunction().getName() << "\n";
getAnalysis<Liveness>().print(llvm::errs());
namespace mlir {
namespace test {
-void registerTestLivenessPass() {
- PassRegistration<TestLivenessPass>(
- "test-print-liveness",
- "Print the contents of a constructed liveness information.");
-}
+void registerTestLivenessPass() { PassRegistration<TestLivenessPass>(); }
} // namespace test
} // namespace mlir
/// Checks for out of bound memref access subscripts..
struct TestMemRefBoundCheck
: public PassWrapper<TestMemRefBoundCheck, FunctionPass> {
+ StringRef getArgument() const final { return "test-memref-bound-check"; }
+ StringRef getDescription() const final {
+ return "Check memref access bounds in a Function";
+ }
void runOnFunction() override;
};
namespace mlir {
namespace test {
-void registerMemRefBoundCheck() {
- PassRegistration<TestMemRefBoundCheck>(
- "test-memref-bound-check", "Check memref access bounds in a Function");
-}
+void registerMemRefBoundCheck() { PassRegistration<TestMemRefBoundCheck>(); }
} // namespace test
} // namespace mlir
/// Checks dependences between all pairs of memref accesses in a Function.
struct TestMemRefDependenceCheck
: public PassWrapper<TestMemRefDependenceCheck, FunctionPass> {
+ StringRef getArgument() const final { return "test-memref-dependence-check"; }
+ StringRef getDescription() const final {
+ return "Checks dependences between all pairs of memref accesses.";
+ }
SmallVector<Operation *, 4> loadsAndStores;
void runOnFunction() override;
};
namespace mlir {
namespace test {
void registerTestMemRefDependenceCheck() {
- PassRegistration<TestMemRefDependenceCheck> pass(
- "test-memref-dependence-check",
- "Checks dependences between all pairs of memref accesses.");
+ PassRegistration<TestMemRefDependenceCheck>();
}
} // namespace test
} // namespace mlir
namespace {
struct TestMemRefStrideCalculation
: public PassWrapper<TestMemRefStrideCalculation, FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-memref-stride-calculation";
+ }
+ StringRef getDescription() const final {
+ return "Test operation constant folding";
+ }
void runOnFunction() override;
};
} // end anonymous namespace
namespace mlir {
namespace test {
void registerTestMemRefStrideCalculation() {
- PassRegistration<TestMemRefStrideCalculation> pass(
- "test-memref-stride-calculation", "Test operation constant folding");
+ PassRegistration<TestMemRefStrideCalculation>();
}
} // namespace test
} // namespace mlir
struct TestNumberOfBlockExecutionsPass
: public PassWrapper<TestNumberOfBlockExecutionsPass, FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-print-number-of-block-executions";
+ }
+ StringRef getDescription() const final {
+ return "Print the contents of a constructed number of executions analysis "
+ "for "
+ "all blocks.";
+ }
void runOnFunction() override {
llvm::errs() << "Number of executions: " << getFunction().getName() << "\n";
getAnalysis<NumberOfExecutions>().printBlockExecutions(
struct TestNumberOfOperationExecutionsPass
: public PassWrapper<TestNumberOfOperationExecutionsPass, FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-print-number-of-operation-executions";
+ }
+ StringRef getDescription() const final {
+ return "Print the contents of a constructed number of executions analysis "
+ "for "
+ "all operations.";
+ }
void runOnFunction() override {
llvm::errs() << "Number of executions: " << getFunction().getName() << "\n";
getAnalysis<NumberOfExecutions>().printOperationExecutions(
namespace mlir {
namespace test {
void registerTestNumberOfBlockExecutionsPass() {
- PassRegistration<TestNumberOfBlockExecutionsPass>(
- "test-print-number-of-block-executions",
- "Print the contents of a constructed number of executions analysis for "
- "all blocks.");
+ PassRegistration<TestNumberOfBlockExecutionsPass>();
}
void registerTestNumberOfOperationExecutionsPass() {
- PassRegistration<TestNumberOfOperationExecutionsPass>(
- "test-print-number-of-operation-executions",
- "Print the contents of a constructed number of executions analysis for "
- "all operations.");
+ PassRegistration<TestNumberOfOperationExecutionsPass>();
}
} // namespace test
} // namespace mlir
void getDependentDialects(DialectRegistry ®istry) const final {
registry.insert<LLVM::LLVMDialect>();
}
+ StringRef getArgument() const final { return "test-convert-call-op"; }
+ StringRef getDescription() const final {
+ return "Tests conversion of `std.call` to `llvm.call` in "
+ "presence of custom types";
+ }
void runOnOperation() override {
ModuleOp m = getOperation();
namespace mlir {
namespace test {
-void registerConvertCallOpPass() {
- PassRegistration<TestConvertCallOp>(
- "test-convert-call-op",
- "Tests conversion of `std.call` to `llvm.call` in "
- "presence of custom types");
-}
+void registerConvertCallOpPass() { PassRegistration<TestConvertCallOp>(); }
} // namespace test
} // namespace mlir
struct TestAffineDataCopy
: public PassWrapper<TestAffineDataCopy, FunctionPass> {
+ StringRef getArgument() const final { return PASS_NAME; }
+ StringRef getDescription() const final {
+ return "Tests affine data copy utility functions.";
+ }
TestAffineDataCopy() = default;
TestAffineDataCopy(const TestAffineDataCopy &pass){};
namespace mlir {
void registerTestAffineDataCopyPass() {
- PassRegistration<TestAffineDataCopy>(
- PASS_NAME, "Tests affine data copy utility functions.");
+ PassRegistration<TestAffineDataCopy>();
}
} // namespace mlir
namespace {
struct TestAffineLoopParametricTiling
: public PassWrapper<TestAffineLoopParametricTiling, FunctionPass> {
+ StringRef getArgument() const final { return "test-affine-parametric-tile"; }
+ StringRef getDescription() const final {
+ return "Tile affine loops using SSA values as tile sizes";
+ }
void runOnFunction() override;
};
} // end anonymous namespace
namespace mlir {
namespace test {
void registerTestAffineLoopParametricTilingPass() {
- PassRegistration<TestAffineLoopParametricTiling>(
- "test-affine-parametric-tile",
- "Tile affine loops using SSA values as tile sizes");
+ PassRegistration<TestAffineLoopParametricTiling>();
}
} // namespace test
} // namespace mlir
/// This pass applies the permutation on the first maximal perfect nest.
struct TestAffineLoopUnswitching
: public PassWrapper<TestAffineLoopUnswitching, FunctionPass> {
+ StringRef getArgument() const final { return PASS_NAME; }
+ StringRef getDescription() const final {
+ return "Tests affine loop unswitching / if/else hoisting";
+ }
TestAffineLoopUnswitching() = default;
TestAffineLoopUnswitching(const TestAffineLoopUnswitching &pass) {}
namespace mlir {
void registerTestAffineLoopUnswitchingPass() {
- PassRegistration<TestAffineLoopUnswitching>(
- PASS_NAME, "Tests affine loop unswitching / if/else hoisting");
+ PassRegistration<TestAffineLoopUnswitching>();
}
} // namespace mlir
/// This pass applies the permutation on the first maximal perfect nest.
struct TestLoopPermutation
: public PassWrapper<TestLoopPermutation, FunctionPass> {
+ StringRef getArgument() const final { return PASS_NAME; }
+ StringRef getDescription() const final {
+ return "Tests affine loop permutation utility";
+ }
TestLoopPermutation() = default;
TestLoopPermutation(const TestLoopPermutation &pass){};
namespace mlir {
void registerTestLoopPermutationPass() {
- PassRegistration<TestLoopPermutation>(
- PASS_NAME, "Tests affine loop permutation utility");
+ PassRegistration<TestLoopPermutation>();
}
} // namespace mlir
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<vector::VectorDialect>();
}
+ StringRef getArgument() const final { return "affine-super-vectorizer-test"; }
+ StringRef getDescription() const final {
+ return "Tests vectorizer standalone functionality.";
+ }
void runOnFunction() override;
void testVectorShapeRatio(llvm::raw_ostream &outs);
}
namespace mlir {
-void registerVectorizerTestPass() {
- PassRegistration<VectorizerTestPass> pass(
- "affine-super-vectorizer-test",
- "Tests vectorizer standalone functionality.");
-}
+void registerVectorizerTestPass() { PassRegistration<VectorizerTestPass>(); }
} // namespace mlir
/// result types.
struct TestDataLayoutQuery
: public PassWrapper<TestDataLayoutQuery, FunctionPass> {
+ StringRef getArgument() const final { return "test-data-layout-query"; }
+ StringRef getDescription() const final { return "Test data layout queries"; }
void runOnFunction() override {
FuncOp func = getFunction();
Builder builder(func.getContext());
namespace mlir {
namespace test {
-void registerTestDataLayoutQuery() {
- PassRegistration<TestDataLayoutQuery>("test-data-layout-query",
- "Test data layout queries");
-}
+void registerTestDataLayoutQuery() { PassRegistration<TestDataLayoutQuery>(); }
} // namespace test
} // namespace mlir
class TestSerializeToCubinPass
: public PassWrapper<TestSerializeToCubinPass, gpu::SerializeToBlobPass> {
public:
+ StringRef getArgument() const final { return "test-gpu-to-cubin"; }
+ StringRef getDescription() const final {
+ return "Lower GPU kernel function to CUBIN binary annotations";
+ }
TestSerializeToCubinPass();
private:
namespace test {
// Register test pass to serialize GPU module to a CUBIN binary annotation.
void registerTestGpuSerializeToCubinPass() {
- PassRegistration<TestSerializeToCubinPass> registerSerializeToCubin(
- "test-gpu-to-cubin",
- "Lower GPU kernel function to CUBIN binary annotations", [] {
- // Initialize LLVM NVPTX backend.
- LLVMInitializeNVPTXTarget();
- LLVMInitializeNVPTXTargetInfo();
- LLVMInitializeNVPTXTargetMC();
- LLVMInitializeNVPTXAsmPrinter();
+ PassRegistration<TestSerializeToCubinPass>([] {
+ // Initialize LLVM NVPTX backend.
+ LLVMInitializeNVPTXTarget();
+ LLVMInitializeNVPTXTargetInfo();
+ LLVMInitializeNVPTXTargetMC();
+ LLVMInitializeNVPTXAsmPrinter();
- return std::make_unique<TestSerializeToCubinPass>();
- });
+ return std::make_unique<TestSerializeToCubinPass>();
+ });
}
} // namespace test
} // namespace mlir
class TestSerializeToHsacoPass
: public PassWrapper<TestSerializeToHsacoPass, gpu::SerializeToBlobPass> {
public:
+ StringRef getArgument() const final { return "test-gpu-to-hsaco"; }
+ StringRef getDescription() const final {
+ return "Lower GPU kernel function to HSAco binary annotations";
+ }
TestSerializeToHsacoPass();
private:
namespace test {
// Register test pass to serialize GPU module to a HSAco binary annotation.
void registerTestGpuSerializeToHsacoPass() {
- PassRegistration<TestSerializeToHsacoPass> registerSerializeToHsaco(
- "test-gpu-to-hsaco",
- "Lower GPU kernel function to HSAco binary annotations", [] {
- // Initialize LLVM AMDGPU backend.
- LLVMInitializeAMDGPUTarget();
- LLVMInitializeAMDGPUTargetInfo();
- LLVMInitializeAMDGPUTargetMC();
- LLVMInitializeAMDGPUAsmPrinter();
+ PassRegistration<TestSerializeToHsacoPass>([] {
+ // Initialize LLVM AMDGPU backend.
+ LLVMInitializeAMDGPUTarget();
+ LLVMInitializeAMDGPUTargetInfo();
+ LLVMInitializeAMDGPUTargetMC();
+ LLVMInitializeAMDGPUAsmPrinter();
- return std::make_unique<TestSerializeToHsacoPass>();
- });
+ return std::make_unique<TestSerializeToHsacoPass>();
+ });
}
} // namespace test
} // namespace mlir
registry.insert<AffineDialect, memref::MemRefDialect, StandardOpsDialect,
scf::SCFDialect>();
}
+ StringRef getArgument() const final { return "test-gpu-memory-promotion"; }
+ StringRef getDescription() const final {
+ return "Promotes the annotated arguments of gpu.func to workgroup memory.";
+ }
void runOnOperation() override {
gpu::GPUFuncOp op = getOperation();
namespace mlir {
void registerTestGpuMemoryPromotionPass() {
- PassRegistration<TestGpuMemoryPromotionPass>(
- "test-gpu-memory-promotion",
- "Promotes the annotated arguments of gpu.func to workgroup memory.");
+ PassRegistration<TestGpuMemoryPromotionPass>();
}
} // namespace mlir
class TestGpuGreedyParallelLoopMappingPass
: public PassWrapper<TestGpuGreedyParallelLoopMappingPass,
OperationPass<FuncOp>> {
+ StringRef getArgument() const final {
+ return "test-gpu-greedy-parallel-loop-mapping";
+ }
+ StringRef getDescription() const final {
+ return "Greedily maps all parallel loops to gpu hardware ids.";
+ }
void runOnOperation() override {
Operation *op = getOperation();
for (Region ®ion : op->getRegions())
namespace mlir {
namespace test {
void registerTestGpuParallelLoopMappingPass() {
- PassRegistration<TestGpuGreedyParallelLoopMappingPass> registration(
- "test-gpu-greedy-parallel-loop-mapping",
- "Greedily maps all parallel loops to gpu hardware ids.");
+ PassRegistration<TestGpuGreedyParallelLoopMappingPass>();
}
} // namespace test
} // namespace mlir
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<StandardOpsDialect, memref::MemRefDialect>();
}
+ StringRef getArgument() const final { return "test-gpu-rewrite"; }
+ StringRef getDescription() const final {
+ return "Applies all rewrite patterns within the GPU dialect.";
+ }
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
populateGpuRewritePatterns(patterns);
namespace mlir {
void registerTestAllReduceLoweringPass() {
- PassRegistration<TestGpuRewritePass> pass(
- "test-gpu-rewrite",
- "Applies all rewrite patterns within the GPU dialect.");
+ PassRegistration<TestGpuRewritePass>();
}
} // namespace mlir
class TestConvVectorization
: public PassWrapper<TestConvVectorization, OperationPass<ModuleOp>> {
public:
+ StringRef getArgument() const final { return "test-conv-vectorization"; }
+ StringRef getDescription() const final {
+ return "Test vectorization of convolutions";
+ }
TestConvVectorization() = default;
TestConvVectorization(const TestConvVectorization &) {}
explicit TestConvVectorization(ArrayRef<int64_t> tileSizesParam) {
namespace mlir {
namespace test {
void registerTestConvVectorization() {
- PassRegistration<TestConvVectorization> testTransformPatternsPass(
- "test-conv-vectorization", "Test vectorization of convolutions");
+ PassRegistration<TestConvVectorization>();
}
} // namespace test
} // namespace mlir
namespace {
struct TestLinalgCodegenStrategy
: public PassWrapper<TestLinalgCodegenStrategy, FunctionPass> {
+ StringRef getArgument() const final { return "test-linalg-codegen-strategy"; }
+ StringRef getDescription() const final {
+ return "Test Linalg Codegen Strategy.";
+ }
TestLinalgCodegenStrategy() = default;
TestLinalgCodegenStrategy(const TestLinalgCodegenStrategy &pass) {}
namespace mlir {
namespace test {
void registerTestLinalgCodegenStrategy() {
- PassRegistration<TestLinalgCodegenStrategy> testLinalgCodegenStrategyPass(
- "test-linalg-codegen-strategy", "Test Linalg Codegen Strategy.");
+ PassRegistration<TestLinalgCodegenStrategy>();
}
} // namespace test
} // namespace mlir
namespace {
struct TestLinalgDistribution
: public PassWrapper<TestLinalgDistribution, FunctionPass> {
+ StringRef getArgument() const final { return "test-linalg-distribution"; }
+ StringRef getDescription() const final { return "Test Linalg distribution."; }
TestLinalgDistribution() = default;
TestLinalgDistribution(const TestLinalgDistribution &pass) {}
void getDependentDialects(DialectRegistry ®istry) const override {
namespace mlir {
namespace test {
void registerTestLinalgDistribution() {
- PassRegistration<TestLinalgDistribution> testTestLinalgDistributionPass(
- "test-linalg-distribution", "Test Linalg distribution.");
+ PassRegistration<TestLinalgDistribution>();
}
} // namespace test
} // namespace mlir
registry.insert<AffineDialect, linalg::LinalgDialect, memref::MemRefDialect,
tensor::TensorDialect>();
}
+ StringRef getArgument() const final {
+ return "test-linalg-elementwise-fusion-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test Linalg element wise operation fusion patterns";
+ }
void runOnFunction() override {
MLIRContext *context = &this->getContext();
registry
.insert<AffineDialect, linalg::LinalgDialect, tensor::TensorDialect>();
}
+ StringRef getArgument() const final { return "test-linalg-push-reshape"; }
+ StringRef getDescription() const final {
+ return "Test Linalg reshape push patterns";
+ }
void runOnFunction() override {
MLIRContext *context = &this->getContext();
namespace test {
void registerTestLinalgElementwiseFusion() {
- PassRegistration<TestLinalgElementwiseFusion> testElementwiseFusionPass(
- "test-linalg-elementwise-fusion-patterns",
- "Test Linalg element wise operation fusion patterns");
+ PassRegistration<TestLinalgElementwiseFusion>();
}
void registerTestPushExpandingReshape() {
- PassRegistration<TestPushExpandingReshape> testPushExpandingReshapePass(
- "test-linalg-push-reshape", "Test Linalg reshape push patterns");
+ PassRegistration<TestPushExpandingReshape>();
}
} // namespace test
}
namespace {
-template <LinalgTilingLoopType LoopType = LinalgTilingLoopType::ParallelLoops>
+template <LinalgTilingLoopType LoopType>
struct TestLinalgFusionTransforms
: public PassWrapper<TestLinalgFusionTransforms<LoopType>, FunctionPass> {
- TestLinalgFusionTransforms() = default;
- TestLinalgFusionTransforms(const TestLinalgFusionTransforms &pass) {}
-
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<AffineDialect, linalg::LinalgDialect, memref::MemRefDialect,
scf::SCFDialect, StandardOpsDialect>();
}
+ TestLinalgFusionTransforms() = default;
+ TestLinalgFusionTransforms(const TestLinalgFusionTransforms &pass) {}
void runOnFunction() override {
MLIRContext *context = &this->getContext();
(void)applyPatternsAndFoldGreedily(funcOp, std::move(fusionPatterns));
}
};
+
+struct TestLinalgFusionTransformsParallelLoops
+ : public TestLinalgFusionTransforms<LinalgTilingLoopType::ParallelLoops> {
+ StringRef getArgument() const final {
+ return "test-linalg-fusion-transform-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test Linalg fusion transformation patterns by applying them "
+ "greedily.";
+ }
+};
+
+struct TestLinalgFusionTransformsLoops
+ : public TestLinalgFusionTransforms<LinalgTilingLoopType::Loops> {
+ StringRef getArgument() const final {
+ return "test-linalg-tensor-fusion-transform-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test Linalg on tensor fusion transformation "
+ "patterns by applying them greedily.";
+ }
+};
+
+struct TestLinalgFusionTransformsTiledLoops
+ : public TestLinalgFusionTransforms<LinalgTilingLoopType::TiledLoops> {
+ StringRef getArgument() const final {
+ return "test-linalg-tiled-loop-fusion-transform-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test Linalg on tensor fusion transformation "
+ "patterns by applying them greedily.";
+ }
+};
} // namespace
static LogicalResult fuseLinalgOpsGreedily(FuncOp f) {
registry.insert<AffineDialect, linalg::LinalgDialect, memref::MemRefDialect,
scf::SCFDialect>();
}
+ StringRef getArgument() const final { return "test-linalg-greedy-fusion"; }
+ StringRef getDescription() const final {
+ return "Test Linalg fusion by applying a greedy test transformation.";
+ }
void runOnFunction() override {
MLIRContext *context = &getContext();
RewritePatternSet patterns =
/// testing.
struct TestLinalgTileAndFuseSequencePass
: public PassWrapper<TestLinalgTileAndFuseSequencePass, FunctionPass> {
+ StringRef getArgument() const final { return "test-linalg-tile-and-fuse"; }
+ StringRef getDescription() const final {
+ return "Test Linalg tiling and fusion of a sequence of Linalg operations.";
+ }
TestLinalgTileAndFuseSequencePass() = default;
TestLinalgTileAndFuseSequencePass(
const TestLinalgTileAndFuseSequencePass &pass){};
op.erase();
}
};
+
} // namespace
namespace mlir {
namespace test {
void registerTestLinalgFusionTransforms() {
- PassRegistration<TestLinalgFusionTransforms<>> testFusionTransformsPass(
- "test-linalg-fusion-transform-patterns",
- "Test Linalg fusion transformation patterns by applying them greedily.");
+ PassRegistration<TestLinalgFusionTransformsParallelLoops>();
}
void registerTestLinalgTensorFusionTransforms() {
- PassRegistration<TestLinalgFusionTransforms<LinalgTilingLoopType::Loops>>
- testTensorFusionTransformsPass(
- "test-linalg-tensor-fusion-transform-patterns",
- "Test Linalg on tensor fusion transformation "
- "patterns by applying them greedily.");
+ PassRegistration<TestLinalgFusionTransformsLoops>();
}
void registerTestLinalgTiledLoopFusionTransforms() {
- PassRegistration<TestLinalgFusionTransforms<LinalgTilingLoopType::TiledLoops>>
- testTiledLoopFusionTransformsPass(
- "test-linalg-tiled-loop-fusion-transform-patterns",
- "Test Linalg on tensor fusion transformation "
- "patterns by applying them greedily.");
+ PassRegistration<TestLinalgFusionTransformsTiledLoops>();
}
void registerTestLinalgGreedyFusion() {
- PassRegistration<TestLinalgGreedyFusion> testFusionTransformsPass(
- "test-linalg-greedy-fusion",
- "Test Linalg fusion by applying a greedy test transformation.");
+ PassRegistration<TestLinalgGreedyFusion>();
}
void registerTestLinalgTileAndFuseSequencePass() {
- PassRegistration<TestLinalgTileAndFuseSequencePass>
- testTileAndFuseSequencePass(
- "test-linalg-tile-and-fuse",
- "Test Linalg tiling and fusion of a sequence of Linalg operations.");
+ PassRegistration<TestLinalgTileAndFuseSequencePass>();
}
} // namespace test
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<AffineDialect>();
}
+ StringRef getArgument() const final { return "test-linalg-hoisting"; }
+ StringRef getDescription() const final {
+ return "Test Linalg hoisting functions.";
+ }
void runOnFunction() override;
namespace mlir {
namespace test {
-void registerTestLinalgHoisting() {
- PassRegistration<TestLinalgHoisting> testTestLinalgHoistingPass(
- "test-linalg-hoisting", "Test Linalg hoisting functions.");
-}
+void registerTestLinalgHoisting() { PassRegistration<TestLinalgHoisting>(); }
} // namespace test
} // namespace mlir
gpu::GPUDialect>();
// clang-format on
}
+ StringRef getArgument() const final {
+ return "test-linalg-transform-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test Linalg transformation patterns by applying them greedily.";
+ }
void runOnFunction() override;
namespace mlir {
namespace test {
void registerTestLinalgTransforms() {
- PassRegistration<TestLinalgTransforms> testTransformPatternsPass(
- "test-linalg-transform-patterns",
- "Test Linalg transformation patterns by applying them greedily.");
+ PassRegistration<TestLinalgTransforms>();
}
} // namespace test
} // namespace mlir
struct TestExpandTanhPass
: public PassWrapper<TestExpandTanhPass, FunctionPass> {
void runOnFunction() override;
+ StringRef getArgument() const final { return "test-expand-tanh"; }
+ StringRef getDescription() const final { return "Test expanding tanh"; }
};
} // end anonymous namespace
namespace mlir {
namespace test {
-void registerTestExpandTanhPass() {
- PassRegistration<TestExpandTanhPass> pass("test-expand-tanh",
- "Test expanding tanh");
-}
+void registerTestExpandTanhPass() { PassRegistration<TestExpandTanhPass>(); }
} // namespace test
} // namespace mlir
registry
.insert<vector::VectorDialect, math::MathDialect, LLVM::LLVMDialect>();
}
+ StringRef getArgument() const final {
+ return "test-math-polynomial-approximation";
+ }
+ StringRef getDescription() const final {
+ return "Test math polynomial approximations";
+ }
};
} // end anonymous namespace
namespace mlir {
namespace test {
void registerTestMathPolynomialApproximationPass() {
- PassRegistration<TestMathPolynomialApproximationPass> pass(
- "test-math-polynomial-approximation",
- "Test math polynomial approximations");
+ PassRegistration<TestMathPolynomialApproximationPass>();
}
} // namespace test
} // namespace mlir
class TestSCFForUtilsPass
: public PassWrapper<TestSCFForUtilsPass, FunctionPass> {
public:
- explicit TestSCFForUtilsPass() {}
+ StringRef getArgument() const final { return "test-scf-for-utils"; }
+ StringRef getDescription() const final { return "test scf.for utils"; }
+ explicit TestSCFForUtilsPass() = default;
void runOnFunction() override {
FuncOp func = getFunction();
class TestSCFIfUtilsPass
: public PassWrapper<TestSCFIfUtilsPass, FunctionPass> {
public:
- explicit TestSCFIfUtilsPass() {}
+ StringRef getArgument() const final { return "test-scf-if-utils"; }
+ StringRef getDescription() const final { return "test scf.if utils"; }
+ explicit TestSCFIfUtilsPass() = default;
void runOnFunction() override {
int count = 0;
namespace mlir {
namespace test {
void registerTestSCFUtilsPass() {
- PassRegistration<TestSCFForUtilsPass>("test-scf-for-utils",
- "test scf.for utils");
- PassRegistration<TestSCFIfUtilsPass>("test-scf-if-utils",
- "test scf.if utils");
+ PassRegistration<TestSCFForUtilsPass>();
+ PassRegistration<TestSCFIfUtilsPass>();
}
} // namespace test
} // namespace mlir
struct PrintOpAvailability
: public PassWrapper<PrintOpAvailability, FunctionPass> {
void runOnFunction() override;
+ StringRef getArgument() const final { return "test-spirv-op-availability"; }
+ StringRef getDescription() const final {
+ return "Test SPIR-V op availability";
+ }
};
} // end anonymous namespace
namespace mlir {
void registerPrintOpAvailabilityPass() {
- PassRegistration<PrintOpAvailability> printOpAvailabilityPass(
- "test-spirv-op-availability", "Test SPIR-V op availability");
+ PassRegistration<PrintOpAvailability>();
}
} // namespace mlir
/// A pass for testing SPIR-V op availability.
struct ConvertToTargetEnv
: public PassWrapper<ConvertToTargetEnv, FunctionPass> {
+ StringRef getArgument() const override { return "test-spirv-target-env"; }
+ StringRef getDescription() const override {
+ return "Test SPIR-V target environment";
+ }
void runOnFunction() override;
};
namespace mlir {
void registerConvertToTargetEnvPass() {
- PassRegistration<ConvertToTargetEnv> convertToTargetEnvPass(
- "test-spirv-target-env", "Test SPIR-V target environment");
+ PassRegistration<ConvertToTargetEnv>();
}
} // namespace mlir
: public PassWrapper<TestSpirvEntryPointABIPass,
OperationPass<gpu::GPUModuleOp>> {
public:
+ StringRef getArgument() const final { return "test-spirv-entry-point-abi"; }
+ StringRef getDescription() const final {
+ return "Set the spv.entry_point_abi attribute on GPU kernel function "
+ "within the "
+ "module, intended for testing only";
+ }
TestSpirvEntryPointABIPass() = default;
TestSpirvEntryPointABIPass(const TestSpirvEntryPointABIPass &) {}
void runOnOperation() override;
namespace mlir {
void registerTestSpirvEntryPointABIPass() {
- PassRegistration<TestSpirvEntryPointABIPass> registration(
- "test-spirv-entry-point-abi",
- "Set the spv.entry_point_abi attribute on GPU kernel function within the "
- "module, intended for testing only");
+ PassRegistration<TestSpirvEntryPointABIPass>();
}
} // namespace mlir
TestGLSLCanonicalizationPass() = default;
TestGLSLCanonicalizationPass(const TestGLSLCanonicalizationPass &) {}
void runOnOperation() override;
+ StringRef getArgument() const final {
+ return "test-spirv-glsl-canonicalization";
+ }
+ StringRef getDescription() const final {
+ return "Tests SPIR-V canonicalization patterns for GLSL extension.";
+ }
};
} // namespace
namespace mlir {
void registerTestSpirvGLSLCanonicalizationPass() {
- PassRegistration<TestGLSLCanonicalizationPass> registration(
- "test-spirv-glsl-canonicalization",
- "Tests SPIR-V canonicalization patterns for GLSL extension.");
+ PassRegistration<TestGLSLCanonicalizationPass>();
}
} // namespace mlir
: public PassWrapper<TestModuleCombinerPass,
OperationPass<mlir::ModuleOp>> {
public:
+ StringRef getArgument() const final { return "test-spirv-module-combiner"; }
+ StringRef getDescription() const final {
+ return "Tests SPIR-V module combiner library";
+ }
TestModuleCombinerPass() = default;
TestModuleCombinerPass(const TestModuleCombinerPass &) {}
void runOnOperation() override;
namespace mlir {
void registerTestSpirvModuleCombinerPass() {
- PassRegistration<TestModuleCombinerPass> registration(
- "test-spirv-module-combiner", "Tests SPIR-V module combiner library");
+ PassRegistration<TestModuleCombinerPass>();
}
} // namespace mlir
struct ReportShapeFnPass
: public PassWrapper<ReportShapeFnPass, OperationPass<ModuleOp>> {
void runOnOperation() override;
+ StringRef getArgument() const final { return "test-shape-function-report"; }
+ StringRef getDescription() const final {
+ return "Test pass to report associated shape functions";
+ }
};
} // end anonymous namespace
namespace mlir {
void registerShapeFunctionTestPasses() {
- PassRegistration<ReportShapeFnPass>(
- "test-shape-function-report",
- "Test pass to report associated shape functions");
+ PassRegistration<ReportShapeFnPass>();
}
} // namespace mlir
namespace {
struct TestComposeSubViewPass
: public PassWrapper<TestComposeSubViewPass, FunctionPass> {
+ StringRef getArgument() const final { return "test-compose-subview"; }
+ StringRef getDescription() const final {
+ return "Test combining composed subviews";
+ }
void runOnFunction() override;
void getDependentDialects(DialectRegistry ®istry) const override;
};
namespace mlir {
namespace test {
void registerTestComposeSubView() {
- PassRegistration<TestComposeSubViewPass> pass(
- "test-compose-subview", "Test combining composed subviews");
+ PassRegistration<TestComposeSubViewPass>();
}
} // namespace test
} // namespace mlir
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<test::TestDialect>();
}
+ StringRef getArgument() const final {
+ return "test-decompose-call-graph-types";
+ }
+ StringRef getDescription() const final {
+ return "Decomposes types at call graph boundaries.";
+ }
void runOnOperation() override {
ModuleOp module = getOperation();
auto *context = &getContext();
namespace mlir {
namespace test {
void registerTestDecomposeCallGraphTypes() {
- PassRegistration<TestDecomposeCallGraphTypes> pass(
- "test-decompose-call-graph-types",
- "Decomposes types at call graph boundaries.");
+ PassRegistration<TestDecomposeCallGraphTypes>();
}
} // namespace test
} // namespace mlir
};
struct TestPatternDriver : public PassWrapper<TestPatternDriver, FunctionPass> {
+ StringRef getArgument() const final { return "test-patterns"; }
+ StringRef getDescription() const final { return "Run test dialect patterns"; }
void runOnFunction() override {
mlir::RewritePatternSet patterns(&getContext());
populateWithGenerated(patterns);
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
}
+ StringRef getArgument() const final { return "test-return-type"; }
+ StringRef getDescription() const final { return "Run return type functions"; }
void runOnFunction() override {
if (getFunction().getName() == "testCreateFunctions") {
namespace {
struct TestDerivedAttributeDriver
: public PassWrapper<TestDerivedAttributeDriver, FunctionPass> {
+ StringRef getArgument() const final { return "test-derived-attr"; }
+ StringRef getDescription() const final {
+ return "Run test derived attributes";
+ }
void runOnFunction() override;
};
} // end anonymous namespace
struct TestLegalizePatternDriver
: public PassWrapper<TestLegalizePatternDriver, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-legalize-patterns"; }
+ StringRef getDescription() const final {
+ return "Run test dialect legalization patterns";
+ }
/// The mode of conversion to use with the driver.
enum class ConversionMode { Analysis, Full, Partial };
struct TestRemappedValue
: public mlir::PassWrapper<TestRemappedValue, FunctionPass> {
+ StringRef getArgument() const final { return "test-remapped-value"; }
+ StringRef getDescription() const final {
+ return "Test public remapped value mechanism in ConversionPatternRewriter";
+ }
void runOnFunction() override {
mlir::RewritePatternSet patterns(&getContext());
patterns.add<OneVResOneVOperandOp1Converter>(&getContext());
struct TestUnknownRootOpDriver
: public mlir::PassWrapper<TestUnknownRootOpDriver, FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-legalize-unknown-root-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test public remapped value mechanism in ConversionPatternRewriter";
+ }
void runOnFunction() override {
mlir::RewritePatternSet patterns(&getContext());
patterns.add<RemoveTestDialectOps>(&getContext());
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<TestDialect>();
}
+ StringRef getArgument() const final {
+ return "test-legalize-type-conversion";
+ }
+ StringRef getDescription() const final {
+ return "Test various type conversion functionalities in DialectConversion";
+ }
void runOnOperation() override {
// Initialize the type converter.
struct TestMergeBlocksPatternDriver
: public PassWrapper<TestMergeBlocksPatternDriver,
OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-merge-blocks"; }
+ StringRef getDescription() const final {
+ return "Test Merging operation in ConversionPatternRewriter";
+ }
void runOnOperation() override {
MLIRContext *context = &getContext();
mlir::RewritePatternSet patterns(context);
struct TestSelectiveReplacementPatternDriver
: public PassWrapper<TestSelectiveReplacementPatternDriver,
OperationPass<>> {
+ StringRef getArgument() const final {
+ return "test-pattern-selective-replacement";
+ }
+ StringRef getDescription() const final {
+ return "Test selective replacement in the PatternRewriter";
+ }
void runOnOperation() override {
MLIRContext *context = &getContext();
mlir::RewritePatternSet patterns(context);
namespace mlir {
namespace test {
void registerPatternsTestPass() {
- PassRegistration<TestReturnTypeDriver>("test-return-type",
- "Run return type functions");
+ PassRegistration<TestReturnTypeDriver>();
- PassRegistration<TestDerivedAttributeDriver>("test-derived-attr",
- "Run test derived attributes");
+ PassRegistration<TestDerivedAttributeDriver>();
- PassRegistration<TestPatternDriver>("test-patterns",
- "Run test dialect patterns");
+ PassRegistration<TestPatternDriver>();
- PassRegistration<TestLegalizePatternDriver>(
- "test-legalize-patterns", "Run test dialect legalization patterns", [] {
- return std::make_unique<TestLegalizePatternDriver>(
- legalizerConversionMode);
- });
+ PassRegistration<TestLegalizePatternDriver>([] {
+ return std::make_unique<TestLegalizePatternDriver>(legalizerConversionMode);
+ });
- PassRegistration<TestRemappedValue>(
- "test-remapped-value",
- "Test public remapped value mechanism in ConversionPatternRewriter");
+ PassRegistration<TestRemappedValue>();
- PassRegistration<TestUnknownRootOpDriver>(
- "test-legalize-unknown-root-patterns",
- "Test public remapped value mechanism in ConversionPatternRewriter");
+ PassRegistration<TestUnknownRootOpDriver>();
- PassRegistration<TestTypeConversionDriver>(
- "test-legalize-type-conversion",
- "Test various type conversion functionalities in DialectConversion");
+ PassRegistration<TestTypeConversionDriver>();
- PassRegistration<TestMergeBlocksPatternDriver>{
- "test-merge-blocks",
- "Test Merging operation in ConversionPatternRewriter"};
- PassRegistration<TestSelectiveReplacementPatternDriver>{
- "test-pattern-selective-replacement",
- "Test selective replacement in the PatternRewriter"};
+ PassRegistration<TestMergeBlocksPatternDriver>();
+ PassRegistration<TestSelectiveReplacementPatternDriver>();
}
} // namespace test
} // namespace mlir
namespace {
struct TestTraitFolder : public PassWrapper<TestTraitFolder, FunctionPass> {
+ StringRef getArgument() const final { return "test-trait-folder"; }
+ StringRef getDescription() const final { return "Run trait folding"; }
void runOnFunction() override {
(void)applyPatternsAndFoldGreedily(getFunction(),
RewritePatternSet(&getContext()));
} // end anonymous namespace
namespace mlir {
-void registerTestTraitsPass() {
- PassRegistration<TestTraitFolder>("test-trait-folder", "Run trait folding");
-}
+void registerTestTraitsPass() { PassRegistration<TestTraitFolder>(); }
} // namespace mlir
struct TosaTestQuantUtilAPI
: public PassWrapper<TosaTestQuantUtilAPI, FunctionPass> {
+ StringRef getArgument() const final { return PASS_NAME; }
+ StringRef getDescription() const final {
+ return "TOSA Test: Exercise the APIs in QuantUtils.cpp.";
+ }
void runOnFunction() override;
};
namespace mlir {
void registerTosaTestQuantUtilAPIPass() {
- PassRegistration<TosaTestQuantUtilAPI>(
- PASS_NAME, "TOSA Test: Exercise the APIs in QuantUtils.cpp.");
+ PassRegistration<TosaTestQuantUtilAPI>();
}
} // namespace mlir
: public PassWrapper<TestVectorToVectorConversion, FunctionPass> {
TestVectorToVectorConversion() = default;
TestVectorToVectorConversion(const TestVectorToVectorConversion &pass) {}
+ StringRef getArgument() const final {
+ return "test-vector-to-vector-conversion";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns between ops in the vector dialect";
+ }
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<AffineDialect>();
struct TestVectorSlicesConversion
: public PassWrapper<TestVectorSlicesConversion, FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-vector-slices-conversion";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns that lower slices ops in the vector "
+ "dialect";
+ }
void runOnFunction() override {
RewritePatternSet patterns(&getContext());
populateVectorSlicesLoweringPatterns(patterns);
struct TestVectorContractionConversion
: public PassWrapper<TestVectorContractionConversion, FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-vector-contraction-conversion";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns that lower contract ops in the vector "
+ "dialect";
+ }
TestVectorContractionConversion() = default;
TestVectorContractionConversion(const TestVectorContractionConversion &pass) {
}
struct TestVectorUnrollingPatterns
: public PassWrapper<TestVectorUnrollingPatterns, FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-vector-unrolling-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns to unroll contract ops in the vector "
+ "dialect";
+ }
TestVectorUnrollingPatterns() = default;
TestVectorUnrollingPatterns(const TestVectorUnrollingPatterns &pass) {}
void runOnFunction() override {
struct TestVectorDistributePatterns
: public PassWrapper<TestVectorDistributePatterns, FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-vector-distribute-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns to distribute vector ops in the vector "
+ "dialect";
+ }
TestVectorDistributePatterns() = default;
TestVectorDistributePatterns(const TestVectorDistributePatterns &pass) {}
void getDependentDialects(DialectRegistry ®istry) const override {
struct TestVectorToLoopPatterns
: public PassWrapper<TestVectorToLoopPatterns, FunctionPass> {
+ StringRef getArgument() const final { return "test-vector-to-forloop"; }
+ StringRef getDescription() const final {
+ return "Test conversion patterns to break up a vector op into a for loop";
+ }
TestVectorToLoopPatterns() = default;
TestVectorToLoopPatterns(const TestVectorToLoopPatterns &pass) {}
void getDependentDialects(DialectRegistry ®istry) const override {
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<AffineDialect>();
}
+ StringRef getArgument() const final {
+ return "test-vector-transfer-unrolling-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns to unroll transfer ops in the vector "
+ "dialect";
+ }
void runOnFunction() override {
MLIRContext *ctx = &getContext();
RewritePatternSet patterns(ctx);
struct TestVectorTransferFullPartialSplitPatterns
: public PassWrapper<TestVectorTransferFullPartialSplitPatterns,
FunctionPass> {
+ StringRef getArgument() const final {
+ return "test-vector-transfer-full-partial-split";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns to split "
+ "transfer ops via scf.if + linalg ops";
+ }
TestVectorTransferFullPartialSplitPatterns() = default;
TestVectorTransferFullPartialSplitPatterns(
const TestVectorTransferFullPartialSplitPatterns &pass) {}
struct TestVectorTransferOpt
: public PassWrapper<TestVectorTransferOpt, FunctionPass> {
+ StringRef getArgument() const final { return "test-vector-transferop-opt"; }
+ StringRef getDescription() const final {
+ return "Test optimization transformations for transfer ops";
+ }
void runOnFunction() override { transferOpflowOpt(getFunction()); }
};
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
}
+ StringRef getArgument() const final {
+ return "test-vector-transfer-lowering-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns to lower transfer ops to other vector ops";
+ }
void runOnFunction() override {
RewritePatternSet patterns(&getContext());
populateVectorTransferLoweringPatterns(patterns);
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
}
+ StringRef getArgument() const final {
+ return "test-vector-multi-reduction-lowering-patterns";
+ }
+ StringRef getDescription() const final {
+ return "Test conversion patterns to lower vector.multi_reduction to other "
+ "vector ops";
+ }
void runOnFunction() override {
RewritePatternSet patterns(&getContext());
populateVectorMultiReductionLoweringPatterns(patterns);
namespace mlir {
namespace test {
void registerTestVectorConversions() {
- PassRegistration<TestVectorToVectorConversion> vectorToVectorPass(
- "test-vector-to-vector-conversion",
- "Test conversion patterns between ops in the vector dialect");
-
- PassRegistration<TestVectorSlicesConversion> slicesPass(
- "test-vector-slices-conversion",
- "Test conversion patterns that lower slices ops in the vector dialect");
-
- PassRegistration<TestVectorContractionConversion> contractionPass(
- "test-vector-contraction-conversion",
- "Test conversion patterns that lower contract ops in the vector dialect");
-
- PassRegistration<TestVectorUnrollingPatterns> contractionUnrollingPass(
- "test-vector-unrolling-patterns",
- "Test conversion patterns to unroll contract ops in the vector dialect");
-
- PassRegistration<TestVectorTransferUnrollingPatterns> transferOpUnrollingPass(
- "test-vector-transfer-unrolling-patterns",
- "Test conversion patterns to unroll transfer ops in the vector dialect");
-
- PassRegistration<TestVectorTransferFullPartialSplitPatterns>
- vectorTransformFullPartialPass("test-vector-transfer-full-partial-split",
- "Test conversion patterns to split "
- "transfer ops via scf.if + linalg ops");
-
- PassRegistration<TestVectorDistributePatterns> distributePass(
- "test-vector-distribute-patterns",
- "Test conversion patterns to distribute vector ops in the vector "
- "dialect");
-
- PassRegistration<TestVectorToLoopPatterns> vectorToForLoop(
- "test-vector-to-forloop",
- "Test conversion patterns to break up a vector op into a for loop");
-
- PassRegistration<TestVectorTransferOpt> transferOpOpt(
- "test-vector-transferop-opt",
- "Test optimization transformations for transfer ops");
-
- PassRegistration<TestVectorTransferLoweringPatterns> transferOpLoweringPass(
- "test-vector-transfer-lowering-patterns",
- "Test conversion patterns to lower transfer ops to other vector ops");
-
- PassRegistration<TestVectorMultiReductionLoweringPatterns>
- multiDimReductionOpLoweringPass(
- "test-vector-multi-reduction-lowering-patterns",
- "Test conversion patterns to lower vector.multi_reduction to other "
- "vector ops");
+ PassRegistration<TestVectorToVectorConversion>();
+
+ PassRegistration<TestVectorSlicesConversion>();
+
+ PassRegistration<TestVectorContractionConversion>();
+
+ PassRegistration<TestVectorUnrollingPatterns>();
+
+ PassRegistration<TestVectorTransferUnrollingPatterns>();
+
+ PassRegistration<TestVectorTransferFullPartialSplitPatterns>();
+
+ PassRegistration<TestVectorDistributePatterns>();
+
+ PassRegistration<TestVectorToLoopPatterns>();
+
+ PassRegistration<TestVectorTransferOpt>();
+
+ PassRegistration<TestVectorTransferLoweringPatterns>();
+
+ PassRegistration<TestVectorMultiReductionLoweringPatterns>();
}
} // namespace test
} // namespace mlir
};
struct TestDominancePass : public PassWrapper<TestDominancePass, FunctionPass> {
+ StringRef getArgument() const final { return "test-print-dominance"; }
+ StringRef getDescription() const final {
+ return "Print the dominance information for multiple regions.";
+ }
void runOnFunction() override {
llvm::errs() << "Testing : " << getFunction().getName() << "\n";
namespace mlir {
namespace test {
-void registerTestDominancePass() {
- PassRegistration<TestDominancePass>(
- "test-print-dominance",
- "Print the dominance information for multiple regions.");
-}
+void registerTestDominancePass() { PassRegistration<TestDominancePass>(); }
} // namespace test
} // namespace mlir
/// This is a test pass for verifying FuncOp's eraseArgument method.
struct TestFuncEraseArg
: public PassWrapper<TestFuncEraseArg, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-func-erase-arg"; }
+ StringRef getDescription() const final { return "Test erasing func args."; }
void runOnOperation() override {
auto module = getOperation();
/// This is a test pass for verifying FuncOp's eraseResult method.
struct TestFuncEraseResult
: public PassWrapper<TestFuncEraseResult, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-func-erase-result"; }
+ StringRef getDescription() const final {
+ return "Test erasing func results.";
+ }
void runOnOperation() override {
auto module = getOperation();
for (FuncOp func : module.getOps<FuncOp>()) {
SmallVector<unsigned, 4> indicesToErase;
for (auto resultIndex : llvm::seq<int>(0, func.getNumResults())) {
- if (func.getResultAttr(resultIndex, "test.erase_this_result")) {
- // Push back twice to test that duplicate indices are handled
- // correctly.
+ if (func.getResultAttr(resultIndex, "test.erase_this_"
+ "result")) {
+ // Push back twice to test
+ // that duplicate indices
+ // are handled correctly.
indicesToErase.push_back(resultIndex);
indicesToErase.push_back(resultIndex);
}
}
- // Reverse the order to test that unsorted index lists are handled
- // correctly.
+ // Reverse the order to test
+ // that unsorted index lists are
+ // handled correctly.
std::reverse(indicesToErase.begin(), indicesToErase.end());
func.eraseResults(indicesToErase);
}
/// This is a test pass for verifying FuncOp's setType method.
struct TestFuncSetType
: public PassWrapper<TestFuncSetType, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-func-set-type"; }
+ StringRef getDescription() const final { return "Test FuncOp::setType."; }
void runOnOperation() override {
auto module = getOperation();
SymbolTable symbolTable(module);
namespace mlir {
void registerTestFunc() {
- PassRegistration<TestFuncEraseArg>("test-func-erase-arg",
- "Test erasing func args.");
+ PassRegistration<TestFuncEraseArg>();
- PassRegistration<TestFuncEraseResult>("test-func-erase-result",
- "Test erasing func results.");
+ PassRegistration<TestFuncEraseResult>();
- PassRegistration<TestFuncSetType>("test-func-set-type",
- "Test FuncOp::setType.");
+ PassRegistration<TestFuncSetType>();
}
} // namespace mlir
/// application.
struct TestTypeInterfaces
: public PassWrapper<TestTypeInterfaces, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-type-interfaces"; }
+ StringRef getDescription() const final {
+ return "Test type interface support.";
+ }
void runOnOperation() override {
getOperation().walk([](Operation *op) {
for (Type type : op->getResultTypes()) {
namespace mlir {
namespace test {
-void registerTestInterfaces() {
- PassRegistration<TestTypeInterfaces> pass("test-type-interfaces",
- "Test type interface support.");
-}
+void registerTestInterfaces() { PassRegistration<TestTypeInterfaces>(); }
} // namespace test
} // namespace mlir
/// This is a test pass for verifying matchers.
struct TestMatchers : public PassWrapper<TestMatchers, FunctionPass> {
void runOnFunction() override;
+ StringRef getArgument() const final { return "test-matchers"; }
+ StringRef getDescription() const final {
+ return "Test C++ pattern matchers.";
+ }
};
} // end anonymous namespace
}
namespace mlir {
-void registerTestMatchers() {
- PassRegistration<TestMatchers>("test-matchers", "Test C++ pattern matchers.");
-}
+void registerTestMatchers() { PassRegistration<TestMatchers>(); }
} // namespace mlir
/// locations.
struct TestOpaqueLoc
: public PassWrapper<TestOpaqueLoc, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-opaque-loc"; }
+ StringRef getDescription() const final {
+ return "Changes all leaf locations to opaque locations";
+ }
/// A simple structure which is used for testing as an underlying location in
/// OpaqueLoc.
namespace mlir {
namespace test {
-void registerTestOpaqueLoc() {
- PassRegistration<TestOpaqueLoc> pass(
- "test-opaque-loc", "Changes all leaf locations to opaque locations");
-}
+void registerTestOpaqueLoc() { PassRegistration<TestOpaqueLoc>(); }
} // namespace test
} // namespace mlir
/// This pass illustrates the IR def-use chains through printing.
struct TestPrintDefUsePass
: public PassWrapper<TestPrintDefUsePass, OperationPass<>> {
+ StringRef getArgument() const final { return "test-print-defuse"; }
+ StringRef getDescription() const final { return "Test various printing."; }
void runOnOperation() override {
// Recursively traverse the IR nested under the current operation and print
// every single operation and their operands and users.
} // end anonymous namespace
namespace mlir {
-void registerTestPrintDefUsePass() {
- PassRegistration<TestPrintDefUsePass>("test-print-defuse",
- "Test various printing.");
-}
+void registerTestPrintDefUsePass() { PassRegistration<TestPrintDefUsePass>(); }
} // namespace mlir
/// This pass illustrates the IR nesting through printing.
struct TestPrintNestingPass
: public PassWrapper<TestPrintNestingPass, OperationPass<>> {
+ StringRef getArgument() const final { return "test-print-nesting"; }
+ StringRef getDescription() const final { return "Test various printing."; }
// Entry point for the pass.
void runOnOperation() override {
Operation *op = getOperation();
namespace mlir {
void registerTestPrintNestingPass() {
- PassRegistration<TestPrintNestingPass>("test-print-nesting",
- "Test various printing.");
+ PassRegistration<TestPrintNestingPass>();
}
} // namespace mlir
namespace {
struct SideEffectsPass
: public PassWrapper<SideEffectsPass, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-side-effects"; }
+ StringRef getDescription() const final {
+ return "Test side effects interfaces";
+ }
void runOnOperation() override {
auto module = getOperation();
} // end anonymous namespace
namespace mlir {
-void registerSideEffectTestPasses() {
- PassRegistration<SideEffectsPass>("test-side-effects",
- "Test side effects interfaces");
-}
+void registerSideEffectTestPasses() { PassRegistration<SideEffectsPass>(); }
} // namespace mlir
/// Pass to test slice generated from slice analysis.
struct SliceAnalysisTestPass
: public PassWrapper<SliceAnalysisTestPass, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "slice-analysis-test"; }
+ StringRef getDescription() const final {
+ return "Test Slice analysis functionality.";
+ }
void runOnOperation() override;
SliceAnalysisTestPass() = default;
SliceAnalysisTestPass(const SliceAnalysisTestPass &) {}
namespace mlir {
void registerSliceAnalysisTestPass() {
- PassRegistration<SliceAnalysisTestPass> pass(
- "slice-analysis-test", "Test Slice analysis functionality.");
+ PassRegistration<SliceAnalysisTestPass>();
}
} // namespace mlir
/// provided by the symbol table along with erasing from the symbol table.
struct SymbolUsesPass
: public PassWrapper<SymbolUsesPass, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-symbol-uses"; }
+ StringRef getDescription() const final {
+ return "Test detection of symbol uses";
+ }
WalkResult operateOnSymbol(Operation *symbol, ModuleOp module,
SmallVectorImpl<FuncOp> &deadFunctions) {
// Test computing uses on a non symboltable op.
/// functionality provided by the symbol table.
struct SymbolReplacementPass
: public PassWrapper<SymbolReplacementPass, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-symbol-rauw"; }
+ StringRef getDescription() const final {
+ return "Test replacement of symbol uses";
+ }
void runOnOperation() override {
ModuleOp module = getOperation();
namespace mlir {
void registerSymbolTestPasses() {
- PassRegistration<SymbolUsesPass>("test-symbol-uses",
- "Test detection of symbol uses");
+ PassRegistration<SymbolUsesPass>();
- PassRegistration<SymbolReplacementPass>("test-symbol-rauw",
- "Test replacement of symbol uses");
+ PassRegistration<SymbolReplacementPass>();
}
} // namespace mlir
: public PassWrapper<TestRecursiveTypesPass, FunctionPass> {
LogicalResult createIRWithTypes();
+ StringRef getArgument() const final { return "test-recursive-types"; }
+ StringRef getDescription() const final {
+ return "Test support for recursive types";
+ }
void runOnFunction() override {
FuncOp func = getFunction();
namespace test {
void registerTestRecursiveTypesPass() {
- PassRegistration<TestRecursiveTypesPass> reg(
- "test-recursive-types", "Test support for recursive types");
+ PassRegistration<TestRecursiveTypesPass>();
}
} // namespace test
/// This pass exercises the different configurations of the IR visitors.
struct TestIRVisitorsPass
: public PassWrapper<TestIRVisitorsPass, OperationPass<>> {
+ StringRef getArgument() const final { return "test-ir-visitors"; }
+ StringRef getDescription() const final { return "Test various visitors."; }
void runOnOperation() override {
Operation *op = getOperation();
testPureCallbacks(op);
namespace mlir {
namespace test {
-void registerTestIRVisitorsPass() {
- PassRegistration<TestIRVisitorsPass>("test-ir-visitors",
- "Test various visitors.");
-}
+void registerTestIRVisitorsPass() { PassRegistration<TestIRVisitorsPass>(); }
} // namespace test
} // namespace mlir
class TestDynamicPipelinePass
: public PassWrapper<TestDynamicPipelinePass, OperationPass<>> {
public:
+ StringRef getArgument() const final { return "test-dynamic-pipeline"; }
+ StringRef getDescription() const final {
+ return "Tests the dynamic pipeline feature by applying "
+ "a pipeline on a selected set of functions";
+ }
void getDependentDialects(DialectRegistry ®istry) const override {
OpPassManager pm(ModuleOp::getOperationName(),
OpPassManager::Nesting::Implicit);
namespace mlir {
namespace test {
void registerTestDynamicPipelinePass() {
- PassRegistration<TestDynamicPipelinePass>(
- "test-dynamic-pipeline", "Tests the dynamic pipeline feature by applying "
- "a pipeline on a selected set of functions");
+ PassRegistration<TestDynamicPipelinePass>();
}
} // namespace test
} // namespace mlir
: public PassWrapper<TestModulePass, OperationPass<ModuleOp>> {
void runOnOperation() final {}
StringRef getArgument() const final { return "test-module-pass"; }
+ StringRef getDescription() const final {
+ return "Test a module pass in the pass manager";
+ }
};
struct TestFunctionPass : public PassWrapper<TestFunctionPass, FunctionPass> {
void runOnFunction() final {}
StringRef getArgument() const final { return "test-function-pass"; }
+ StringRef getDescription() const final {
+ return "Test a function pass in the pass manager";
+ }
};
class TestOptionsPass : public PassWrapper<TestOptionsPass, FunctionPass> {
public:
void runOnFunction() final {}
StringRef getArgument() const final { return "test-options-pass"; }
+ StringRef getDescription() const final {
+ return "Test options parsing capabilities";
+ }
ListOption<int> listOption{*this, "list", llvm::cl::MiscFlags::CommaSeparated,
llvm::cl::desc("Example list option")};
: public PassWrapper<TestCrashRecoveryPass, OperationPass<>> {
void runOnOperation() final { abort(); }
StringRef getArgument() const final { return "test-pass-crash"; }
+ StringRef getDescription() const final {
+ return "Test a pass in the pass manager that always crashes";
+ }
};
/// A test pass that always fails to enable testing the failure recovery
/// mechanisms of the pass manager.
class TestFailurePass : public PassWrapper<TestFailurePass, OperationPass<>> {
void runOnOperation() final { signalPassFailure(); }
+ StringRef getArgument() const final { return "test-pass-failure"; }
+ StringRef getDescription() const final {
+ return "Test a pass in the pass manager that always fails";
+ }
};
/// A test pass that contains a statistic.
: public PassWrapper<TestStatisticPass, OperationPass<>> {
TestStatisticPass() = default;
TestStatisticPass(const TestStatisticPass &) {}
+ StringRef getArgument() const final { return "test-stats-pass"; }
+ StringRef getDescription() const final { return "Test pass statistics"; }
Statistic opCount{this, "num-ops", "Number of operations counted"};
namespace mlir {
void registerPassManagerTestPass() {
- PassRegistration<TestOptionsPass>("test-options-pass",
- "Test options parsing capabilities");
+ PassRegistration<TestOptionsPass>();
- PassRegistration<TestModulePass>("test-module-pass",
- "Test a module pass in the pass manager");
+ PassRegistration<TestModulePass>();
- PassRegistration<TestFunctionPass>(
- "test-function-pass", "Test a function pass in the pass manager");
+ PassRegistration<TestFunctionPass>();
- PassRegistration<TestCrashRecoveryPass>(
- "test-pass-crash", "Test a pass in the pass manager that always crashes");
- PassRegistration<TestFailurePass>(
- "test-pass-failure", "Test a pass in the pass manager that always fails");
+ PassRegistration<TestCrashRecoveryPass>();
+ PassRegistration<TestFailurePass>();
- PassRegistration<TestStatisticPass> unusedStatP("test-stats-pass",
- "Test pass statistics");
+ PassRegistration<TestStatisticPass>();
PassPipelineRegistration<>("test-pm-nested-pipeline",
"Test a nested pipeline in the pass manager",
/// "crashOp" in the input MLIR file and crashes the mlir-opt tool if the
/// operation is found.
struct TestReducer : public PassWrapper<TestReducer, FunctionPass> {
+ StringRef getArgument() const final { return PASS_NAME; }
+ StringRef getDescription() const final {
+ return "Tests MLIR Reduce tool by generating failures";
+ }
TestReducer() = default;
TestReducer(const TestReducer &pass){};
void runOnFunction() override;
}
namespace mlir {
-void registerTestReducer() {
- PassRegistration<TestReducer>(
- PASS_NAME, "Tests MLIR Reduce tool by generating failures");
-}
+void registerTestReducer() { PassRegistration<TestReducer>(); }
} // namespace mlir
namespace {
struct TestPDLByteCodePass
: public PassWrapper<TestPDLByteCodePass, OperationPass<ModuleOp>> {
+ StringRef getArgument() const final { return "test-pdl-bytecode-pass"; }
+ StringRef getDescription() const final {
+ return "Test PDL ByteCode functionality";
+ }
void runOnOperation() final {
ModuleOp module = getOperation();
namespace mlir {
namespace test {
-void registerTestPDLByteCodePass() {
- PassRegistration<TestPDLByteCodePass>("test-pdl-bytecode-pass",
- "Test PDL ByteCode functionality");
-}
+void registerTestPDLByteCodePass() { PassRegistration<TestPDLByteCodePass>(); }
} // namespace test
} // namespace mlir
namespace {
/// Simple constant folding pass.
struct TestConstantFold : public PassWrapper<TestConstantFold, FunctionPass> {
+ StringRef getArgument() const final { return "test-constant-fold"; }
+ StringRef getDescription() const final {
+ return "Test operation constant folding";
+ }
// All constants in the function post folding.
SmallVector<Operation *, 8> existingConstants;
namespace mlir {
namespace test {
-void registerTestConstantFold() {
- PassRegistration<TestConstantFold>("test-constant-fold",
- "Test operation constant folding");
-}
+void registerTestConstantFold() { PassRegistration<TestConstantFold>(); }
} // namespace test
} // namespace mlir
namespace {
struct Inliner : public PassWrapper<Inliner, FunctionPass> {
+ StringRef getArgument() const final { return "test-inline"; }
+ StringRef getDescription() const final {
+ return "Test inlining region calls";
+ }
+
void runOnFunction() override {
auto function = getFunction();
namespace mlir {
namespace test {
-void registerInliner() {
- PassRegistration<Inliner>("test-inline", "Test inlining region calls");
-}
+void registerInliner() { PassRegistration<Inliner>(); }
} // namespace test
} // namespace mlir
namespace {
struct TestLoopFusion : public PassWrapper<TestLoopFusion, FunctionPass> {
+ StringRef getArgument() const final { return "test-loop-fusion"; }
+ StringRef getDescription() const final {
+ return "Tests loop fusion utility functions.";
+ }
void runOnFunction() override;
};
namespace mlir {
namespace test {
-void registerTestLoopFusion() {
- PassRegistration<TestLoopFusion>("test-loop-fusion",
- "Tests loop fusion utility functions.");
-}
+void registerTestLoopFusion() { PassRegistration<TestLoopFusion>(); }
} // namespace test
} // namespace mlir
class TestLoopMappingPass
: public PassWrapper<TestLoopMappingPass, FunctionPass> {
public:
+ StringRef getArgument() const final {
+ return "test-mapping-to-processing-elements";
+ }
+ StringRef getDescription() const final {
+ return "test mapping a single loop on a virtual processor grid";
+ }
explicit TestLoopMappingPass() {}
void getDependentDialects(DialectRegistry ®istry) const override {
namespace mlir {
namespace test {
-void registerTestLoopMappingPass() {
- PassRegistration<TestLoopMappingPass>(
- "test-mapping-to-processing-elements",
- "test mapping a single loop on a virtual processor grid");
-}
+void registerTestLoopMappingPass() { PassRegistration<TestLoopMappingPass>(); }
} // namespace test
} // namespace mlir
class SimpleParametricLoopTilingPass
: public PassWrapper<SimpleParametricLoopTilingPass, FunctionPass> {
public:
+ StringRef getArgument() const final {
+ return "test-extract-fixed-outer-loops";
+ }
+ StringRef getDescription() const final {
+ return "test application of parametric tiling to the outer loops so that "
+ "the "
+ "ranges of outer loops become static";
+ }
SimpleParametricLoopTilingPass() = default;
SimpleParametricLoopTilingPass(const SimpleParametricLoopTilingPass &) {}
explicit SimpleParametricLoopTilingPass(ArrayRef<int64_t> outerLoopSizes) {
namespace mlir {
namespace test {
void registerSimpleParametricTilingPass() {
- PassRegistration<SimpleParametricLoopTilingPass>(
- "test-extract-fixed-outer-loops",
- "test application of parametric tiling to the outer loops so that the "
- "ranges of outer loops become static");
+ PassRegistration<SimpleParametricLoopTilingPass>();
}
} // namespace test
} // namespace mlir
class TestLoopUnrollingPass
: public PassWrapper<TestLoopUnrollingPass, FunctionPass> {
public:
+ StringRef getArgument() const final { return "test-loop-unrolling"; }
+ StringRef getDescription() const final {
+ return "Tests loop unrolling transformation";
+ }
TestLoopUnrollingPass() = default;
TestLoopUnrollingPass(const TestLoopUnrollingPass &) {}
explicit TestLoopUnrollingPass(uint64_t unrollFactorParam,
namespace mlir {
namespace test {
void registerTestLoopUnrollingPass() {
- PassRegistration<TestLoopUnrollingPass>(
- "test-loop-unrolling", "Tests loop unrolling transformation");
+ PassRegistration<TestLoopUnrollingPass>();
}
} // namespace test
} // namespace mlir