diff --git a/mlir/test/lib/Dialect/Test/TestDialect.h b/mlir/test/lib/Dialect/Test/TestDialect.h --- a/mlir/test/lib/Dialect/Test/TestDialect.h +++ b/mlir/test/lib/Dialect/Test/TestDialect.h @@ -38,7 +38,9 @@ #include "TestOps.h.inc" namespace mlir { +namespace test { void registerTestDialect(DialectRegistry ®istry); -} // end namespace mlir +} // namespace test +} // namespace mlir #endif // MLIR_TESTDIALECT_H diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp --- a/mlir/test/lib/Dialect/Test/TestDialect.cpp +++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp @@ -20,8 +20,9 @@ #include "llvm/ADT/StringSwitch.h" using namespace mlir; +using namespace mlir::test; -void mlir::registerTestDialect(DialectRegistry ®istry) { +void mlir::test::registerTestDialect(DialectRegistry ®istry) { registry.insert(); } diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td --- a/mlir/test/lib/Dialect/Test/TestOps.td +++ b/mlir/test/lib/Dialect/Test/TestOps.td @@ -21,7 +21,7 @@ def Test_Dialect : Dialect { let name = "test"; - let cppNamespace = "::mlir"; + let cppNamespace = "::mlir::test"; let hasOperationAttrVerify = 1; let hasRegionArgAttrVerify = 1; let hasRegionResultAttrVerify = 1; @@ -89,8 +89,8 @@ } def TEST_TestType : DialectType()">, "test">, - BuildableType<"$_builder.getType<::mlir::TestType>()">; + CPred<"$_self.isa<::mlir::test::TestType>()">, "test">, + BuildableType<"$_builder.getType<::mlir::test::TestType>()">; //===----------------------------------------------------------------------===// // Test Symbols diff --git a/mlir/test/lib/Dialect/Test/TestPatterns.cpp b/mlir/test/lib/Dialect/Test/TestPatterns.cpp --- a/mlir/test/lib/Dialect/Test/TestPatterns.cpp +++ b/mlir/test/lib/Dialect/Test/TestPatterns.cpp @@ -16,6 +16,7 @@ #include "mlir/Transforms/GreedyPatternRewriteDriver.h" using namespace mlir; +using namespace mlir::test; // Native function for testing NativeCodeCall static Value chooseOperand(Value input1, Value input2, BoolAttr choice) { @@ -955,6 +956,7 @@ //===----------------------------------------------------------------------===// namespace mlir { +namespace test { void registerPatternsTestPass() { PassRegistration("test-return-type", "Run return type functions"); @@ -987,4 +989,5 @@ "test-merge-blocks", "Test Merging operation in ConversionPatternRewriter"}; } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Dialect/Test/TestTraits.cpp b/mlir/test/lib/Dialect/Test/TestTraits.cpp --- a/mlir/test/lib/Dialect/Test/TestTraits.cpp +++ b/mlir/test/lib/Dialect/Test/TestTraits.cpp @@ -11,6 +11,7 @@ #include "mlir/Transforms/GreedyPatternRewriteDriver.h" using namespace mlir; +using namespace mlir::test; //===----------------------------------------------------------------------===// // Trait Folder. diff --git a/mlir/test/lib/Dialect/Test/TestTypeDefs.td b/mlir/test/lib/Dialect/Test/TestTypeDefs.td --- a/mlir/test/lib/Dialect/Test/TestTypeDefs.td +++ b/mlir/test/lib/Dialect/Test/TestTypeDefs.td @@ -55,7 +55,7 @@ let parameters = ( ins // SignednessSemantics is defined below. - "::mlir::TestIntegerType::SignednessSemantics":$signedness, + "::mlir::test::TestIntegerType::SignednessSemantics":$signedness, "unsigned":$width ); @@ -108,7 +108,7 @@ // An ArrayRef of something which requires allocation in the storage // constructor. ArrayRefOfSelfAllocationParameter< - "::mlir::FieldInfo", // FieldInfo is defined/declared in TestTypes.h. + "::mlir::test::FieldInfo", // FieldInfo is defined/declared in TestTypes.h. "Models struct fields">: $fields ); diff --git a/mlir/test/lib/Dialect/Test/TestTypes.h b/mlir/test/lib/Dialect/Test/TestTypes.h --- a/mlir/test/lib/Dialect/Test/TestTypes.h +++ b/mlir/test/lib/Dialect/Test/TestTypes.h @@ -23,6 +23,7 @@ #include "mlir/IR/Types.h" namespace mlir { +namespace test { /// FieldInfo represents a field in the StructType data type. It is used as a /// parameter in TestTypeDefs.td. @@ -36,12 +37,14 @@ } }; +} // namespace test } // namespace mlir #define GET_TYPEDEF_CLASSES #include "TestTypeDefs.h.inc" namespace mlir { +namespace test { #include "TestTypeInterfaces.h.inc" @@ -104,6 +107,7 @@ StringRef getName() { return getImpl()->name; } }; -} // end namespace mlir +} // namespace test +} // namespace mlir #endif // MLIR_TESTTYPES_H diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp --- a/mlir/test/lib/Dialect/Test/TestTypes.cpp +++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/TypeSwitch.h" using namespace mlir; +using namespace mlir::test; // Custom parser for SignednessSemantics. static ParseResult @@ -87,21 +88,23 @@ // namespace. Declare them here, then define them immediately below. Separating // the declaration and definition adheres to the LLVM coding standards. namespace mlir { +namespace test { // FieldInfo is used as part of a parameter, so equality comparison is // compulsory. static bool operator==(const FieldInfo &a, const FieldInfo &b); // FieldInfo is used as part of a parameter, so a hash will be computed. static llvm::hash_code hash_value(const FieldInfo &fi); // NOLINT +} // namespace test } // namespace mlir // FieldInfo is used as part of a parameter, so equality comparison is // compulsory. -static bool mlir::operator==(const FieldInfo &a, const FieldInfo &b) { +static bool mlir::test::operator==(const FieldInfo &a, const FieldInfo &b) { return a.name == b.name && a.type == b.type; } // FieldInfo is used as part of a parameter, so a hash will be computed. -static llvm::hash_code mlir::hash_value(const FieldInfo &fi) { // NOLINT +static llvm::hash_code mlir::test::hash_value(const FieldInfo &fi) { // NOLINT return llvm::hash_combine(fi.name, fi.type); } diff --git a/mlir/test/lib/IR/TestInterfaces.cpp b/mlir/test/lib/IR/TestInterfaces.cpp --- a/mlir/test/lib/IR/TestInterfaces.cpp +++ b/mlir/test/lib/IR/TestInterfaces.cpp @@ -10,6 +10,7 @@ #include "mlir/Pass/Pass.h" using namespace mlir; +using namespace mlir::test; namespace { /// This test checks various aspects of Type interface generation and @@ -34,8 +35,10 @@ } // end anonymous namespace namespace mlir { +namespace test { void registerTestInterfaces() { PassRegistration pass("test-type-interfaces", "Test type interface support."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/IR/TestTypes.cpp b/mlir/test/lib/IR/TestTypes.cpp --- a/mlir/test/lib/IR/TestTypes.cpp +++ b/mlir/test/lib/IR/TestTypes.cpp @@ -11,6 +11,7 @@ #include "mlir/Pass/Pass.h" using namespace mlir; +using namespace mlir::test; namespace { struct TestRecursiveTypesPass @@ -36,7 +37,7 @@ signalPassFailure(); } }; -} // end namespace +} // namespace LogicalResult TestRecursiveTypesPass::createIRWithTypes() { MLIRContext *ctx = &getContext(); @@ -69,10 +70,12 @@ } namespace mlir { +namespace test { void registerTestRecursiveTypesPass() { PassRegistration reg( "test-recursive-types", "Test support for recursive types"); } -} // end namespace mlir +} // namespace test +} // namespace mlir diff --git a/mlir/test/lib/Transforms/TestAffineLoopParametricTiling.cpp b/mlir/test/lib/Transforms/TestAffineLoopParametricTiling.cpp --- a/mlir/test/lib/Transforms/TestAffineLoopParametricTiling.cpp +++ b/mlir/test/lib/Transforms/TestAffineLoopParametricTiling.cpp @@ -20,7 +20,6 @@ #define DEBUG_TYPE "test-affine-parametric-tile" namespace { - struct TestAffineLoopParametricTiling : public PassWrapper { void runOnFunction() override; @@ -82,9 +81,11 @@ } namespace mlir { +namespace test { void registerTestAffineLoopParametricTilingPass() { PassRegistration( "test-affine-parametric-tile", "Tile affine loops using SSA values as tile sizes"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestCallGraph.cpp b/mlir/test/lib/Transforms/TestCallGraph.cpp --- a/mlir/test/lib/Transforms/TestCallGraph.cpp +++ b/mlir/test/lib/Transforms/TestCallGraph.cpp @@ -27,8 +27,10 @@ } // end anonymous namespace namespace mlir { +namespace test { void registerTestCallGraphPass() { PassRegistration pass( "test-print-callgraph", "Print the contents of a constructed callgraph."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestConstantFold.cpp b/mlir/test/lib/Transforms/TestConstantFold.cpp --- a/mlir/test/lib/Transforms/TestConstantFold.cpp +++ b/mlir/test/lib/Transforms/TestConstantFold.cpp @@ -65,8 +65,10 @@ } namespace mlir { +namespace test { void registerTestConstantFold() { PassRegistration("test-constant-fold", "Test operation constant folding"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestConvVectorization.cpp b/mlir/test/lib/Transforms/TestConvVectorization.cpp --- a/mlir/test/lib/Transforms/TestConvVectorization.cpp +++ b/mlir/test/lib/Transforms/TestConvVectorization.cpp @@ -124,8 +124,10 @@ } namespace mlir { +namespace test { void registerTestConvVectorization() { PassRegistration testTransformPatternsPass( "test-conv-vectorization", "Test vectorization of convolutions"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestConvertCallOp.cpp b/mlir/test/lib/Transforms/TestConvertCallOp.cpp --- a/mlir/test/lib/Transforms/TestConvertCallOp.cpp +++ b/mlir/test/lib/Transforms/TestConvertCallOp.cpp @@ -19,9 +19,10 @@ namespace { class TestTypeProducerOpConverter - : public ConvertOpToLLVMPattern { + : public ConvertOpToLLVMPattern { public: - using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; + using ConvertOpToLLVMPattern< + test::TestTypeProducerOp>::ConvertOpToLLVMPattern; LogicalResult matchAndRewrite(Operation *op, ArrayRef operands, @@ -43,7 +44,7 @@ // Populate type conversions. LLVMTypeConverter type_converter(m.getContext()); - type_converter.addConversion([&](TestType type) { + type_converter.addConversion([&](test::TestType type) { return LLVM::LLVMType::getInt8PtrTy(m.getContext()); }); @@ -55,7 +56,7 @@ // Set target. ConversionTarget target(getContext()); target.addLegalDialect(); - target.addIllegalDialect(); + target.addIllegalDialect(); target.addIllegalDialect(); if (failed(applyPartialConversion(m, target, std::move(patterns)))) @@ -66,10 +67,12 @@ } // namespace namespace mlir { +namespace test { void registerConvertCallOpPass() { PassRegistration( "test-convert-call-op", "Tests conversion of `std.call` to `llvm.call` in " "presence of custom types"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestConvertGPUKernelToCubin.cpp b/mlir/test/lib/Transforms/TestConvertGPUKernelToCubin.cpp --- a/mlir/test/lib/Transforms/TestConvertGPUKernelToCubin.cpp +++ b/mlir/test/lib/Transforms/TestConvertGPUKernelToCubin.cpp @@ -11,6 +11,7 @@ #include "mlir/Pass/PassManager.h" #include "mlir/Target/NVVMIR.h" #include "llvm/Support/TargetSelect.h" + using namespace mlir; #if MLIR_CUDA_CONVERSIONS_ENABLED @@ -21,6 +22,7 @@ } namespace mlir { +namespace test { void registerTestConvertGPUKernelToCubinPass() { PassPipelineRegistration<>( "test-kernel-to-cubin", @@ -37,5 +39,6 @@ "nvptx64-nvidia-cuda", "sm_35", "+ptx60", "nvvm.cubin")); }); } +} // namespace test } // namespace mlir #endif diff --git a/mlir/test/lib/Transforms/TestConvertGPUKernelToHsaco.cpp b/mlir/test/lib/Transforms/TestConvertGPUKernelToHsaco.cpp --- a/mlir/test/lib/Transforms/TestConvertGPUKernelToHsaco.cpp +++ b/mlir/test/lib/Transforms/TestConvertGPUKernelToHsaco.cpp @@ -11,6 +11,7 @@ #include "mlir/Pass/PassManager.h" #include "mlir/Target/ROCDLIR.h" #include "llvm/Support/TargetSelect.h" + using namespace mlir; #if MLIR_ROCM_CONVERSIONS_ENABLED @@ -21,6 +22,7 @@ } namespace mlir { +namespace test { void registerTestConvertGPUKernelToHsacoPass() { PassPipelineRegistration<>( "test-kernel-to-hsaco", @@ -37,5 +39,6 @@ "amdgcn-amd-amdhsa", "gfx900", "-code-object-v3", "rocdl.hsaco")); }); } +} // namespace test } // namespace mlir #endif diff --git a/mlir/test/lib/Transforms/TestDominance.cpp b/mlir/test/lib/Transforms/TestDominance.cpp --- a/mlir/test/lib/Transforms/TestDominance.cpp +++ b/mlir/test/lib/Transforms/TestDominance.cpp @@ -82,9 +82,11 @@ } // end anonymous namespace namespace mlir { +namespace test { void registerTestDominancePass() { PassRegistration( "test-print-dominance", "Print the dominance information for multiple regions."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestDynamicPipeline.cpp b/mlir/test/lib/Transforms/TestDynamicPipeline.cpp --- a/mlir/test/lib/Transforms/TestDynamicPipeline.cpp +++ b/mlir/test/lib/Transforms/TestDynamicPipeline.cpp @@ -103,12 +103,14 @@ *this, "op-name", llvm::cl::MiscFlags::CommaSeparated, llvm::cl::desc("List of function name to apply the pipeline to")}; }; -} // end namespace +} // namespace namespace mlir { +namespace test { void registerTestDynamicPipelinePass() { PassRegistration( "test-dynamic-pipeline", "Tests the dynamic pipeline feature by applying " "a pipeline on a selected set of functions"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestExpandMemRefReshape.cpp b/mlir/test/lib/Transforms/TestExpandMemRefReshape.cpp --- a/mlir/test/lib/Transforms/TestExpandMemRefReshape.cpp +++ b/mlir/test/lib/Transforms/TestExpandMemRefReshape.cpp @@ -30,8 +30,10 @@ } namespace mlir { +namespace test { void registerTestExpandMemRefReshapePass() { PassRegistration pass( "test-expand-memref-reshape", "Test expanding memref reshape"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestExpandTanh.cpp b/mlir/test/lib/Transforms/TestExpandTanh.cpp --- a/mlir/test/lib/Transforms/TestExpandTanh.cpp +++ b/mlir/test/lib/Transforms/TestExpandTanh.cpp @@ -30,8 +30,10 @@ } namespace mlir { +namespace test { void registerTestExpandTanhPass() { PassRegistration pass("test-expand-tanh", "Test expanding tanh"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestFinalizingBufferize.cpp b/mlir/test/lib/Transforms/TestFinalizingBufferize.cpp --- a/mlir/test/lib/Transforms/TestFinalizingBufferize.cpp +++ b/mlir/test/lib/Transforms/TestFinalizingBufferize.cpp @@ -50,15 +50,15 @@ /// Converts tensor based test operations to buffer based ones using /// bufferize. class TensorBasedOpConverter - : public BufferizeOpConversionPattern { + : public BufferizeOpConversionPattern { public: using BufferizeOpConversionPattern< - mlir::TensorBasedOp>::BufferizeOpConversionPattern; + test::TensorBasedOp>::BufferizeOpConversionPattern; LogicalResult - matchAndRewrite(mlir::TensorBasedOp op, ArrayRef operands, + matchAndRewrite(test::TensorBasedOp op, ArrayRef operands, ConversionPatternRewriter &rewriter) const final { - mlir::TensorBasedOpAdaptor adaptor( + mlir::test::TensorBasedOpAdaptor adaptor( operands, op.getOperation()->getAttrDictionary()); // The input needs to be turned into a buffer first. Until then, bail out. @@ -76,9 +76,9 @@ Value newOutputBuffer = rewriter.create(loc, memrefType); // Generate a new test operation that works on buffers. - rewriter.create(loc, - /*input=*/adaptor.input(), - /*output=*/newOutputBuffer); + rewriter.create(loc, + /*input=*/adaptor.input(), + /*output=*/newOutputBuffer); // Replace the results of the old op with the new output buffers. rewriter.replaceOp(op, newOutputBuffer); @@ -87,7 +87,7 @@ }; void getDependentDialects(DialectRegistry ®istry) const override { - registry.insert(); + registry.insert(); } void runOnOperation() override { @@ -97,8 +97,8 @@ // Mark all Standard operations legal. target.addLegalDialect(); - target.addLegalOp(); - target.addLegalOp(); + target.addLegalOp(); + target.addLegalOp(); target.addLegalOp(); target.addLegalOp(); @@ -106,7 +106,7 @@ auto isLegalOperation = [&](Operation *op) { return converter.isLegal(op); }; - target.addDynamicallyLegalDialect(isLegalOperation); + target.addDynamicallyLegalDialect(isLegalOperation); // Mark Standard Return operations illegal as long as one operand is tensor. target.addDynamicallyLegalOp([&](mlir::ReturnOp returnOp) { @@ -144,7 +144,8 @@ TypeRange TypeRange = inputs.getTypes(); SmallVector types(TypeRange.begin(), TypeRange.end()); TupleType tuple = TupleType::get(types, builder.getContext()); - mlir::Value value = builder.create(loc, tuple, inputs); + mlir::Value value = + builder.create(loc, tuple, inputs); return value; }); @@ -152,7 +153,7 @@ TupleType resultType, Value value, SmallVectorImpl &values) { for (unsigned i = 0, e = resultType.size(); i < e; ++i) { - Value res = builder.create( + Value res = builder.create( loc, resultType.getType(i), value, builder.getI32IntegerAttr(i)); values.push_back(res); } @@ -160,8 +161,7 @@ }); OwningRewritePatternList patterns; - populateWithBufferizeOpConversionPatterns( + populateWithBufferizeOpConversionPatterns( &context, converter, patterns); patterns.insert(&context, converter); @@ -173,6 +173,7 @@ } // end anonymous namespace namespace mlir { +namespace test { void registerTestFinalizingBufferizePass() { PassRegistration< TestFinalizingBufferizePass>( @@ -186,4 +187,5 @@ "Tests finalizing buffierize conversions, allowing functions to have " "memref typed results."); } -} // end namespace mlir +} // namespace test +} // namespace mlir diff --git a/mlir/test/lib/Transforms/TestGpuParallelLoopMapping.cpp b/mlir/test/lib/Transforms/TestGpuParallelLoopMapping.cpp --- a/mlir/test/lib/Transforms/TestGpuParallelLoopMapping.cpp +++ b/mlir/test/lib/Transforms/TestGpuParallelLoopMapping.cpp @@ -28,12 +28,14 @@ greedilyMapParallelSCFToGPU(region); } }; -} // end namespace +} // namespace namespace mlir { +namespace test { void registerTestGpuParallelLoopMappingPass() { PassRegistration registration( "test-gpu-greedy-parallel-loop-mapping", "Greedily maps all parallel loops to gpu hardware ids."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestInlining.cpp b/mlir/test/lib/Transforms/TestInlining.cpp --- a/mlir/test/lib/Transforms/TestInlining.cpp +++ b/mlir/test/lib/Transforms/TestInlining.cpp @@ -22,6 +22,7 @@ #include "llvm/ADT/StringSet.h" using namespace mlir; +using namespace mlir::test; namespace { struct Inliner : public PassWrapper { @@ -61,7 +62,9 @@ } // end anonymous namespace namespace mlir { +namespace test { void registerInliner() { PassRegistration("test-inline", "Test inlining region calls"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLinalgCodegenStrategy.cpp b/mlir/test/lib/Transforms/TestLinalgCodegenStrategy.cpp --- a/mlir/test/lib/Transforms/TestLinalgCodegenStrategy.cpp +++ b/mlir/test/lib/Transforms/TestLinalgCodegenStrategy.cpp @@ -143,8 +143,10 @@ } namespace mlir { +namespace test { void registerTestLinalgCodegenStrategy() { PassRegistration testLinalgCodegenStrategyPass( "test-linalg-codegen-strategy", "Test Linalg Codegen Strategy."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLinalgFusionTransforms.cpp b/mlir/test/lib/Transforms/TestLinalgFusionTransforms.cpp --- a/mlir/test/lib/Transforms/TestLinalgFusionTransforms.cpp +++ b/mlir/test/lib/Transforms/TestLinalgFusionTransforms.cpp @@ -188,6 +188,7 @@ } // namespace namespace mlir { +namespace test { void registerTestLinalgFusionTransforms() { PassRegistration testFusionTransformsPass( "test-linalg-fusion-transform-patterns", @@ -198,4 +199,5 @@ "test-linalg-greedy-fusion", "Test Linalg fusion by applying a greedy test transformation."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLinalgHoisting.cpp b/mlir/test/lib/Transforms/TestLinalgHoisting.cpp --- a/mlir/test/lib/Transforms/TestLinalgHoisting.cpp +++ b/mlir/test/lib/Transforms/TestLinalgHoisting.cpp @@ -52,8 +52,10 @@ } namespace mlir { +namespace test { void registerTestLinalgHoisting() { PassRegistration testTestLinalgHoistingPass( "test-linalg-hoisting", "Test Linalg hoisting functions."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLinalgTransforms.cpp b/mlir/test/lib/Transforms/TestLinalgTransforms.cpp --- a/mlir/test/lib/Transforms/TestLinalgTransforms.cpp +++ b/mlir/test/lib/Transforms/TestLinalgTransforms.cpp @@ -503,9 +503,11 @@ } namespace mlir { +namespace test { void registerTestLinalgTransforms() { PassRegistration testTransformPatternsPass( "test-linalg-transform-patterns", "Test Linalg transformation patterns by applying them greedily."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLiveness.cpp b/mlir/test/lib/Transforms/TestLiveness.cpp --- a/mlir/test/lib/Transforms/TestLiveness.cpp +++ b/mlir/test/lib/Transforms/TestLiveness.cpp @@ -29,9 +29,11 @@ } // end anonymous namespace namespace mlir { +namespace test { void registerTestLivenessPass() { PassRegistration( "test-print-liveness", "Print the contents of a constructed liveness information."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLoopFusion.cpp b/mlir/test/lib/Transforms/TestLoopFusion.cpp --- a/mlir/test/lib/Transforms/TestLoopFusion.cpp +++ b/mlir/test/lib/Transforms/TestLoopFusion.cpp @@ -192,8 +192,10 @@ } namespace mlir { +namespace test { void registerTestLoopFusion() { PassRegistration("test-loop-fusion", "Tests loop fusion utility functions."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLoopMapping.cpp b/mlir/test/lib/Transforms/TestLoopMapping.cpp --- a/mlir/test/lib/Transforms/TestLoopMapping.cpp +++ b/mlir/test/lib/Transforms/TestLoopMapping.cpp @@ -49,12 +49,14 @@ }); } }; -} // end namespace +} // namespace namespace mlir { +namespace test { void registerTestLoopMappingPass() { PassRegistration( "test-mapping-to-processing-elements", "test mapping a single loop on a virtual processor grid"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp b/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp --- a/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp +++ b/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp @@ -46,13 +46,15 @@ llvm::cl::desc( "fixed number of iterations that the outer loops should have")}; }; -} // end namespace +} // namespace namespace mlir { +namespace test { void registerSimpleParametricTilingPass() { PassRegistration( "test-extract-fixed-outer-loops", "test application of parametric tiling to the outer loops so that the " "ranges of outer loops become static"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestLoopUnrolling.cpp b/mlir/test/lib/Transforms/TestLoopUnrolling.cpp --- a/mlir/test/lib/Transforms/TestLoopUnrolling.cpp +++ b/mlir/test/lib/Transforms/TestLoopUnrolling.cpp @@ -61,11 +61,13 @@ Option loopDepth{*this, "loop-depth", llvm::cl::desc("Loop depth."), llvm::cl::init(0)}; }; -} // end namespace +} // namespace namespace mlir { +namespace test { void registerTestLoopUnrollingPass() { PassRegistration( "test-loop-unrolling", "Tests loop unrolling transformation"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestMemRefBoundCheck.cpp b/mlir/test/lib/Transforms/TestMemRefBoundCheck.cpp --- a/mlir/test/lib/Transforms/TestMemRefBoundCheck.cpp +++ b/mlir/test/lib/Transforms/TestMemRefBoundCheck.cpp @@ -46,8 +46,10 @@ } namespace mlir { +namespace test { void registerMemRefBoundCheck() { PassRegistration( "test-memref-bound-check", "Check memref access bounds in a Function"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestMemRefDependenceCheck.cpp b/mlir/test/lib/Transforms/TestMemRefDependenceCheck.cpp --- a/mlir/test/lib/Transforms/TestMemRefDependenceCheck.cpp +++ b/mlir/test/lib/Transforms/TestMemRefDependenceCheck.cpp @@ -111,9 +111,11 @@ } namespace mlir { +namespace test { void registerTestMemRefDependenceCheck() { PassRegistration pass( "test-memref-dependence-check", "Checks dependences between all pairs of memref accesses."); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp b/mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp --- a/mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp +++ b/mlir/test/lib/Transforms/TestMemRefStrideCalculation.cpp @@ -50,8 +50,10 @@ } namespace mlir { +namespace test { void registerTestMemRefStrideCalculation() { PassRegistration pass( "test-memref-stride-calculation", "Test operation constant folding"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestOpaqueLoc.cpp b/mlir/test/lib/Transforms/TestOpaqueLoc.cpp --- a/mlir/test/lib/Transforms/TestOpaqueLoc.cpp +++ b/mlir/test/lib/Transforms/TestOpaqueLoc.cpp @@ -82,8 +82,10 @@ } // end anonymous namespace namespace mlir { +namespace test { void registerTestOpaqueLoc() { PassRegistration pass( "test-opaque-loc", "Changes all leaf locations to opaque locations"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestSCFUtils.cpp b/mlir/test/lib/Transforms/TestSCFUtils.cpp --- a/mlir/test/lib/Transforms/TestSCFUtils.cpp +++ b/mlir/test/lib/Transforms/TestSCFUtils.cpp @@ -68,13 +68,15 @@ }); } }; -} // end namespace +} // namespace namespace mlir { +namespace test { void registerTestSCFUtilsPass() { PassRegistration("test-scf-for-utils", "test scf.for utils"); PassRegistration("test-scf-if-utils", "test scf.if utils"); } +} // namespace test } // namespace mlir diff --git a/mlir/test/lib/Transforms/TestVectorTransforms.cpp b/mlir/test/lib/Transforms/TestVectorTransforms.cpp --- a/mlir/test/lib/Transforms/TestVectorTransforms.cpp +++ b/mlir/test/lib/Transforms/TestVectorTransforms.cpp @@ -294,6 +294,7 @@ } // end anonymous namespace namespace mlir { +namespace test { void registerTestVectorConversions() { PassRegistration vectorToVectorPass( "test-vector-to-vector-conversion", @@ -327,4 +328,5 @@ "test-vector-to-forloop", "Test conversion patterns to break up a vector op into a for loop"); } +} // namespace test } // namespace mlir diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -27,36 +27,47 @@ using namespace llvm; using namespace mlir; -namespace mlir { // Defined in the test directory, no public header. -void registerConvertCallOpPass(); +namespace mlir { void registerConvertToTargetEnvPass(); -void registerInliner(); -void registerMemRefBoundCheck(); void registerPassManagerTestPass(); -void registerPatternsTestPass(); void registerPrintOpAvailabilityPass(); void registerSideEffectTestPasses(); -void registerSimpleParametricTilingPass(); void registerSliceAnalysisTestPass(); void registerSymbolTestPasses(); void registerTestAffineDataCopyPass(); -void registerTestAffineLoopParametricTilingPass(); void registerTestAffineLoopUnswitchingPass(); void registerTestAllReduceLoweringPass(); +void registerTestFunc(); +void registerTestGpuMemoryPromotionPass(); +void registerTestLoopPermutationPass(); +void registerTestMatchers(); +void registerTestPrintDefUsePass(); +void registerTestPrintNestingPass(); +void registerTestReducer(); +void registerTestSpirvEntryPointABIPass(); +void registerTestSpirvModuleCombinerPass(); +void registerTestTraitsPass(); +void registerVectorizerTestPass(); + +namespace test { +void registerConvertCallOpPass(); +void registerInliner(); +void registerMemRefBoundCheck(); +void registerPatternsTestPass(); +void registerSimpleParametricTilingPass(); +void registerTestAffineLoopParametricTilingPass(); void registerTestCallGraphPass(); void registerTestConstantFold(); void registerTestConvVectorization(); void registerTestConvertGPUKernelToCubinPass(); void registerTestConvertGPUKernelToHsacoPass(); -void registerTestDominancePass(); void registerTestDialect(DialectRegistry &); +void registerTestDominancePass(); void registerTestDynamicPipelinePass(); void registerTestExpandMemRefReshapePass(); void registerTestExpandTanhPass(); void registerTestFinalizingBufferizePass(); -void registerTestFunc(); -void registerTestGpuMemoryPromotionPass(); void registerTestGpuParallelLoopMappingPass(); void registerTestInterfaces(); void registerTestLinalgCodegenStrategy(); @@ -67,85 +78,78 @@ void registerTestLivenessPass(); void registerTestLoopFusion(); void registerTestLoopMappingPass(); -void registerTestLoopPermutationPass(); void registerTestLoopUnrollingPass(); -void registerTestMatchers(); void registerTestMemRefDependenceCheck(); void registerTestMemRefStrideCalculation(); void registerTestOpaqueLoc(); void registerTestPreparationPassWithAllowedMemrefResults(); -void registerTestPrintDefUsePass(); -void registerTestPrintNestingPass(); void registerTestRecursiveTypesPass(); -void registerTestReducer(); -void registerTestSpirvEntryPointABIPass(); -void registerTestSpirvModuleCombinerPass(); void registerTestSCFUtilsPass(); -void registerTestTraitsPass(); void registerTestVectorConversions(); -void registerVectorizerTestPass(); +} // namespace test } // namespace mlir #ifdef MLIR_INCLUDE_TESTS void registerTestPasses() { - registerConvertCallOpPass(); registerConvertToTargetEnvPass(); - registerInliner(); - registerMemRefBoundCheck(); registerPassManagerTestPass(); - registerPatternsTestPass(); registerPrintOpAvailabilityPass(); registerSideEffectTestPasses(); - registerSimpleParametricTilingPass(); registerSliceAnalysisTestPass(); registerSymbolTestPasses(); registerTestAffineDataCopyPass(); - registerTestAllReduceLoweringPass(); registerTestAffineLoopUnswitchingPass(); - registerTestLoopPermutationPass(); - registerTestCallGraphPass(); - registerTestConvVectorization(); - registerTestConstantFold(); -#if MLIR_CUDA_CONVERSIONS_ENABLED - registerTestConvertGPUKernelToCubinPass(); -#endif -#if MLIR_ROCM_CONVERSIONS_ENABLED - registerTestConvertGPUKernelToHsacoPass(); -#endif - registerTestAffineLoopParametricTilingPass(); - registerTestDominancePass(); - registerTestDynamicPipelinePass(); - registerTestFinalizingBufferizePass(); + registerTestAllReduceLoweringPass(); registerTestFunc(); - registerTestExpandTanhPass(); - registerTestExpandMemRefReshapePass(); registerTestGpuMemoryPromotionPass(); - registerTestInterfaces(); - registerTestLinalgCodegenStrategy(); - registerTestLinalgFusionTransforms(); - registerTestLinalgGreedyFusion(); - registerTestLinalgHoisting(); - registerTestLinalgTransforms(); - registerTestLivenessPass(); - registerTestLoopFusion(); - registerTestLoopMappingPass(); - registerTestLoopUnrollingPass(); + registerTestLoopPermutationPass(); registerTestMatchers(); - registerTestMemRefDependenceCheck(); - registerTestMemRefStrideCalculation(); - registerTestOpaqueLoc(); - registerTestPreparationPassWithAllowedMemrefResults(); registerTestPrintDefUsePass(); registerTestPrintNestingPass(); - registerTestRecursiveTypesPass(); registerTestReducer(); - registerTestGpuParallelLoopMappingPass(); registerTestSpirvEntryPointABIPass(); registerTestSpirvModuleCombinerPass(); - registerTestSCFUtilsPass(); registerTestTraitsPass(); - registerTestVectorConversions(); registerVectorizerTestPass(); + + test::registerConvertCallOpPass(); + test::registerInliner(); + test::registerMemRefBoundCheck(); + test::registerPatternsTestPass(); + test::registerSimpleParametricTilingPass(); + test::registerTestAffineLoopParametricTilingPass(); + test::registerTestCallGraphPass(); + test::registerTestConstantFold(); +#if MLIR_CUDA_CONVERSIONS_ENABLED + test::registerTestConvertGPUKernelToCubinPass(); +#endif +#if MLIR_ROCM_CONVERSIONS_ENABLED + test::registerTestConvertGPUKernelToHsacoPass(); +#endif + test::registerTestConvVectorization(); + test::registerTestDominancePass(); + test::registerTestDynamicPipelinePass(); + test::registerTestExpandMemRefReshapePass(); + test::registerTestExpandTanhPass(); + test::registerTestFinalizingBufferizePass(); + test::registerTestGpuParallelLoopMappingPass(); + test::registerTestInterfaces(); + test::registerTestLinalgCodegenStrategy(); + test::registerTestLinalgFusionTransforms(); + test::registerTestLinalgGreedyFusion(); + test::registerTestLinalgHoisting(); + test::registerTestLinalgTransforms(); + test::registerTestLivenessPass(); + test::registerTestLoopFusion(); + test::registerTestLoopMappingPass(); + test::registerTestLoopUnrollingPass(); + test::registerTestMemRefDependenceCheck(); + test::registerTestMemRefStrideCalculation(); + test::registerTestOpaqueLoc(); + test::registerTestPreparationPassWithAllowedMemrefResults(); + test::registerTestRecursiveTypesPass(); + test::registerTestSCFUtilsPass(); + test::registerTestVectorConversions(); } #endif @@ -157,7 +161,7 @@ DialectRegistry registry; registerAllDialects(registry); #ifdef MLIR_INCLUDE_TESTS - registerTestDialect(registry); + test::registerTestDialect(registry); #endif return failed(MlirOptMain(argc, argv, "MLIR modular optimizer driver\n", registry,