[flang-commits] [flang] 039b969 - Revert "[MLIR] Update pass declarations to new autogenerated files"
Michele Scuttari via flang-commits
flang-commits at lists.llvm.org
Tue Aug 30 13:22:16 PDT 2022
Author: Michele Scuttari
Date: 2022-08-30T22:21:55+02:00
New Revision: 039b969b32b64b64123dce30dd28ec4e343d893f
URL: https://github.com/llvm/llvm-project/commit/039b969b32b64b64123dce30dd28ec4e343d893f
DIFF: https://github.com/llvm/llvm-project/commit/039b969b32b64b64123dce30dd28ec4e343d893f.diff
LOG: Revert "[MLIR] Update pass declarations to new autogenerated files"
This reverts commit 2be8af8f0e0780901213b6fd3013a5268ddc3359.
Added:
flang/lib/Optimizer/Transforms/PassDetail.h
mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h
mlir/include/mlir/Reducer/PassDetail.h
mlir/lib/Conversion/PassDetail.h
mlir/lib/Dialect/Affine/Transforms/PassDetail.h
mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h
mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h
mlir/lib/Dialect/Func/Transforms/PassDetail.h
mlir/lib/Dialect/GPU/Transforms/PassDetail.h
mlir/lib/Dialect/LLVMIR/Transforms/PassDetail.h
mlir/lib/Dialect/Linalg/Transforms/PassDetail.h
mlir/lib/Dialect/MemRef/Transforms/PassDetail.h
mlir/lib/Dialect/NVGPU/Transforms/PassDetail.h
mlir/lib/Dialect/SCF/Transforms/PassDetail.h
mlir/lib/Dialect/SPIRV/Transforms/PassDetail.h
mlir/lib/Dialect/Shape/Transforms/PassDetail.h
mlir/lib/Dialect/Tensor/Transforms/PassDetail.h
mlir/lib/Dialect/Vector/Transforms/PassDetail.h
mlir/lib/Transforms/PassDetail.h
Modified:
flang/include/flang/Optimizer/CodeGen/CGPasses.td
flang/include/flang/Optimizer/CodeGen/CodeGen.h
flang/include/flang/Optimizer/Transforms/Passes.h
flang/include/flang/Optimizer/Transforms/Passes.td
flang/include/flang/Tools/CLOptions.inc
flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
flang/lib/Optimizer/Transforms/AbstractResult.cpp
flang/lib/Optimizer/Transforms/AffineDemotion.cpp
flang/lib/Optimizer/Transforms/AffinePromotion.cpp
flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp
flang/lib/Optimizer/Transforms/AnnotateConstant.cpp
flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
flang/lib/Optimizer/Transforms/CharacterConversion.cpp
flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
flang/lib/Optimizer/Transforms/RewriteLoop.cpp
flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
flang/lib/Optimizer/Transforms/SimplifyRegionLite.cpp
mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h
mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
mlir/include/mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h
mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h
mlir/include/mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h
mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h
mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
mlir/include/mlir/Conversion/ComplexToLibm/ComplexToLibm.h
mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h
mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h
mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h
mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h
mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h
mlir/include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h
mlir/include/mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h
mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h
mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
mlir/include/mlir/Conversion/MathToFuncs/MathToFuncs.h
mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h
mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h
mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h
mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h
mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h
mlir/include/mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h
mlir/include/mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h
mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h
mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h
mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h
mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h
mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h
mlir/include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h
mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h
mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h
mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h
mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h
mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
mlir/include/mlir/Conversion/TosaToSCF/TosaToSCF.h
mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h
mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h
mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h
mlir/include/mlir/Dialect/Affine/Passes.h
mlir/include/mlir/Dialect/Affine/Passes.td
mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.h
mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td
mlir/include/mlir/Dialect/Async/Passes.h
mlir/include/mlir/Dialect/Async/Passes.td
mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
mlir/include/mlir/Dialect/Func/Transforms/Passes.h
mlir/include/mlir/Dialect/Func/Transforms/Passes.td
mlir/include/mlir/Dialect/GPU/Transforms/Passes.h
mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h
mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h
mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h
mlir/include/mlir/Dialect/Linalg/Passes.h
mlir/include/mlir/Dialect/Linalg/Passes.td
mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
mlir/include/mlir/Dialect/NVGPU/Passes.h
mlir/include/mlir/Dialect/NVGPU/Passes.td
mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h
mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td
mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
mlir/include/mlir/Dialect/Shape/Transforms/Passes.td
mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
mlir/include/mlir/Dialect/Tensor/Transforms/Passes.h
mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td
mlir/include/mlir/Dialect/Tosa/Transforms/Passes.h
mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td
mlir/include/mlir/Dialect/Transform/Transforms/Passes.h
mlir/include/mlir/Dialect/Transform/Transforms/Passes.td
mlir/include/mlir/Dialect/Vector/Transforms/Passes.h
mlir/include/mlir/Dialect/Vector/Transforms/Passes.td
mlir/include/mlir/Reducer/Passes.h
mlir/include/mlir/Reducer/Passes.td
mlir/include/mlir/Transforms/LocationSnapshot.h
mlir/include/mlir/Transforms/Passes.h
mlir/include/mlir/Transforms/Passes.td
mlir/include/mlir/Transforms/ViewOpGraph.h
mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp
mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp
mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp
mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp
mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp
mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
mlir/lib/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.cpp
mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp
mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp
mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp
mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
mlir/lib/Conversion/TensorToLinalg/TensorToLinalgPass.cpp
mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp
mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp
mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
mlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp
mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp
mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp
mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp
mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp
mlir/lib/Dialect/Affine/Transforms/LoopCoalescing.cpp
mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
mlir/lib/Dialect/Arithmetic/Transforms/Bufferize.cpp
mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
mlir/lib/Dialect/Arithmetic/Transforms/UnsignedWhenEquivalent.cpp
mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
mlir/lib/Dialect/Async/Transforms/PassDetail.h
mlir/lib/Dialect/Bufferization/Transforms/AllocTensorElimination.cpp
mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
mlir/lib/Dialect/Bufferization/Transforms/DropEquivalentBufferResults.cpp
mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp
mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp
mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp
mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp
mlir/lib/Dialect/LLVMIR/Transforms/RequestCWrappers.cpp
mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp
mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp
mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp
mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp
mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp
mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp
mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp
mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
mlir/lib/Dialect/SCF/Transforms/ParallelLoopCollapsing.cpp
mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/DecorateCompositeTypeLayoutPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp
mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp
mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp
mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp
mlir/lib/Dialect/Vector/Transforms/Bufferize.cpp
mlir/lib/Reducer/OptReductionPass.cpp
mlir/lib/Reducer/ReductionTreePass.cpp
mlir/lib/Transforms/CSE.cpp
mlir/lib/Transforms/Canonicalizer.cpp
mlir/lib/Transforms/ControlFlowSink.cpp
mlir/lib/Transforms/Inliner.cpp
mlir/lib/Transforms/LocationSnapshot.cpp
mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
mlir/lib/Transforms/OpStats.cpp
mlir/lib/Transforms/SCCP.cpp
mlir/lib/Transforms/StripDebugInfo.cpp
mlir/lib/Transforms/SymbolDCE.cpp
mlir/lib/Transforms/SymbolPrivatize.cpp
mlir/lib/Transforms/TopologicalSort.cpp
mlir/lib/Transforms/ViewOpGraph.cpp
mlir/test/CAPI/execution_engine.c
mlir/test/CAPI/pass.c
mlir/test/Pass/ir-printing.mlir
mlir/test/Pass/run-reproducer.mlir
mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
mlir/tools/mlir-tblgen/PassCAPIGen.cpp
mlir/tools/mlir-tblgen/PassGen.cpp
mlir/unittests/ExecutionEngine/Invoke.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Optimizer/CodeGen/CGPasses.td b/flang/include/flang/Optimizer/CodeGen/CGPasses.td
index e9f60f03a40d3..71e130a636dde 100644
--- a/flang/include/flang/Optimizer/CodeGen/CGPasses.td
+++ b/flang/include/flang/Optimizer/CodeGen/CGPasses.td
@@ -16,7 +16,7 @@
include "mlir/Pass/PassBase.td"
-def FIRToLLVMLoweringPass : Pass<"fir-to-llvm-ir", "mlir::ModuleOp"> {
+def FIRToLLVMLowering : Pass<"fir-to-llvm-ir", "mlir::ModuleOp"> {
let summary = "Convert FIR dialect to LLVM-IR dialect";
let description = [{
Convert the FIR dialect to the LLVM-IR dialect of MLIR. This conversion
@@ -30,7 +30,7 @@ def FIRToLLVMLoweringPass : Pass<"fir-to-llvm-ir", "mlir::ModuleOp"> {
];
}
-def CodeGenRewritePass : Pass<"cg-rewrite", "mlir::ModuleOp"> {
+def CodeGenRewrite : Pass<"cg-rewrite", "mlir::ModuleOp"> {
let summary = "Rewrite some FIR ops into their code-gen forms.";
let description = [{
Fuse specific subgraphs into single Ops for code generation.
@@ -44,7 +44,7 @@ def CodeGenRewritePass : Pass<"cg-rewrite", "mlir::ModuleOp"> {
];
}
-def TargetRewritePass : Pass<"target-rewrite", "mlir::ModuleOp"> {
+def TargetRewrite : Pass<"target-rewrite", "mlir::ModuleOp"> {
let summary = "Rewrite some FIR dialect into target specific forms.";
let description = [{
Certain abstractions in the FIR dialect need to be rewritten to reflect
diff --git a/flang/include/flang/Optimizer/CodeGen/CodeGen.h b/flang/include/flang/Optimizer/CodeGen/CodeGen.h
index 08ba14fbd2782..d89c6137e4a65 100644
--- a/flang/include/flang/Optimizer/CodeGen/CodeGen.h
+++ b/flang/include/flang/Optimizer/CodeGen/CodeGen.h
@@ -20,12 +20,6 @@ namespace fir {
struct NameUniquer;
-#define GEN_PASS_DECL_FIRTOLLVMLOWERINGPASS
-#define GEN_PASS_DECL_CODEGENREWRITEPASS
-#define GEN_PASS_DECL_TARGETREWRITEPASS
-#define GEN_PASS_DECL_BOXEDPROCEDUREPASS
-#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
-
/// Prerequiste pass for code gen. Perform intermediate rewrites to perform
/// the code gen (to LLVM-IR dialect) conversion.
std::unique_ptr<mlir::Pass> createFirCodeGenRewritePass();
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.h b/flang/include/flang/Optimizer/Transforms/Passes.h
index 32e1a799d5d53..e44cba39c603f 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.h
+++ b/flang/include/flang/Optimizer/Transforms/Passes.h
@@ -28,22 +28,6 @@ namespace fir {
// Passes defined in Passes.td
//===----------------------------------------------------------------------===//
-#define GEN_PASS_DECL_ABSTRACTRESULTONFUNCOPTPASS
-#define GEN_PASS_DECL_ABSTRACTRESULTONGLOBALOPTPASS
-#define GEN_PASS_DECL_AFFINEDIALECTPROMOTIONPASS
-#define GEN_PASS_DECL_AFFINEDIALECTDEMOTIONPASS
-#define GEN_PASS_DECL_ANNOTATECONSTANTOPERANDSPASS
-#define GEN_PASS_DECL_ARRAYVALUECOPYPASS
-#define GEN_PASS_DECL_CHARACTERCONVERSIONPASS
-#define GEN_PASS_DECL_CFGCONVERSIONPASS
-#define GEN_PASS_DECL_EXTERNALNAMECONVERSIONPASS
-#define GEN_PASS_DECL_MEMREFDATAFLOWOPTPASS
-#define GEN_PASS_DECL_SIMPLIFYINTRINSICSPASS
-#define GEN_PASS_DECL_MEMORYALLOCATIONOPTPASS
-#define GEN_PASS_DECL_SIMPLIFYREGIONLITEPASS
-#define GEN_PASS_DECL_ALGEBRAICSIMPLIFICATIONPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-
std::unique_ptr<mlir::Pass> createAbstractResultOnFuncOptPass();
std::unique_ptr<mlir::Pass> createAbstractResultOnGlobalOptPass();
std::unique_ptr<mlir::Pass> createAffineDemotionPass();
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index a9fa0ce05688a..b35aa82b40e04 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -16,7 +16,7 @@
include "mlir/Pass/PassBase.td"
-class AbstractResultOptBase<string optExt, string operation>
+class AbstractResultOptBase<string optExt, string operation>
: Pass<"abstract-result-on-" # optExt # "-opt", operation> {
let summary = "Convert fir.array, fir.box and fir.rec function result to "
"function argument";
@@ -35,15 +35,15 @@ class AbstractResultOptBase<string optExt, string operation>
];
}
-def AbstractResultOnFuncOptPass : AbstractResultOptBase<"func", "mlir::func::FuncOp"> {
+def AbstractResultOnFuncOpt : AbstractResultOptBase<"func", "mlir::func::FuncOp"> {
let constructor = "::fir::createAbstractResultOnFuncOptPass()";
}
-def AbstractResultOnGlobalOptPass : AbstractResultOptBase<"global", "fir::GlobalOp"> {
+def AbstractResultOnGlobalOpt : AbstractResultOptBase<"global", "fir::GlobalOp"> {
let constructor = "::fir::createAbstractResultOnGlobalOptPass()";
}
-def AffineDialectPromotionPass : Pass<"promote-to-affine", "::mlir::func::FuncOp"> {
+def AffineDialectPromotion : Pass<"promote-to-affine", "::mlir::func::FuncOp"> {
let summary = "Promotes `fir.{do_loop,if}` to `affine.{for,if}`.";
let description = [{
Convert fir operations which satisfy affine constraints to the affine
@@ -68,7 +68,7 @@ def AffineDialectPromotionPass : Pass<"promote-to-affine", "::mlir::func::FuncOp
];
}
-def AffineDialectDemotionPass : Pass<"demote-affine", "::mlir::func::FuncOp"> {
+def AffineDialectDemotion : Pass<"demote-affine", "::mlir::func::FuncOp"> {
let summary = "Converts `affine.{load,store}` back to fir operations";
let description = [{
Affine dialect's default lowering for loads and stores is
diff erent from
@@ -82,7 +82,7 @@ def AffineDialectDemotionPass : Pass<"demote-affine", "::mlir::func::FuncOp"> {
];
}
-def AnnotateConstantOperandsPass : Pass<"annotate-constant"> {
+def AnnotateConstantOperands : Pass<"annotate-constant"> {
let summary = "Annotate constant operands to all FIR operations";
let description = [{
The MLIR canonicalizer makes a distinction between constants based on how
@@ -99,7 +99,7 @@ def AnnotateConstantOperandsPass : Pass<"annotate-constant"> {
let dependentDialects = [ "fir::FIROpsDialect" ];
}
-def ArrayValueCopyPass : Pass<"array-value-copy", "::mlir::func::FuncOp"> {
+def ArrayValueCopy : Pass<"array-value-copy", "::mlir::func::FuncOp"> {
let summary = "Convert array value operations to memory operations.";
let description = [{
Transform the set of array value primitives to a memory-based array
@@ -119,7 +119,7 @@ def ArrayValueCopyPass : Pass<"array-value-copy", "::mlir::func::FuncOp"> {
let dependentDialects = [ "fir::FIROpsDialect" ];
}
-def CharacterConversionPass : Pass<"character-conversion"> {
+def CharacterConversion : Pass<"character-conversion"> {
let summary = "Convert CHARACTER entities with
diff erent KINDs";
let description = [{
Translates entities of one CHARACTER KIND to another.
@@ -137,7 +137,7 @@ def CharacterConversionPass : Pass<"character-conversion"> {
];
}
-def CFGConversionPass : Pass<"cfg-conversion", "::mlir::func::FuncOp"> {
+def CFGConversion : Pass<"cfg-conversion", "::mlir::func::FuncOp"> {
let summary = "Convert FIR structured control flow ops to CFG ops.";
let description = [{
Transform the `fir.do_loop`, `fir.if`, and `fir.iterate_while` ops into
@@ -157,7 +157,7 @@ def CFGConversionPass : Pass<"cfg-conversion", "::mlir::func::FuncOp"> {
];
}
-def ExternalNameConversionPass : Pass<"external-name-interop", "mlir::ModuleOp"> {
+def ExternalNameConversion : Pass<"external-name-interop", "mlir::ModuleOp"> {
let summary = "Convert name for external interoperability";
let description = [{
Demangle FIR internal name and mangle them for external interoperability.
@@ -165,7 +165,7 @@ def ExternalNameConversionPass : Pass<"external-name-interop", "mlir::ModuleOp">
let constructor = "::fir::createExternalNameConversionPass()";
}
-def MemRefDataFlowOptPass : Pass<"fir-memref-dataflow-opt", "::mlir::func::FuncOp"> {
+def MemRefDataFlowOpt : Pass<"fir-memref-dataflow-opt", "::mlir::func::FuncOp"> {
let summary =
"Perform store/load forwarding and potentially removing dead stores.";
let description = [{
@@ -182,7 +182,7 @@ def MemRefDataFlowOptPass : Pass<"fir-memref-dataflow-opt", "::mlir::func::FuncO
// functions into the module, which is invalid if a finer grain mlir::Operation
// is used as the pass specification says to not touch things outside hte scope
// of the operation being processed.
-def SimplifyIntrinsicsPass : Pass<"simplify-intrinsics", "mlir::ModuleOp"> {
+def SimplifyIntrinsics : Pass<"simplify-intrinsics", "mlir::ModuleOp"> {
let summary = "Intrinsics simplification";
let description = [{
Qualifying intrinsics calls are replaced with calls to a specialized and
@@ -198,7 +198,7 @@ def SimplifyIntrinsicsPass : Pass<"simplify-intrinsics", "mlir::ModuleOp"> {
];
}
-def MemoryAllocationOptPass : Pass<"memory-allocation-opt", "mlir::func::FuncOp"> {
+def MemoryAllocationOpt : Pass<"memory-allocation-opt", "mlir::func::FuncOp"> {
let summary = "Convert stack to heap allocations and vice versa.";
let description = [{
Convert stack allocations to heap allocations and vice versa based on
@@ -216,7 +216,7 @@ def MemoryAllocationOptPass : Pass<"memory-allocation-opt", "mlir::func::FuncOp"
let constructor = "::fir::createMemoryAllocationPass()";
}
-def SimplifyRegionLitePass : Pass<"simplify-region-lite", "mlir::ModuleOp"> {
+def SimplifyRegionLite : Pass<"simplify-region-lite", "mlir::ModuleOp"> {
let summary = "Region simplification";
let description = [{
Run region DCE and erase unreachable blocks in regions.
@@ -224,7 +224,7 @@ def SimplifyRegionLitePass : Pass<"simplify-region-lite", "mlir::ModuleOp"> {
let constructor = "::fir::createSimplifyRegionLitePass()";
}
-def AlgebraicSimplificationPass : Pass<"flang-algebraic-simplification"> {
+def AlgebraicSimplification : Pass<"flang-algebraic-simplification"> {
let summary = "";
let description = [{
Run algebraic simplifications for Math/Complex/etc. dialect operations.
diff --git a/flang/include/flang/Tools/CLOptions.inc b/flang/include/flang/Tools/CLOptions.inc
index 75b514cb4c574..2c772030d33ba 100644
--- a/flang/include/flang/Tools/CLOptions.inc
+++ b/flang/include/flang/Tools/CLOptions.inc
@@ -183,7 +183,7 @@ inline void createDefaultFIROptimizerPassPipeline(
// convert control flow to CFG form
fir::addCfgConversionPass(pm);
- pm.addPass(mlir::createConvertSCFToControlFlowPass());
+ pm.addPass(mlir::createConvertSCFToCFPass());
pm.addPass(mlir::createCanonicalizerPass(config));
pm.addPass(fir::createSimplifyRegionLitePass());
diff --git a/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp b/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
index 5abb9abe55fc5..61f19013787e1 100644
--- a/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
+++ b/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
@@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//
-#include "flang/Optimizer/CodeGen/CodeGen.h"
-
+#include "PassDetail.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/LowLevelIntrinsics.h"
+#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@@ -19,11 +19,6 @@
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace fir {
-#define GEN_PASS_DEF_BOXEDPROCEDUREPASS
-#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-procedure-pointer"
using namespace fir;
@@ -174,8 +169,7 @@ class BoxprocTypeRewriter : public mlir::TypeConverter {
/// the frame pointer during execution. In LLVM IR, the frame pointer is
/// designated with the `nest` attribute. The thunk's address will then be used
/// as the call target instead of the original function's address directly.
-class BoxedProcedurePass
- : public fir::impl::BoxedProcedurePassBase<BoxedProcedurePass> {
+class BoxedProcedurePass : public BoxedProcedurePassBase<BoxedProcedurePass> {
public:
BoxedProcedurePass() { options = {true}; }
BoxedProcedurePass(bool useThunks) { options = {useThunks}; }
diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index a1d7673cbe6a9..00cb71b5af8ce 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -11,8 +11,8 @@
//===----------------------------------------------------------------------===//
#include "flang/Optimizer/CodeGen/CodeGen.h"
-
#include "CGOps.h"
+#include "PassDetail.h"
#include "flang/ISO_Fortran_binding.h"
#include "flang/Optimizer/Dialect/FIRAttr.h"
#include "flang/Optimizer/Dialect/FIROps.h"
@@ -26,19 +26,12 @@
#include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
#include "mlir/Conversion/MathToLibm/MathToLibm.h"
#include "mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h"
-#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "llvm/ADT/ArrayRef.h"
-namespace fir {
-#define GEN_PASS_DEF_FIRTOLLVMLOWERINGPASS
-#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-codegen"
// fir::LLVMTypeConverter for converting to LLVM IR dialect types.
@@ -3050,8 +3043,7 @@ struct IsPresentOpConversion : public FIROpConversion<fir::IsPresentOp> {
auto ptr = adaptor.getOperands()[0];
if (isPresent.getVal().getType().isa<fir::BoxCharType>()) {
- [[maybe_unused]] auto structTy =
- ptr.getType().cast<mlir::LLVM::LLVMStructType>();
+ [[maybe_unused]] auto structTy = ptr.getType().cast<mlir::LLVM::LLVMStructType>();
assert(!structTy.isOpaque() && !structTy.getBody().empty());
ptr = rewriter.create<mlir::LLVM::ExtractValueOp>(loc, ptr, 0);
@@ -3288,8 +3280,7 @@ namespace {
///
/// This pass lowers all FIR dialect operations to LLVM IR dialect. An
/// MLIR pass is used to lower residual Std dialect to LLVM IR dialect.
-class FIRToLLVMLowering
- : public fir::impl::FIRToLLVMLoweringPassBase<FIRToLLVMLowering> {
+class FIRToLLVMLowering : public fir::FIRToLLVMLoweringBase<FIRToLLVMLowering> {
public:
FIRToLLVMLowering() = default;
FIRToLLVMLowering(fir::FIRToLLVMPassOptions options) : options{options} {}
diff --git a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
index c25ac234d871f..96b9e9b41d93d 100644
--- a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
@@ -10,9 +10,9 @@
//
//===----------------------------------------------------------------------===//
-#include "flang/Optimizer/CodeGen/CodeGen.h"
-
#include "CGOps.h"
+#include "PassDetail.h"
+#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@@ -21,11 +21,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
-namespace fir {
-#define GEN_PASS_DEF_CODEGENREWRITEPASS
-#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
-} // namespace fir
-
//===----------------------------------------------------------------------===//
// Codegen rewrite: rewriting of subgraphs of ops
//===----------------------------------------------------------------------===//
@@ -263,8 +258,7 @@ class ArrayCoorConversion : public mlir::OpRewritePattern<fir::ArrayCoorOp> {
}
};
-class CodeGenRewrite
- : public fir::impl::CodeGenRewritePassBase<CodeGenRewrite> {
+class CodeGenRewrite : public fir::CodeGenRewriteBase<CodeGenRewrite> {
public:
void runOn(mlir::Operation *op, mlir::Region ®ion) {
auto &context = getContext();
diff --git a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
index 6868d32840a2e..1a67230f8cc1c 100644
--- a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
@@ -14,12 +14,12 @@
//
//===----------------------------------------------------------------------===//
-#include "flang/Optimizer/CodeGen/CodeGen.h"
-
+#include "PassDetail.h"
#include "Target.h"
#include "flang/Optimizer/Builder/Character.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/Todo.h"
+#include "flang/Optimizer/CodeGen/CodeGen.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIROpsSupport.h"
@@ -30,11 +30,6 @@
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Debug.h"
-namespace fir {
-#define GEN_PASS_DEF_TARGETREWRITEPASS
-#include "flang/Optimizer/CodeGen/CGPasses.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-target-rewrite"
namespace {
@@ -71,7 +66,7 @@ struct FixupTy {
/// generation that traverses the FIR and modifies types and operations to a
/// form that is appropriate for the specific target. LLVM IR has specific
/// idioms that are used for distinct target processor and ABI combinations.
-class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
+class TargetRewrite : public fir::TargetRewriteBase<TargetRewrite> {
public:
TargetRewrite(const fir::TargetRewriteOptions &options) {
noCharacterConversion = options.noCharacterConversion;
diff --git a/flang/lib/Optimizer/Transforms/AbstractResult.cpp b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
index e920149f05749..0ab65cfe7fd08 100644
--- a/flang/lib/Optimizer/Transforms/AbstractResult.cpp
+++ b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Builder/Todo.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
@@ -18,12 +19,6 @@
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace fir {
-#define GEN_PASS_DEF_ABSTRACTRESULTONFUNCOPTPASS
-#define GEN_PASS_DEF_ABSTRACTRESULTONGLOBALOPTPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-abstract-result-opt"
namespace fir {
@@ -252,8 +247,8 @@ class AbstractResultOptTemplate : public PassBase<Pass> {
};
class AbstractResultOnFuncOpt
- : public AbstractResultOptTemplate<
- AbstractResultOnFuncOpt, fir::impl::AbstractResultOnFuncOptPassBase> {
+ : public AbstractResultOptTemplate<AbstractResultOnFuncOpt,
+ fir::AbstractResultOnFuncOptBase> {
public:
void runOnSpecificOperation(mlir::func::FuncOp func, bool shouldBoxResult,
mlir::RewritePatternSet &patterns,
@@ -297,9 +292,8 @@ inline static bool containsFunctionTypeWithAbstractResult(mlir::Type type) {
}
class AbstractResultOnGlobalOpt
- : public AbstractResultOptTemplate<
- AbstractResultOnGlobalOpt,
- fir::impl::AbstractResultOnGlobalOptPassBase> {
+ : public AbstractResultOptTemplate<AbstractResultOnGlobalOpt,
+ fir::AbstractResultOnGlobalOptBase> {
public:
void runOnSpecificOperation(fir::GlobalOp global, bool,
mlir::RewritePatternSet &,
diff --git a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
index 61a331ea95f15..c535ebaa02de1 100644
--- a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
@@ -16,6 +16,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@@ -35,11 +36,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-namespace fir {
-#define GEN_PASS_DEF_AFFINEDIALECTDEMOTIONPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-affine-demotion"
using namespace fir;
@@ -141,7 +137,7 @@ class StdAllocConversion : public mlir::OpRewritePattern<memref::AllocOp> {
};
class AffineDialectDemotion
- : public fir::impl::AffineDialectDemotionPassBase<AffineDialectDemotion> {
+ : public AffineDialectDemotionBase<AffineDialectDemotion> {
public:
void runOnOperation() override {
auto *context = &getContext();
diff --git a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
index 0621dbc3d0dc0..331d951396e32 100644
--- a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
@@ -15,6 +15,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@@ -30,11 +31,6 @@
#include "llvm/ADT/Optional.h"
#include "llvm/Support/Debug.h"
-namespace fir {
-#define GEN_PASS_DEF_AFFINEDIALECTPROMOTIONPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-affine-promotion"
using namespace fir;
@@ -583,7 +579,7 @@ class AffineIfConversion : public mlir::OpRewritePattern<fir::IfOp> {
/// Promote fir.do_loop and fir.if to affine.for and affine.if, in the cases
/// where such a promotion is possible.
class AffineDialectPromotion
- : public fir::impl::AffineDialectPromotionPassBase<AffineDialectPromotion> {
+ : public AffineDialectPromotionBase<AffineDialectPromotion> {
public:
void runOnOperation() override {
diff --git a/flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp b/flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp
index 06eed66cc10ee..607ba590316cb 100644
--- a/flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp
+++ b/flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp
@@ -11,22 +11,16 @@
// the parameters of the patterns for Fortran programs.
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/Math/Transforms/Passes.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace fir {
-#define GEN_PASS_DEF_ALGEBRAICSIMPLIFICATIONPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
using namespace mlir;
namespace {
struct AlgebraicSimplification
- : public fir::impl::AlgebraicSimplificationPassBase<
- AlgebraicSimplification> {
+ : public fir::AlgebraicSimplificationBase<AlgebraicSimplification> {
AlgebraicSimplification(const GreedyRewriteConfig &rewriteConfig) {
config = rewriteConfig;
}
diff --git a/flang/lib/Optimizer/Transforms/AnnotateConstant.cpp b/flang/lib/Optimizer/Transforms/AnnotateConstant.cpp
index 750a5ba36f2eb..0437883c84245 100644
--- a/flang/lib/Optimizer/Transforms/AnnotateConstant.cpp
+++ b/flang/lib/Optimizer/Transforms/AnnotateConstant.cpp
@@ -6,24 +6,18 @@
//
//===----------------------------------------------------------------------===//
-// #include "PassDetail.h"
-#include "flang/Optimizer/Dialect/FIRDialect.h"
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/IR/BuiltinAttributes.h"
-namespace fir {
-#define GEN_PASS_DEF_ANNOTATECONSTANTOPERANDSPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-annotate-constant"
using namespace fir;
namespace {
struct AnnotateConstantOperands
- : impl::AnnotateConstantOperandsPassBase<AnnotateConstantOperands> {
+ : AnnotateConstantOperandsBase<AnnotateConstantOperands> {
void runOnOperation() override {
auto *context = &getContext();
mlir::Dialect *firDialect = context->getLoadedDialect("fir");
diff --git a/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp b/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
index 1041ce99a008f..65b7121cc6c4c 100644
--- a/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
+++ b/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Builder/Array.h"
#include "flang/Optimizer/Builder/BoxValue.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
@@ -21,11 +22,6 @@
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/Debug.h"
-namespace fir {
-#define GEN_PASS_DEF_ARRAYVALUECOPYPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-array-value-copy"
using namespace fir;
@@ -1330,7 +1326,7 @@ class ArrayAmendConversion : public mlir::OpRewritePattern<ArrayAmendOp> {
};
class ArrayValueCopyConverter
- : public fir::impl::ArrayValueCopyPassBase<ArrayValueCopyConverter> {
+ : public ArrayValueCopyBase<ArrayValueCopyConverter> {
public:
void runOnOperation() override {
auto func = getOperation();
diff --git a/flang/lib/Optimizer/Transforms/CharacterConversion.cpp b/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
index 4e10478677953..650b990ef54c5 100644
--- a/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
@@ -6,24 +6,19 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/FIRContext.h"
#include "flang/Optimizer/Support/KindMapping.h"
#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/Debug.h"
-namespace fir {
-#define GEN_PASS_DEF_CHARACTERCONVERSIONPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-character-conversion"
namespace {
@@ -100,7 +95,7 @@ class CharacterConvertConversion
/// Rewrite the `fir.char_convert` op into a loop. This pass must be run only on
/// fir::CharConvertOp.
class CharacterConversion
- : public fir::impl::CharacterConversionPassBase<CharacterConversion> {
+ : public fir::CharacterConversionBase<CharacterConversion> {
public:
void runOnOperation() override {
CharacterConversionOptions clOpts{useRuntimeCalls.getValue()};
diff --git a/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp b/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
index 31b3ab0d49b9d..42260ad2826ac 100644
--- a/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "flang/Optimizer/Dialect/FIRDialect.h"
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Support/InternalNames.h"
#include "flang/Optimizer/Transforms/Passes.h"
@@ -17,11 +17,6 @@
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace fir {
-#define GEN_PASS_DEF_EXTERNALNAMECONVERSIONPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
using namespace mlir;
//===----------------------------------------------------------------------===//
@@ -122,8 +117,7 @@ struct MangleNameOnAddrOfOp : public mlir::OpRewritePattern<fir::AddrOfOp> {
};
class ExternalNameConversionPass
- : public fir::impl::ExternalNameConversionPassBase<
- ExternalNameConversionPass> {
+ : public fir::ExternalNameConversionBase<ExternalNameConversionPass> {
public:
mlir::ModuleOp getModule() { return getOperation(); }
void runOnOperation() override;
diff --git a/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp b/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
index 83ce3029067f3..61572017e9bd7 100644
--- a/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
+++ b/flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@@ -18,11 +19,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
-namespace fir {
-#define GEN_PASS_DEF_MEMREFDATAFLOWOPTPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "fir-memref-dataflow-opt"
using namespace mlir;
@@ -98,8 +94,7 @@ class LoadStoreForwarding {
mlir::DominanceInfo *domInfo;
};
-class MemDataFlowOpt
- : public fir::impl::MemRefDataFlowOptPassBase<MemDataFlowOpt> {
+class MemDataFlowOpt : public fir::MemRefDataFlowOptBase<MemDataFlowOpt> {
public:
void runOnOperation() override {
mlir::func::FuncOp f = getOperation();
diff --git a/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp b/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
index a170786858982..373c8e45b322d 100644
--- a/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
+++ b/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FIRType.h"
@@ -17,11 +18,6 @@
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace fir {
-#define GEN_PASS_DEF_MEMORYALLOCATIONOPTPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-memory-allocation-opt"
// Number of elements in an array does not determine where it is allocated.
@@ -155,7 +151,7 @@ class AllocaOpConversion : public mlir::OpRewritePattern<fir::AllocaOp> {
/// 2. If a stack allocation is an array with a runtime evaluated size make
/// it a heap allocation.
class MemoryAllocationOpt
- : public fir::impl::MemoryAllocationOptPassBase<MemoryAllocationOpt> {
+ : public fir::MemoryAllocationOptBase<MemoryAllocationOpt> {
public:
MemoryAllocationOpt() {
// Set options with default values. (See Passes.td.) Note that the
diff --git a/flang/lib/Optimizer/Transforms/PassDetail.h b/flang/lib/Optimizer/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..c3e0db927aac3
--- /dev/null
+++ b/flang/lib/Optimizer/Transforms/PassDetail.h
@@ -0,0 +1,29 @@
+//===- PassDetail.h - Optimizer Transforms Pass class details ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H
+#define FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H
+
+#include "flang/Optimizer/Dialect/FIRDialect.h"
+#include "flang/Optimizer/Dialect/FIROps.h"
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
+#include "mlir/Dialect/Math/IR/Math.h"
+#include "mlir/Dialect/OpenACC/OpenACC.h"
+#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
+#include "mlir/Pass/Pass.h"
+#include "mlir/Pass/PassRegistry.h"
+
+namespace fir {
+
+#define GEN_PASS_CLASSES
+#include "flang/Optimizer/Transforms/Passes.h.inc"
+
+} // namespace fir
+
+#endif // FORTRAN_OPTMIZER_TRANSFORMS_PASSDETAIL_H
diff --git a/flang/lib/Optimizer/Transforms/RewriteLoop.cpp b/flang/lib/Optimizer/Transforms/RewriteLoop.cpp
index b081335aa62fc..a28aecfab93e2 100644
--- a/flang/lib/Optimizer/Transforms/RewriteLoop.cpp
+++ b/flang/lib/Optimizer/Transforms/RewriteLoop.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Transforms/Passes.h"
@@ -16,11 +17,6 @@
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/CommandLine.h"
-namespace fir {
-#define GEN_PASS_DEF_CFGCONVERSIONPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
using namespace fir;
using namespace mlir;
@@ -301,7 +297,7 @@ class CfgIterWhileConv : public mlir::OpRewritePattern<fir::IterWhileOp> {
};
/// Convert FIR structured control flow ops to CFG ops.
-class CfgConversion : public fir::impl::CFGConversionPassBase<CfgConversion> {
+class CfgConversion : public CFGConversionBase<CfgConversion> {
public:
void runOnOperation() override {
auto *context = &getContext();
diff --git a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
index 3b317004b9f60..9a9e06665b5b0 100644
--- a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
+++ b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
@@ -22,6 +22,7 @@
/// and small in size.
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Builder/BoxValue.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "flang/Optimizer/Builder/Todo.h"
@@ -29,7 +30,6 @@
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/FIRContext.h"
#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Pass/Pass.h"
@@ -40,17 +40,12 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
-namespace fir {
-#define GEN_PASS_DEF_SIMPLIFYINTRINSICSPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
#define DEBUG_TYPE "flang-simplify-intrinsics"
namespace {
class SimplifyIntrinsicsPass
- : public fir::impl::SimplifyIntrinsicsPassBase<SimplifyIntrinsicsPass> {
+ : public fir::SimplifyIntrinsicsBase<SimplifyIntrinsicsPass> {
using FunctionTypeGeneratorTy =
std::function<mlir::FunctionType(fir::FirOpBuilder &)>;
using FunctionBodyGeneratorTy =
diff --git a/flang/lib/Optimizer/Transforms/SimplifyRegionLite.cpp b/flang/lib/Optimizer/Transforms/SimplifyRegionLite.cpp
index 281a4dfea21f2..369d7c8d9a10e 100644
--- a/flang/lib/Optimizer/Transforms/SimplifyRegionLite.cpp
+++ b/flang/lib/Optimizer/Transforms/SimplifyRegionLite.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Transforms/Passes.h"
#include "mlir/IR/PatternMatch.h"
@@ -14,15 +15,10 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/RegionUtils.h"
-namespace fir {
-#define GEN_PASS_DEF_SIMPLIFYREGIONLITEPASS
-#include "flang/Optimizer/Transforms/Passes.h.inc"
-} // namespace fir
-
namespace {
class SimplifyRegionLitePass
- : public fir::impl::SimplifyRegionLitePassBase<SimplifyRegionLitePass> {
+ : public fir::SimplifyRegionLiteBase<SimplifyRegionLitePass> {
public:
void runOnOperation() override;
};
diff --git a/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h b/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h
index 041e550fae640..7906abafd7189 100644
--- a/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h
+++ b/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h
@@ -17,13 +17,12 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
-#define GEN_PASS_DECL_CONVERTAMDGPUTOROCDLPASS
-#include "mlir/Conversion/Passes.h.inc"
-
void populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns,
amdgpu::Chipset chipset);
+std::unique_ptr<Pass> createConvertAMDGPUToROCDLPass();
+
} // namespace mlir
#endif // MLIR_CONVERSION_AMDGPUTOROCDL_AMDGPUTOROCDL_H_
diff --git a/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h b/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
index d562679e1b2d2..2fb69559d91b2 100644
--- a/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
+++ b/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
@@ -23,9 +23,6 @@ class ValueRange;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTAFFINETOSTANDARDPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Collect a set of patterns to convert from the Affine dialect to the Standard
/// dialect, in particular convert structured affine control flow into CFG
/// branch-based control flow.
@@ -43,6 +40,11 @@ Value lowerAffineLowerBound(AffineForOp op, OpBuilder &builder);
/// standard arithmetic operations.
Value lowerAffineUpperBound(AffineForOp op, OpBuilder &builder);
+/// Lowers affine control flow operations (ForStmt, IfStmt and AffineApplyOp)
+/// to equivalent lower-level constructs (flow of basic blocks and arithmetic
+/// primitives).
+std::unique_ptr<Pass> createLowerAffinePass();
+
} // namespace mlir
#endif // MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H
diff --git a/mlir/include/mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h b/mlir/include/mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h
index 74ee11749b7c8..aa18558cf3449 100644
--- a/mlir/include/mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h
+++ b/mlir/include/mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h
@@ -17,13 +17,11 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
-#define GEN_PASS_DECL_CONVERTARITHMETICTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
namespace arith {
void populateArithmeticToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
+std::unique_ptr<Pass> createConvertArithmeticToLLVMPass();
} // namespace arith
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h b/mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h
index 2a0e89170e17c..dfc94a8cf232f 100644
--- a/mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h
+++ b/mlir/include/mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h
@@ -18,17 +18,12 @@ class SPIRVTypeConverter;
class RewritePatternSet;
class Pass;
-#define GEN_PASS_DECL_CONVERTARITHMETICTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
namespace arith {
void populateArithmeticToSPIRVPatterns(SPIRVTypeConverter &typeConverter,
RewritePatternSet &patterns);
-} // namespace arith
-
std::unique_ptr<OperationPass<>> createConvertArithmeticToSPIRVPass();
-
+} // namespace arith
} // namespace mlir
#endif // MLIR_CONVERSION_ARITHMETICTOSPIRV_ARITHMETICTOSPIRV_H
diff --git a/mlir/include/mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h b/mlir/include/mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h
index 860880bcd4a4c..52509313cbdc2 100644
--- a/mlir/include/mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h
+++ b/mlir/include/mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h
@@ -9,19 +9,18 @@
#ifndef MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_
#define MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_
-#include <memory>
+#include "mlir/Pass/Pass.h"
namespace mlir {
-class Pass;
-class RewritePatternSet;
-
-#define GEN_PASS_DECL_CONVERTARMNEON2DTOINTRPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Populates patterns for the lowering of Arm NEON 2D ops to intrinsics.
/// See createConvertArmNeon2dToIntrPass.
void populateConvertArmNeon2dToIntrPatterns(RewritePatternSet &patterns);
+/// Creates a pass to lower Arm NEON 2D ops to intrinsics, i.e.
+/// equivalent ops operating on flattened 1D vectors and mapping more
+/// directly to the corresponding Arm NEON instruction.
+std::unique_ptr<Pass> createConvertArmNeon2dToIntrPass();
+
} // namespace mlir
#endif // MLIR_CONVERSION_ARMNEON2DTOINTR_ARMNEON2DTOINTR_H_
diff --git a/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h b/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
index 4293766152ac1..56db59dedd7a2 100644
--- a/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
+++ b/mlir/include/mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h
@@ -21,8 +21,8 @@ class MLIRContext;
class TypeConverter;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTASYNCTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
+/// Create a pass to convert Async operations to the LLVM dialect.
+std::unique_ptr<OperationPass<ModuleOp>> createConvertAsyncToLLVMPass();
/// Populates patterns for async structural type conversions.
///
@@ -36,9 +36,6 @@ void populateAsyncStructuralTypeConversionsAndLegality(
TypeConverter &typeConverter, RewritePatternSet &patterns,
ConversionTarget &target);
-/// Create a pass to convert Async operations to the LLVM dialect.
-std::unique_ptr<OperationPass<ModuleOp>> createConvertAsyncToLLVMPass();
-
} // namespace mlir
#endif // MLIR_CONVERSION_ASYNCTOLLVM_ASYNCTOLLVM_H
diff --git a/mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h b/mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h
index 3b16d6dd8026a..d8cb1524cf222 100644
--- a/mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h
+++ b/mlir/include/mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h
@@ -15,14 +15,12 @@ namespace mlir {
class Pass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTBUFFERIZATIONTOMEMREFPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Collect a set of patterns to convert memory-related operations from the
/// Bufferization dialect to the MemRef dialect.
void populateBufferizationToMemRefConversionPatterns(
RewritePatternSet &patterns);
+std::unique_ptr<Pass> createBufferizationToMemRefPass();
} // namespace mlir
#endif // MLIR_CONVERSION_BUFFERIZATIONTOMEMREF_BUFFERIZATIONTOMEMREF_H
diff --git a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
index 85ed7a188e3bb..4869906d2d357 100644
--- a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
+++ b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
@@ -15,9 +15,6 @@ class LLVMTypeConverter;
class Pass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTCOMPLEXTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
class ComplexStructBuilder : public StructBuilder {
public:
/// Construct a helper for the given complex number value.
@@ -41,6 +38,9 @@ class ComplexStructBuilder : public StructBuilder {
void populateComplexToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
+/// Create a pass to convert Complex operations to the LLVMIR dialect.
+std::unique_ptr<Pass> createConvertComplexToLLVMPass();
+
} // namespace mlir
#endif // MLIR_CONVERSION_COMPLEXTOLLVM_COMPLEXTOLLVM_H_
diff --git a/mlir/include/mlir/Conversion/ComplexToLibm/ComplexToLibm.h b/mlir/include/mlir/Conversion/ComplexToLibm/ComplexToLibm.h
index d6c9d3c95999a..e86d8e2478290 100644
--- a/mlir/include/mlir/Conversion/ComplexToLibm/ComplexToLibm.h
+++ b/mlir/include/mlir/Conversion/ComplexToLibm/ComplexToLibm.h
@@ -14,9 +14,6 @@ namespace mlir {
template <typename T>
class OperationPass;
-#define GEN_PASS_DECL_CONVERTCOMPLEXTOLIBMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Populate the given list with patterns that convert from Complex to Libm
/// calls.
void populateComplexToLibmConversionPatterns(RewritePatternSet &patterns,
diff --git a/mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h b/mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h
index 9e27cc8b887fa..b0e69dbdfc03e 100644
--- a/mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h
+++ b/mlir/include/mlir/Conversion/ComplexToStandard/ComplexToStandard.h
@@ -14,12 +14,12 @@ namespace mlir {
class RewritePatternSet;
class Pass;
-#define GEN_PASS_DECL_CONVERTCOMPLEXTOSTANDARDPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Populate the given list with patterns that convert from Complex to Standard.
void populateComplexToStandardConversionPatterns(RewritePatternSet &patterns);
+/// Create a pass to convert Complex operations to the Standard dialect.
+std::unique_ptr<Pass> createConvertComplexToStandardPass();
+
} // namespace mlir
#endif // MLIR_CONVERSION_COMPLEXTOSTANDARD_COMPLEXTOSTANDARD_H_
diff --git a/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h b/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
index f1aa7cd733e40..92608c748f2d8 100644
--- a/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
+++ b/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h
@@ -20,9 +20,6 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
-#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
namespace cf {
/// Collect the patterns to convert from the ControlFlow dialect to LLVM. The
/// conversion patterns capture the LLVMTypeConverter by reference meaning the
@@ -30,6 +27,8 @@ namespace cf {
void populateControlFlowToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
+/// Creates a pass to convert the ControlFlow dialect into the LLVMIR dialect.
+std::unique_ptr<Pass> createConvertControlFlowToLLVMPass();
} // namespace cf
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h b/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h
index 3e82be7cd8aa0..9259626aef22c 100644
--- a/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h
@@ -18,9 +18,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_CONVERTCONTROLFLOWTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert ControlFlow ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertControlFlowToSPIRVPass();
diff --git a/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h b/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h
index 16b3a5f05dece..399ca897f29b1 100644
--- a/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h
+++ b/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h
@@ -10,7 +10,6 @@
#define MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVMPASS_H_
#include <memory>
-#include <string>
namespace mlir {
class LowerToLLVMOptions;
@@ -19,9 +18,6 @@ template <typename T>
class OperationPass;
class Pass;
-#define GEN_PASS_DECL_CONVERTFUNCTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert the Func dialect into the LLVMIR dialect.
std::unique_ptr<OperationPass<ModuleOp>> createConvertFuncToLLVMPass();
std::unique_ptr<OperationPass<ModuleOp>>
diff --git a/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h b/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h
index cc158b7e70235..8329a54a4178c 100644
--- a/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h
@@ -18,9 +18,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_CONVERTFUNCTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert Func ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertFuncToSPIRVPass();
diff --git a/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h b/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
index 228263199f62c..79be00adbb374 100644
--- a/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
+++ b/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
@@ -38,22 +38,12 @@ namespace LLVM {
class LLVMDialect;
} // namespace LLVM
-#define GEN_PASS_DECL_CONVERTGPUTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
using OwnedBlob = std::unique_ptr<std::vector<char>>;
using BlobGenerator =
std::function<OwnedBlob(const std::string &, Location, StringRef)>;
using LoweringCallback = std::function<std::unique_ptr<llvm::Module>(
Operation *, llvm::LLVMContext &, StringRef)>;
-/// Collect a set of patterns to convert from the GPU dialect to LLVM and
-/// populate converter for gpu types.
-void populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
- RewritePatternSet &patterns,
- StringRef gpuBinaryAnnotation = {},
- bool kernelBarePtrCallConv = false);
-
/// Creates a pass to convert a GPU operations into a sequence of GPU runtime
/// calls.
///
@@ -61,7 +51,14 @@ void populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
/// instead uses a small wrapper library that exports a stable and conveniently
/// typed ABI on top of GPU runtimes such as CUDA or ROCm (HIP).
std::unique_ptr<OperationPass<ModuleOp>>
-createConvertGpuToLLVMPass(bool kernelBarePtrCallConv = false);
+createGpuToLLVMConversionPass(bool kernelBarePtrCallConv = false);
+
+/// Collect a set of patterns to convert from the GPU dialect to LLVM and
+/// populate converter for gpu types.
+void populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
+ RewritePatternSet &patterns,
+ StringRef gpuBinaryAnnotation = {},
+ bool kernelBarePtrCallConv = false);
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
index f0cf674442a7f..7d031f47c1975 100644
--- a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
+++ b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
@@ -25,9 +25,6 @@ class GPUModuleOp;
class MMAMatrixType;
} // namespace gpu
-#define GEN_PASS_DECL_CONVERTGPUTONVVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
LLVM::LLVMStructType convertMMAToLLVMType(gpu::MMAMatrixType type);
/// Configure target to convert from the GPU dialect to NVVM.
@@ -44,7 +41,7 @@ void populateGpuWMMAToNVVMConversionPatterns(LLVMTypeConverter &converter,
/// Creates a pass that lowers GPU dialect operations to NVVM counterparts. The
/// index bitwidth used for the lowering of the device side index computations
/// is configurable.
-std::unique_ptr<OperationPass<gpu::GPUModuleOp>> createConvertGpuToNVVMPass(
+std::unique_ptr<OperationPass<gpu::GPUModuleOp>> createLowerGpuOpsToNVVMOpsPass(
unsigned indexBitwidth = kDeriveIndexBitwidthFromDataLayout);
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h b/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
index 4891c98d3df99..8e45d7455164f 100644
--- a/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
+++ b/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h
@@ -24,9 +24,6 @@ namespace gpu {
class GPUModuleOp;
} // namespace gpu
-#define GEN_PASS_DECL_CONVERTGPUTOROCDLPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Collect a set of patterns to convert from the GPU dialect to ROCDL.
/// If `runtime` is Unknown, gpu.printf will not be lowered
/// The resulting pattern set should be run over a gpu.module op
@@ -40,7 +37,8 @@ void configureGpuToROCDLConversionLegality(ConversionTarget &target);
/// Creates a pass that lowers GPU dialect operations to ROCDL counterparts. The
/// index bitwidth used for the lowering of the device side index computations
/// is configurable.
-std::unique_ptr<OperationPass<gpu::GPUModuleOp>> createConvertGpuToROCDLPass(
+std::unique_ptr<OperationPass<gpu::GPUModuleOp>>
+createLowerGpuOpsToROCDLOpsPass(
const std::string &chipset = "gfx900",
unsigned indexBitwidth = kDeriveIndexBitwidthFromDataLayout,
bool useBarePtrCallConv = false,
diff --git a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h
index be5c91e9d58b7..8867c96d0a048 100644
--- a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h
@@ -21,9 +21,6 @@ class ModuleOp;
template <typename T>
class OperationPass;
-#define GEN_PASS_DECL_CONVERTGPUTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert GPU kernel ops to corresponding SPIR-V ops. For a
/// gpu.func to be converted, it should have a spv.entry_point_abi attribute.
/// If `mapMemorySpace` is true, performs MemRef memory space to SPIR-V mapping
diff --git a/mlir/include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h b/mlir/include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h
index 7caf7ad4296ef..fe543886152ca 100644
--- a/mlir/include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h
+++ b/mlir/include/mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h
@@ -24,10 +24,6 @@ class ModuleOp;
template <typename T>
class OperationPass;
-#define GEN_PASS_DECL_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS
-#define GEN_PASS_DECL_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNCPASS
-#include "mlir/Conversion/Passes.h.inc"
-
std::unique_ptr<OperationPass<ModuleOp>>
createConvertVulkanLaunchFuncToVulkanCallsPass();
diff --git a/mlir/include/mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h b/mlir/include/mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h
index abb4d0b858a60..9973b38e75e31 100644
--- a/mlir/include/mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h
+++ b/mlir/include/mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h
@@ -18,9 +18,6 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTLINALGTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Populate the given list with patterns that convert from Linalg to LLVM.
void populateLinalgToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
diff --git a/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h b/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h
index 64eb7fa02873d..f184fdf8f6a7a 100644
--- a/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h
@@ -13,18 +13,13 @@
#ifndef MLIR_CONVERSION_LINALGTOSPIRV_LINALGTOSPIRVPASS_H
#define MLIR_CONVERSION_LINALGTOSPIRV_LINALGTOSPIRVPASS_H
-#include <memory>
+#include "mlir/Pass/Pass.h"
namespace mlir {
class ModuleOp;
-template <typename T>
-class OperationPass;
-
-#define GEN_PASS_DECL_CONVERTLINALGTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
/// Creates and returns a pass to convert Linalg ops to SPIR-V ops.
-std::unique_ptr<OperationPass<ModuleOp>> createConvertLinalgToSPIRVPass();
+std::unique_ptr<OperationPass<ModuleOp>> createLinalgToSPIRVPass();
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h b/mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
index 0b6e8e0a6fcab..a891962634ffd 100644
--- a/mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
+++ b/mlir/include/mlir/Conversion/LinalgToStandard/LinalgToStandard.h
@@ -17,9 +17,6 @@ class ModuleOp;
template <typename T>
class OperationPass;
-#define GEN_PASS_DECL_CONVERTLINALGTOSTANDARDPASS
-#include "mlir/Conversion/Passes.h.inc"
-
namespace linalg {
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Conversion/MathToFuncs/MathToFuncs.h b/mlir/include/mlir/Conversion/MathToFuncs/MathToFuncs.h
index de53d222e65d5..f7595002dd0a8 100644
--- a/mlir/include/mlir/Conversion/MathToFuncs/MathToFuncs.h
+++ b/mlir/include/mlir/Conversion/MathToFuncs/MathToFuncs.h
@@ -14,9 +14,9 @@
namespace mlir {
class Pass;
-#define GEN_PASS_DECL_CONVERTMATHTOFUNCSPASS
-#include "mlir/Conversion/Passes.h.inc"
-
+// Pass to convert some Math operations into calls of functions
+// containing software implementation of these operations.
+std::unique_ptr<Pass> createConvertMathToFuncsPass();
} // namespace mlir
#endif // MLIR_CONVERSION_MATHTOFUNCS_MATHTOFUNCS_H
diff --git a/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h b/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h
index 17ca901aee1eb..d03bc29292693 100644
--- a/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h
+++ b/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h
@@ -17,12 +17,10 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
-#define GEN_PASS_DECL_CONVERTMATHTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
void populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
+std::unique_ptr<Pass> createConvertMathToLLVMPass();
} // namespace mlir
#endif // MLIR_CONVERSION_MATHTOLLVM_MATHTOLLVM_H
diff --git a/mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h b/mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h
index 0affcee921f05..c07dcfd090d2a 100644
--- a/mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h
+++ b/mlir/include/mlir/Conversion/MathToLibm/MathToLibm.h
@@ -14,9 +14,6 @@ namespace mlir {
template <typename T>
class OperationPass;
-#define GEN_PASS_DECL_CONVERTMATHTOLIBMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Populate the given list with patterns that convert from Math to Libm calls.
/// If log1pBenefit is present, use it instead of benefit for the Log1p op.
void populateMathToLibmConversionPatterns(
diff --git a/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h b/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h
index 0ce27ef1aed73..0281315d3c0cf 100644
--- a/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h
@@ -18,9 +18,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_CONVERTMATHTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert Math ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertMathToSPIRVPass();
diff --git a/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h b/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
index e02b48d581ce0..732f0bd4bb279 100644
--- a/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
+++ b/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h
@@ -16,14 +16,12 @@ class Pass;
class LLVMTypeConverter;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTMEMREFTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Collect a set of patterns to convert memory-related operations from the
/// MemRef dialect to the LLVM dialect.
void populateMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
+std::unique_ptr<Pass> createMemRefToLLVMPass();
} // namespace mlir
#endif // MLIR_CONVERSION_MEMREFTOLLVM_MEMREFTOLLVM_H
diff --git a/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h b/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h
index 97d7a13fe0dd4..bd449ea264d23 100644
--- a/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h
@@ -19,10 +19,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_MAPMEMREFSTORAGECLASSPASS
-#define GEN_PASS_DECL_CONVERTMEMREFTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to map numeric MemRef memory spaces to symbolic SPIR-V
/// storage classes. The mapping is read from the command-line option.
std::unique_ptr<OperationPass<>> createMapMemRefStorageClassPass();
diff --git a/mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h b/mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h
index a7d28c862679c..05dd975322622 100644
--- a/mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h
+++ b/mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h
@@ -16,12 +16,11 @@ class LLVMTypeConverter;
class RewritePatternSet;
class Pass;
-#define GEN_PASS_DECL_CONVERTNVGPUTONVVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
void populateNVGPUToNVVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns);
+std::unique_ptr<Pass> createConvertNVGPUToNVVMPass();
+
} // namespace mlir
#endif // MLIR_CONVERSION_NVGPUTONVVM_NVGPUTONVVMPASS_H_
diff --git a/mlir/include/mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h b/mlir/include/mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h
index 9ccf142a0aec4..e6b682e0151d1 100644
--- a/mlir/include/mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h
+++ b/mlir/include/mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h
@@ -18,9 +18,6 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTOPENACCTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
static constexpr unsigned kPtrBasePosInDataDescriptor = 0;
static constexpr unsigned kPtrPosInDataDescriptor = 1;
static constexpr unsigned kSizePosInDataDescriptor = 2;
diff --git a/mlir/include/mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h b/mlir/include/mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h
index 12d30378710e7..50d6bd880cdec 100644
--- a/mlir/include/mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h
+++ b/mlir/include/mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h
@@ -16,9 +16,6 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTOPENACCTOSCFPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Collect the patterns to convert from the OpenACC dialect to OpenACC with
/// SCF dialect.
void populateOpenACCToSCFConversionPatterns(RewritePatternSet &patterns);
diff --git a/mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h b/mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h
index d597932a32720..b27cd407e0cc9 100644
--- a/mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h
+++ b/mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h
@@ -19,9 +19,6 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTOOPENMPTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Configure dynamic conversion legality of regionless operations from OpenMP
/// to LLVM.
void configureOpenMPToLLVMConversionLegality(ConversionTarget &target,
diff --git a/mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h b/mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h
index 2cd488c1baf52..4101300bceb7e 100644
--- a/mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h
+++ b/mlir/include/mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h
@@ -20,9 +20,6 @@ class ModuleOp;
template <typename OpT>
class OperationPass;
-#define GEN_PASS_DECL_CONVERTPDLTOPDLINTERPPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates and returns a pass to convert PDL ops to PDL interpreter ops.
std::unique_ptr<OperationPass<ModuleOp>> createPDLToPDLInterpPass();
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index 5716a104871f1..87946c93bfc3a 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -15,7 +15,7 @@ include "mlir/Pass/PassBase.td"
// AffineToStandard
//===----------------------------------------------------------------------===//
-def ConvertAffineToStandardPass : Pass<"lower-affine"> {
+def ConvertAffineToStandard : Pass<"lower-affine"> {
let summary = "Lower Affine operations to a combination of Standard and SCF "
"operations";
let description = [{
@@ -65,6 +65,7 @@ def ConvertAffineToStandardPass : Pass<"lower-affine"> {
if they do not depend on the loop iterator value or on the result of
`affine.apply`.
}];
+ let constructor = "mlir::createLowerAffinePass()";
let dependentDialects = [
"memref::MemRefDialect",
"scf::SCFDialect",
@@ -76,11 +77,12 @@ def ConvertAffineToStandardPass : Pass<"lower-affine"> {
// AMDGPUToROCDL
//===----------------------------------------------------------------------===//
-def ConvertAMDGPUToROCDLPass : Pass<"convert-amdgpu-to-rocdl"> {
+def ConvertAMDGPUToROCDL : Pass<"convert-amdgpu-to-rocdl"> {
let summary = "Convert AMDGPU dialect to ROCDL dialect";
let description = [{
This pass converts supported AMDGPU ops to ROCDL dialect intrinsics.
}];
+ let constructor = "mlir::createConvertAMDGPUToROCDLPass()";
let dependentDialects = [
"LLVM::LLVMDialect",
"ROCDL::ROCDLDialect",
@@ -94,11 +96,12 @@ def ConvertAMDGPUToROCDLPass : Pass<"convert-amdgpu-to-rocdl"> {
// ArithmeticToLLVM
//===----------------------------------------------------------------------===//
-def ConvertArithmeticToLLVMPass : Pass<"convert-arith-to-llvm"> {
+def ConvertArithmeticToLLVM : Pass<"convert-arith-to-llvm"> {
let summary = "Convert Arithmetic dialect to LLVM dialect";
let description = [{
This pass converts supported Arithmetic ops to LLVM dialect instructions.
}];
+ let constructor = "mlir::arith::createConvertArithmeticToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
let options = [
Option<"indexBitwidth", "index-bitwidth", "unsigned",
@@ -111,9 +114,9 @@ def ConvertArithmeticToLLVMPass : Pass<"convert-arith-to-llvm"> {
// ArithmeticToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertArithmeticToSPIRVPass : Pass<"convert-arith-to-spirv"> {
+def ConvertArithmeticToSPIRV : Pass<"convert-arith-to-spirv"> {
let summary = "Convert Arithmetic dialect to SPIR-V dialect";
- let constructor = "mlir::createConvertArithmeticToSPIRVPass()";
+ let constructor = "mlir::arith::createConvertArithmeticToSPIRVPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
let options = [
Option<"emulateNon32BitScalarTypes", "emulate-non-32-bit-scalar-types",
@@ -127,13 +130,9 @@ def ConvertArithmeticToSPIRVPass : Pass<"convert-arith-to-spirv"> {
// ArmNeon2dToIntr
//===----------------------------------------------------------------------===//
-def ConvertArmNeon2dToIntrPass : Pass<"arm-neon-2d-to-intr"> {
+def ConvertArmNeon2dToIntr : Pass<"arm-neon-2d-to-intr"> {
let summary = "Convert Arm NEON structured ops to intrinsics";
- let description = [{
- Lower Arm NEON 2D ops to intrinsics, i.e. equivalent ops operating on
- flattened 1D vectors and mapping more directly to the corresponding Arm
- NEON instruction.
- }];
+ let constructor = "mlir::createConvertArmNeon2dToIntrPass()";
let dependentDialects = ["arm_neon::ArmNeonDialect", "vector::VectorDialect"];
}
@@ -141,7 +140,7 @@ def ConvertArmNeon2dToIntrPass : Pass<"arm-neon-2d-to-intr"> {
// AsyncToLLVM
//===----------------------------------------------------------------------===//
-def ConvertAsyncToLLVMPass : Pass<"convert-async-to-llvm", "ModuleOp"> {
+def ConvertAsyncToLLVM : Pass<"convert-async-to-llvm", "ModuleOp"> {
let summary = "Convert the operations from the async dialect into the LLVM "
"dialect";
let description = [{
@@ -159,7 +158,7 @@ def ConvertAsyncToLLVMPass : Pass<"convert-async-to-llvm", "ModuleOp"> {
// BufferizationToMemRef
//===----------------------------------------------------------------------===//
-def ConvertBufferizationToMemRefPass : Pass<"convert-bufferization-to-memref"> {
+def ConvertBufferizationToMemRef : Pass<"convert-bufferization-to-memref"> {
let summary = "Convert operations from the Bufferization dialect to the "
"MemRef dialect";
let description = [{
@@ -186,6 +185,7 @@ def ConvertBufferizationToMemRefPass : Pass<"convert-bufferization-to-memref"> {
and hence does not resolve any memory leaks.
}];
+ let constructor = "mlir::createBufferizationToMemRefPass()";
let dependentDialects = ["arith::ArithmeticDialect", "memref::MemRefDialect"];
}
@@ -193,8 +193,9 @@ def ConvertBufferizationToMemRefPass : Pass<"convert-bufferization-to-memref"> {
// ComplexToLLVM
//===----------------------------------------------------------------------===//
-def ConvertComplexToLLVMPass : Pass<"convert-complex-to-llvm"> {
+def ConvertComplexToLLVM : Pass<"convert-complex-to-llvm"> {
let summary = "Convert Complex dialect to LLVM dialect";
+ let constructor = "mlir::createConvertComplexToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
}
@@ -202,7 +203,7 @@ def ConvertComplexToLLVMPass : Pass<"convert-complex-to-llvm"> {
// ComplexToLibm
//===----------------------------------------------------------------------===//
-def ConvertComplexToLibmPass : Pass<"convert-complex-to-libm", "ModuleOp"> {
+def ConvertComplexToLibm : Pass<"convert-complex-to-libm", "ModuleOp"> {
let summary = "Convert Complex dialect to libm calls";
let description = [{
This pass converts supported Complex ops to libm calls.
@@ -217,8 +218,9 @@ def ConvertComplexToLibmPass : Pass<"convert-complex-to-libm", "ModuleOp"> {
// ComplexToStandard
//===----------------------------------------------------------------------===//
-def ConvertComplexToStandardPass : Pass<"convert-complex-to-standard"> {
+def ConvertComplexToStandard : Pass<"convert-complex-to-standard"> {
let summary = "Convert Complex dialect to standard dialect";
+ let constructor = "mlir::createConvertComplexToStandardPass()";
let dependentDialects = ["math::MathDialect"];
}
@@ -226,7 +228,7 @@ def ConvertComplexToStandardPass : Pass<"convert-complex-to-standard"> {
// ControlFlowToLLVM
//===----------------------------------------------------------------------===//
-def ConvertControlFlowToLLVMPass : Pass<"convert-cf-to-llvm", "ModuleOp"> {
+def ConvertControlFlowToLLVM : Pass<"convert-cf-to-llvm", "ModuleOp"> {
let summary = "Convert ControlFlow operations to the LLVM dialect";
let description = [{
Convert ControlFlow operations into LLVM IR dialect operations.
@@ -235,6 +237,7 @@ def ConvertControlFlowToLLVMPass : Pass<"convert-cf-to-llvm", "ModuleOp"> {
IR dialect operations, the pass will fail. Any LLVM IR operations or types
already present in the IR will be kept as is.
}];
+ let constructor = "mlir::cf::createConvertControlFlowToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
let options = [
Option<"indexBitwidth", "index-bitwidth", "unsigned",
@@ -247,7 +250,7 @@ def ConvertControlFlowToLLVMPass : Pass<"convert-cf-to-llvm", "ModuleOp"> {
// ControlFlowToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertControlFlowToSPIRVPass : Pass<"convert-cf-to-spirv"> {
+def ConvertControlFlowToSPIRV : Pass<"convert-cf-to-spirv"> {
let summary = "Convert ControlFlow dialect to SPIR-V dialect";
let constructor = "mlir::createConvertControlFlowToSPIRVPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
@@ -263,7 +266,7 @@ def ConvertControlFlowToSPIRVPass : Pass<"convert-cf-to-spirv"> {
// FuncToLLVM
//===----------------------------------------------------------------------===//
-def ConvertFuncToLLVMPass : Pass<"convert-func-to-llvm", "ModuleOp"> {
+def ConvertFuncToLLVM : Pass<"convert-func-to-llvm", "ModuleOp"> {
let summary = "Convert from the Func dialect to the LLVM dialect";
let description = [{
Convert Func dialect operations into the LLVM IR dialect operations.
@@ -308,7 +311,7 @@ def ConvertFuncToLLVMPass : Pass<"convert-func-to-llvm", "ModuleOp"> {
// FuncToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertFuncToSPIRVPass : Pass<"convert-func-to-spirv"> {
+def ConvertFuncToSPIRV : Pass<"convert-func-to-spirv"> {
let summary = "Convert Func dialect to SPIR-V dialect";
let constructor = "mlir::createConvertFuncToSPIRVPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
@@ -324,13 +327,13 @@ def ConvertFuncToSPIRVPass : Pass<"convert-func-to-spirv"> {
// GPUCommon
//===----------------------------------------------------------------------===//
-def ConvertGpuToLLVMPass : Pass<"gpu-to-llvm", "ModuleOp"> {
+def GpuToLLVMConversionPass : Pass<"gpu-to-llvm", "ModuleOp"> {
let summary = "Convert GPU dialect to LLVM dialect with GPU runtime calls";
- let constructor = "mlir::createConvertGpuToLLVMPass()";
+ let constructor = "mlir::createGpuToLLVMConversionPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
}
-def LowerHostCodeToLLVMPass : Pass<"lower-host-to-llvm", "ModuleOp"> {
+def LowerHostCodeToLLVM : Pass<"lower-host-to-llvm", "ModuleOp"> {
let summary = "Lowers the host module code and `gpu.launch_func` to LLVM";
let constructor = "mlir::createLowerHostCodeToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
@@ -340,9 +343,9 @@ def LowerHostCodeToLLVMPass : Pass<"lower-host-to-llvm", "ModuleOp"> {
// GPUToNVVM
//===----------------------------------------------------------------------===//
-def ConvertGpuToNVVMPass : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> {
+def ConvertGpuOpsToNVVMOps : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> {
let summary = "Generate NVVM operations for gpu operations";
- let constructor = "mlir::createConvertGpuToNVVMPass()";
+ let constructor = "mlir::createLowerGpuOpsToNVVMOpsPass()";
let dependentDialects = [
"cf::ControlFlowDialect",
"memref::MemRefDialect",
@@ -359,9 +362,9 @@ def ConvertGpuToNVVMPass : Pass<"convert-gpu-to-nvvm", "gpu::GPUModuleOp"> {
// GPUToROCDL
//===----------------------------------------------------------------------===//
-def ConvertGpuToROCDLPass : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> {
+def ConvertGpuOpsToROCDLOps : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> {
let summary = "Generate ROCDL operations for gpu operations";
- let constructor = "mlir::createConvertGpuToROCDLPass()";
+ let constructor = "mlir::createLowerGpuOpsToROCDLOpsPass()";
let dependentDialects = ["ROCDL::ROCDLDialect"];
let options = [
Option<"chipset", "chipset", "std::string",
@@ -389,7 +392,7 @@ def ConvertGpuToROCDLPass : Pass<"convert-gpu-to-rocdl", "gpu::GPUModuleOp"> {
// GPUToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertGPUToSPIRVPass : Pass<"convert-gpu-to-spirv", "ModuleOp"> {
+def ConvertGPUToSPIRV : Pass<"convert-gpu-to-spirv", "ModuleOp"> {
let summary = "Convert GPU dialect to SPIR-V dialect";
let description = [{
This pass converts supported GPU device ops to SPIR-V ops. It does not
@@ -411,7 +414,7 @@ def ConvertGPUToSPIRVPass : Pass<"convert-gpu-to-spirv", "ModuleOp"> {
// GPUToVulkan
//===----------------------------------------------------------------------===//
-def ConvertGpuLaunchFuncToVulkanLaunchFuncPass
+def ConvertGpuLaunchFuncToVulkanLaunchFunc
: Pass<"convert-gpu-launch-to-vulkan-launch", "ModuleOp"> {
let summary = "Convert gpu.launch_func to vulkanLaunch external call";
let description = [{
@@ -421,7 +424,7 @@ def ConvertGpuLaunchFuncToVulkanLaunchFuncPass
let dependentDialects = ["spirv::SPIRVDialect"];
}
-def ConvertVulkanLaunchFuncToVulkanCallsPass
+def ConvertVulkanLaunchFuncToVulkanCalls
: Pass<"launch-func-to-vulkan", "ModuleOp"> {
let summary = "Convert vulkanLaunch external call to Vulkan runtime external "
"calls";
@@ -436,7 +439,7 @@ def ConvertVulkanLaunchFuncToVulkanCallsPass
// LinalgToLLVM
//===----------------------------------------------------------------------===//
-def ConvertLinalgToLLVMPass : Pass<"convert-linalg-to-llvm", "ModuleOp"> {
+def ConvertLinalgToLLVM : Pass<"convert-linalg-to-llvm", "ModuleOp"> {
let summary = "Convert the operations from the linalg dialect into the LLVM "
"dialect";
let constructor = "mlir::createConvertLinalgToLLVMPass()";
@@ -447,7 +450,7 @@ def ConvertLinalgToLLVMPass : Pass<"convert-linalg-to-llvm", "ModuleOp"> {
// LinalgToStandard
//===----------------------------------------------------------------------===//
-def ConvertLinalgToStandardPass : Pass<"convert-linalg-to-std", "ModuleOp"> {
+def ConvertLinalgToStandard : Pass<"convert-linalg-to-std", "ModuleOp"> {
let summary = "Convert the operations from the linalg dialect into the "
"Standard dialect";
let constructor = "mlir::createConvertLinalgToStandardPass()";
@@ -458,13 +461,13 @@ def ConvertLinalgToStandardPass : Pass<"convert-linalg-to-std", "ModuleOp"> {
// LinalgToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertLinalgToSPIRVPass : Pass<"convert-linalg-to-spirv", "ModuleOp"> {
+def ConvertLinalgToSPIRV : Pass<"convert-linalg-to-spirv", "ModuleOp"> {
let summary = "Convert Linalg dialect to SPIR-V dialect";
let description = [{
This pass converts supported Linalg ops to SPIR-V ops. It's quite
experimental and are expected to migrate to other proper conversions.
}];
- let constructor = "mlir::createConvertLinalgToSPIRVPass()";
+ let constructor = "mlir::createLinalgToSPIRVPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
}
@@ -472,7 +475,7 @@ def ConvertLinalgToSPIRVPass : Pass<"convert-linalg-to-spirv", "ModuleOp"> {
// MathToLibm
//===----------------------------------------------------------------------===//
-def ConvertMathToLibmPass : Pass<"convert-math-to-libm", "ModuleOp"> {
+def ConvertMathToLibm : Pass<"convert-math-to-libm", "ModuleOp"> {
let summary = "Convert Math dialect to libm calls";
let description = [{
This pass converts supported Math ops to libm calls.
@@ -489,11 +492,12 @@ def ConvertMathToLibmPass : Pass<"convert-math-to-libm", "ModuleOp"> {
// MathToLLVM
//===----------------------------------------------------------------------===//
-def ConvertMathToLLVMPass : Pass<"convert-math-to-llvm"> {
+def ConvertMathToLLVM : Pass<"convert-math-to-llvm"> {
let summary = "Convert Math dialect to LLVM dialect";
let description = [{
This pass converts supported Math ops to LLVM dialect intrinsics.
}];
+ let constructor = "mlir::createConvertMathToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
}
@@ -501,7 +505,7 @@ def ConvertMathToLLVMPass : Pass<"convert-math-to-llvm"> {
// MathToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertMathToSPIRVPass : Pass<"convert-math-to-spirv"> {
+def ConvertMathToSPIRV : Pass<"convert-math-to-spirv"> {
let summary = "Convert Math dialect to SPIR-V dialect";
let constructor = "mlir::createConvertMathToSPIRVPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
@@ -511,13 +515,14 @@ def ConvertMathToSPIRVPass : Pass<"convert-math-to-spirv"> {
// MathToFuncs
//===----------------------------------------------------------------------===//
-def ConvertMathToFuncsPass : Pass<"convert-math-to-funcs", "ModuleOp"> {
+def ConvertMathToFuncs : Pass<"convert-math-to-funcs", "ModuleOp"> {
let summary = "Convert Math operations to calls of outlined implementations.";
let description = [{
This pass converts supported Math ops to calls of compiler generated
functions implementing these operations in software.
The LLVM dialect is used for LinkonceODR linkage of the generated functions.
}];
+ let constructor = "mlir::createConvertMathToFuncsPass()";
let dependentDialects = [
"arith::ArithmeticDialect",
"cf::ControlFlowDialect",
@@ -531,9 +536,10 @@ def ConvertMathToFuncsPass : Pass<"convert-math-to-funcs", "ModuleOp"> {
// MemRefToLLVM
//===----------------------------------------------------------------------===//
-def ConvertMemRefToLLVMPass : Pass<"convert-memref-to-llvm", "ModuleOp"> {
+def ConvertMemRefToLLVM : Pass<"convert-memref-to-llvm", "ModuleOp"> {
let summary = "Convert operations from the MemRef dialect to the LLVM "
"dialect";
+ let constructor = "mlir::createMemRefToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
let options = [
Option<"useAlignedAlloc", "use-aligned-alloc", "bool", /*default=*/"false",
@@ -553,7 +559,7 @@ def ConvertMemRefToLLVMPass : Pass<"convert-memref-to-llvm", "ModuleOp"> {
// MemRefToSPIRV
//===----------------------------------------------------------------------===//
-def MapMemRefStorageClassPass : Pass<"map-memref-spirv-storage-class"> {
+def MapMemRefStorageClass : Pass<"map-memref-spirv-storage-class"> {
let summary = "Map numeric MemRef memory spaces to SPIR-V storage classes";
let constructor = "mlir::createMapMemRefStorageClassPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
@@ -563,7 +569,7 @@ def MapMemRefStorageClassPass : Pass<"map-memref-spirv-storage-class"> {
];
}
-def ConvertMemRefToSPIRVPass : Pass<"convert-memref-to-spirv"> {
+def ConvertMemRefToSPIRV : Pass<"convert-memref-to-spirv"> {
let summary = "Convert MemRef dialect to SPIR-V dialect";
let constructor = "mlir::createConvertMemRefToSPIRVPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
@@ -578,11 +584,12 @@ def ConvertMemRefToSPIRVPass : Pass<"convert-memref-to-spirv"> {
// NVGPUToNVVM
//===----------------------------------------------------------------------===//
-def ConvertNVGPUToNVVMPass : Pass<"convert-nvgpu-to-nvvm"> {
+def ConvertNVGPUToNVVM : Pass<"convert-nvgpu-to-nvvm"> {
let summary = "Convert NVGPU dialect to NVVM dialect";
let description = [{
This pass converts supported NVGPU ops to NVVM dialect intrinsics.
}];
+ let constructor = "mlir::createConvertNVGPUToNVVMPass()";
let dependentDialects = [
"NVVM::NVVMDialect",
];
@@ -593,7 +600,7 @@ def ConvertNVGPUToNVVMPass : Pass<"convert-nvgpu-to-nvvm"> {
// OpenACCToSCF
//===----------------------------------------------------------------------===//
-def ConvertOpenACCToSCFPass : Pass<"convert-openacc-to-scf", "ModuleOp"> {
+def ConvertOpenACCToSCF : Pass<"convert-openacc-to-scf", "ModuleOp"> {
let summary = "Convert the OpenACC ops to OpenACC with SCF dialect";
let constructor = "mlir::createConvertOpenACCToSCFPass()";
let dependentDialects = ["scf::SCFDialect", "acc::OpenACCDialect"];
@@ -603,7 +610,7 @@ def ConvertOpenACCToSCFPass : Pass<"convert-openacc-to-scf", "ModuleOp"> {
// OpenACCToLLVM
//===----------------------------------------------------------------------===//
-def ConvertOpenACCToLLVMPass : Pass<"convert-openacc-to-llvm", "ModuleOp"> {
+def ConvertOpenACCToLLVM : Pass<"convert-openacc-to-llvm", "ModuleOp"> {
let summary = "Convert the OpenACC ops to LLVM dialect";
let constructor = "mlir::createConvertOpenACCToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
@@ -613,7 +620,7 @@ def ConvertOpenACCToLLVMPass : Pass<"convert-openacc-to-llvm", "ModuleOp"> {
// OpenMPToLLVM
//===----------------------------------------------------------------------===//
-def ConvertOpenMPToLLVMPass : Pass<"convert-openmp-to-llvm", "ModuleOp"> {
+def ConvertOpenMPToLLVM : Pass<"convert-openmp-to-llvm", "ModuleOp"> {
let summary = "Convert the OpenMP ops to OpenMP ops with LLVM dialect";
let constructor = "mlir::createConvertOpenMPToLLVMPass()";
let dependentDialects = ["LLVM::LLVMDialect"];
@@ -623,7 +630,7 @@ def ConvertOpenMPToLLVMPass : Pass<"convert-openmp-to-llvm", "ModuleOp"> {
// PDLToPDLInterp
//===----------------------------------------------------------------------===//
-def ConvertPDLToPDLInterpPass : Pass<"convert-pdl-to-pdl-interp", "ModuleOp"> {
+def ConvertPDLToPDLInterp : Pass<"convert-pdl-to-pdl-interp", "ModuleOp"> {
let summary = "Convert PDL ops to PDL interpreter ops";
let constructor = "mlir::createPDLToPDLInterpPass()";
let dependentDialects = ["pdl_interp::PDLInterpDialect"];
@@ -633,7 +640,7 @@ def ConvertPDLToPDLInterpPass : Pass<"convert-pdl-to-pdl-interp", "ModuleOp"> {
// ReconcileUnrealizedCasts
//===----------------------------------------------------------------------===//
-def ReconcileUnrealizedCastsPass : Pass<"reconcile-unrealized-casts"> {
+def ReconcileUnrealizedCasts : Pass<"reconcile-unrealized-casts"> {
let summary = "Simplify and eliminate unrealized conversion casts";
let description = [{
Eliminate `unrealized_conversion_cast` operations, commonly introduced by
@@ -652,15 +659,17 @@ def ReconcileUnrealizedCastsPass : Pass<"reconcile-unrealized-casts"> {
and the producer operation is converted by another pass, each of which
produces an unrealized cast. This pass can be used to clean up the IR.
}];
+ let constructor = "mlir::createReconcileUnrealizedCastsPass()";
}
//===----------------------------------------------------------------------===//
// SCFToControlFlow
//===----------------------------------------------------------------------===//
-def ConvertSCFToControlFlowPass : Pass<"convert-scf-to-cf"> {
+def SCFToControlFlow : Pass<"convert-scf-to-cf"> {
let summary = "Convert SCF dialect to ControlFlow dialect, replacing structured"
" control flow with a CFG";
+ let constructor = "mlir::createConvertSCFToCFPass()";
let dependentDialects = ["cf::ControlFlowDialect"];
}
@@ -668,7 +677,7 @@ def ConvertSCFToControlFlowPass : Pass<"convert-scf-to-cf"> {
// SCFToOpenMP
//===----------------------------------------------------------------------===//
-def ConvertSCFToOpenMPPass : Pass<"convert-scf-to-openmp", "ModuleOp"> {
+def ConvertSCFToOpenMP : Pass<"convert-scf-to-openmp", "ModuleOp"> {
let summary = "Convert SCF parallel loop to OpenMP parallel + workshare "
"constructs.";
let constructor = "mlir::createConvertSCFToOpenMPPass()";
@@ -680,7 +689,7 @@ def ConvertSCFToOpenMPPass : Pass<"convert-scf-to-openmp", "ModuleOp"> {
// SCFToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertSCFToSPIRVPass : Pass<"convert-scf-to-spirv"> {
+def SCFToSPIRV : Pass<"convert-scf-to-spirv"> {
let summary = "Convert SCF dialect to SPIR-V dialect.";
let description = [{
This pass converts SCF ops into SPIR-V structured control flow ops.
@@ -697,7 +706,7 @@ def ConvertSCFToSPIRVPass : Pass<"convert-scf-to-spirv"> {
// SCFToGPU
//===----------------------------------------------------------------------===//
-def ConvertAffineForToGPUPass
+def ConvertAffineForToGPU
: InterfacePass<"convert-affine-for-to-gpu", "FunctionOpInterface"> {
let summary = "Convert top-level AffineFor Ops to GPU kernels";
let constructor = "mlir::createAffineForToGPUPass()";
@@ -710,14 +719,9 @@ def ConvertAffineForToGPUPass
];
}
-def ConvertParallelLoopToGpuPass : Pass<"convert-parallel-loops-to-gpu"> {
+def ConvertParallelLoopToGpu : Pass<"convert-parallel-loops-to-gpu"> {
let summary = "Convert mapped scf.parallel ops to gpu launch operations";
- let description = [{
- Convert `scf.parallel` operations into a `gpu.launch` operation. The
- mapping of loop dimensions to launch dimensions is derived from mapping
- attributes. See `ParallelToGpuLaunchLowering::matchAndRewrite` for a
- description of the used attributes.
- }];
+ let constructor = "mlir::createParallelLoopToGpuPass()";
let dependentDialects = ["AffineDialect", "gpu::GPUDialect"];
}
@@ -725,7 +729,7 @@ def ConvertParallelLoopToGpuPass : Pass<"convert-parallel-loops-to-gpu"> {
// ShapeToStandard
//===----------------------------------------------------------------------===//
-def ConvertShapeToStandardPass : Pass<"convert-shape-to-std", "ModuleOp"> {
+def ConvertShapeToStandard : Pass<"convert-shape-to-std", "ModuleOp"> {
let summary = "Convert operations from the shape dialect into the standard "
"dialect";
let constructor = "mlir::createConvertShapeToStandardPass()";
@@ -734,7 +738,7 @@ def ConvertShapeToStandardPass : Pass<"convert-shape-to-std", "ModuleOp"> {
];
}
-def ConvertShapeConstraintsPass : Pass<"convert-shape-constraints"> {
+def ConvertShapeConstraints : Pass<"convert-shape-constraints"> {
let summary = "Convert shape constraint operations to the standard dialect";
let description = [{
This pass eliminates shape constraints from the program, converting them to
@@ -745,6 +749,7 @@ def ConvertShapeConstraintsPass : Pass<"convert-shape-constraints"> {
can happen at a
diff erent part of the program than general shape
computation lowering.
}];
+ let constructor = "mlir::createConvertShapeConstraintsPass()";
let dependentDialects = ["cf::ControlFlowDialect", "scf::SCFDialect"];
}
@@ -752,7 +757,7 @@ def ConvertShapeConstraintsPass : Pass<"convert-shape-constraints"> {
// SPIRVToLLVM
//===----------------------------------------------------------------------===//
-def ConvertSPIRVToLLVMPass : Pass<"convert-spirv-to-llvm", "ModuleOp"> {
+def ConvertSPIRVToLLVM : Pass<"convert-spirv-to-llvm", "ModuleOp"> {
let summary = "Convert SPIR-V dialect to LLVM dialect";
let description = [{
See https://mlir.llvm.org/docs/SPIRVToLLVMDialectConversion/
@@ -766,7 +771,7 @@ def ConvertSPIRVToLLVMPass : Pass<"convert-spirv-to-llvm", "ModuleOp"> {
// TensorToLinalg
//===----------------------------------------------------------------------===//
-def ConvertTensorToLinalgPass : Pass<"convert-tensor-to-linalg", "ModuleOp"> {
+def ConvertTensorToLinalg : Pass<"convert-tensor-to-linalg", "ModuleOp"> {
let summary = "Convert some Tensor dialect ops to Linalg dialect";
let constructor = "mlir::createConvertTensorToLinalgPass()";
let dependentDialects = [
@@ -775,11 +780,12 @@ def ConvertTensorToLinalgPass : Pass<"convert-tensor-to-linalg", "ModuleOp"> {
];
}
+
//===----------------------------------------------------------------------===//
// TensorToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertTensorToSPIRVPass : Pass<"convert-tensor-to-spirv"> {
+def ConvertTensorToSPIRV : Pass<"convert-tensor-to-spirv"> {
let summary = "Convert Tensor dialect to SPIR-V dialect";
let constructor = "mlir::createConvertTensorToSPIRVPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
@@ -795,7 +801,7 @@ def ConvertTensorToSPIRVPass : Pass<"convert-tensor-to-spirv"> {
// TosaToArith
//===----------------------------------------------------------------------===//
-def ConvertTosaToArithPass : Pass<"tosa-to-arith"> {
+def TosaToArith : Pass<"tosa-to-arith"> {
let summary = "Lower TOSA to the Arith dialect";
let dependentDialects = [
"arith::ArithmeticDialect",
@@ -814,52 +820,60 @@ def ConvertTosaToArithPass : Pass<"tosa-to-arith"> {
"bool", /*default=*/"false",
"Whether to prioritze lowering to 32-bit operations">
];
+
+ let constructor = "tosa::createTosaToArith()";
}
//===----------------------------------------------------------------------===//
// TosaToLinalg
//===----------------------------------------------------------------------===//
-def ConvertTosaToLinalgPass
+def TosaToLinalg
: InterfacePass<"tosa-to-linalg", "FunctionOpInterface"> {
let summary = "Lower TOSA to LinAlg on tensors";
let description = [{
Pass that converts TOSA operations to the equivalent operations using the
tensor operations in LinAlg.
}];
+
+ let constructor = "tosa::createTosaToLinalg()";
}
//===----------------------------------------------------------------------===//
// TosaToLinalgNamed
//===----------------------------------------------------------------------===//
-def ConvertTosaToLinalgNamedPass
+def TosaToLinalgNamed
: InterfacePass<"tosa-to-linalg-named", "FunctionOpInterface"> {
let summary = "Lower TOSA to LinAlg named operations";
let description = [{
Pass that converts TOSA operations to the equivalent operations using the
Linalg named operations.
}];
+
+ let constructor = "tosa::createTosaToLinalgNamed()";
}
//===----------------------------------------------------------------------===//
// TosaToSCF
//===----------------------------------------------------------------------===//
-def ConvertTosaToSCFPass : Pass<"tosa-to-scf"> {
+def TosaToSCF : Pass<"tosa-to-scf"> {
let summary = "Lower TOSA to the SCF dialect";
let dependentDialects = ["tensor::TensorDialect, scf::SCFDialect"];
let description = [{
Pass that converts TOSA's control flow operations to the equivalent SCF
operations.
}];
+
+ let constructor = "tosa::createTosaToSCF()";
}
//===----------------------------------------------------------------------===//
// TosaToTensor
//===----------------------------------------------------------------------===//
-def ConvertTosaToTensorPass : Pass<"tosa-to-tensor"> {
+def TosaToTensor : Pass<"tosa-to-tensor"> {
let summary = "Lower TOSA to the Tensor dialect";
let dependentDialects = [
"tensor::TensorDialect",
@@ -868,13 +882,15 @@ def ConvertTosaToTensorPass : Pass<"tosa-to-tensor"> {
Pass that converts TOSA operations to the equivalent operations using the
operations in the Tensor dialect.
}];
+
+ let constructor = "tosa::createTosaToTensor()";
}
//===----------------------------------------------------------------------===//
// VectorToGPU
//===----------------------------------------------------------------------===//
-def ConvertVectorToGPUPass : Pass<"convert-vector-to-gpu"> {
+def ConvertVectorToGPU : Pass<"convert-vector-to-gpu"> {
let summary = "Lower the operations from the vector dialect into the GPU "
"dialect";
let constructor = "mlir::createConvertVectorToGPUPass()";
@@ -893,7 +909,7 @@ def ConvertVectorToGPUPass : Pass<"convert-vector-to-gpu"> {
// VectorToSCF
//===----------------------------------------------------------------------===//
-def ConvertVectorToSCFPass : Pass<"convert-vector-to-scf"> {
+def ConvertVectorToSCF : Pass<"convert-vector-to-scf"> {
let summary = "Lower the operations from the vector dialect into the SCF "
"dialect";
let constructor = "mlir::createConvertVectorToSCFPass()";
@@ -919,7 +935,7 @@ def ConvertVectorToSCFPass : Pass<"convert-vector-to-scf"> {
// VectorToLLVM
//===----------------------------------------------------------------------===//
-def ConvertVectorToLLVMPass : Pass<"convert-vector-to-llvm", "ModuleOp"> {
+def ConvertVectorToLLVM : Pass<"convert-vector-to-llvm", "ModuleOp"> {
let summary = "Lower the operations from the vector dialect into the LLVM "
"dialect";
let description = [{
@@ -966,7 +982,7 @@ def ConvertVectorToLLVMPass : Pass<"convert-vector-to-llvm", "ModuleOp"> {
// VectorToSPIRV
//===----------------------------------------------------------------------===//
-def ConvertVectorToSPIRVPass : Pass<"convert-vector-to-spirv"> {
+def ConvertVectorToSPIRV : Pass<"convert-vector-to-spirv"> {
let summary = "Convert Vector dialect to SPIR-V dialect";
let constructor = "mlir::createConvertVectorToSPIRVPass()";
let dependentDialects = ["spirv::SPIRVDialect"];
diff --git a/mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h b/mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h
index 92fc8b00b070d..5859e6e83321e 100644
--- a/mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h
+++ b/mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h
@@ -15,13 +15,13 @@ namespace mlir {
class Pass;
class RewritePatternSet;
-#define GEN_PASS_DECL_RECONCILEUNREALIZEDCASTSPASS
-#include "mlir/Conversion/Passes.h.inc"
+/// Creates a pass that eliminates noop `unrealized_conversion_cast` operation
+/// sequences.
+std::unique_ptr<Pass> createReconcileUnrealizedCastsPass();
/// Populates `patterns` with rewrite patterns that eliminate noop
/// `unrealized_conversion_cast` operation sequences.
void populateReconcileUnrealizedCastsPatterns(RewritePatternSet &patterns);
-
} // namespace mlir
#endif // MLIR_CONVERSION_RECONCILEUNREALIZEDCASTS_RECONCILEUNREALIZEDCASTS_H_
diff --git a/mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h b/mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h
index fc544889a114e..d26b0b2711b15 100644
--- a/mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h
+++ b/mlir/include/mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h
@@ -15,13 +15,14 @@ namespace mlir {
class Pass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTSCFTOCONTROLFLOWPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Collect a set of patterns to convert SCF operations to CFG branch-based
/// operations within the ControlFlow dialect.
void populateSCFToControlFlowConversionPatterns(RewritePatternSet &patterns);
+/// Creates a pass to convert SCF operations to CFG branch-based operation in
+/// the ControlFlow dialect.
+std::unique_ptr<Pass> createConvertSCFToCFPass();
+
} // namespace mlir
#endif // MLIR_CONVERSION_SCFTOCONTROLFLOW_SCFTOCONTROLFLOW_H_
diff --git a/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h b/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h
index 39c7ba8755ce6..08f34b9e22f32 100644
--- a/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h
+++ b/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPUPass.h
@@ -18,10 +18,6 @@ template <typename T>
class InterfacePass;
class Pass;
-#define GEN_PASS_DECL_CONVERTAFFINEFORTOGPUPASS
-#define GEN_PASS_DECL_CONVERTPARALLELLOOPTOGPUPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Create a pass that converts loop nests into GPU kernels. It considers
/// top-level affine.for operations as roots of loop nests and converts them to
/// the gpu.launch operations if possible.
@@ -34,6 +30,12 @@ std::unique_ptr<InterfacePass<FunctionOpInterface>>
createAffineForToGPUPass(unsigned numBlockDims, unsigned numThreadDims);
std::unique_ptr<InterfacePass<FunctionOpInterface>> createAffineForToGPUPass();
+/// Creates a pass that converts scf.parallel operations into a gpu.launch
+/// operation. The mapping of loop dimensions to launch dimensions is derived
+/// from mapping attributes. See ParallelToGpuLaunchLowering::matchAndRewrite
+/// for a description of the used attributes.
+std::unique_ptr<Pass> createParallelLoopToGpuPass();
+
} // namespace mlir
#endif // MLIR_CONVERSION_SCFTOGPU_SCFTOGPUPASS_H_
diff --git a/mlir/include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h b/mlir/include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h
index b984f8a3d7842..4000bc1df46b2 100644
--- a/mlir/include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h
+++ b/mlir/include/mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h
@@ -16,9 +16,6 @@ class ModuleOp;
template <typename T>
class OperationPass;
-#define GEN_PASS_DECL_CONVERTSCFTOOPENMPPASS
-#include "mlir/Conversion/Passes.h.inc"
-
std::unique_ptr<OperationPass<ModuleOp>> createConvertSCFToOpenMPPass();
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h b/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h
index 87b586849a697..4299537981db3 100644
--- a/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h
@@ -18,9 +18,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_CONVERTSCFTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert SCF ops into SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertSCFToSPIRVPass();
diff --git a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
index 2c1505d6beacb..7204e64d047bd 100644
--- a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
+++ b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
@@ -20,10 +20,6 @@ class ModuleOp;
template <typename T>
class OperationPass;
-#define GEN_PASS_DECL_LOWERHOSTCODETOLLVMPASS
-#define GEN_PASS_DECL_CONVERTSPIRVTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to emulate `gpu.launch_func` call in LLVM dialect and lower
/// the host module code to LLVM.
///
diff --git a/mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h b/mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h
index 997b702904627..607f968d9c06e 100644
--- a/mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h
+++ b/mlir/include/mlir/Conversion/ShapeToStandard/ShapeToStandard.h
@@ -19,16 +19,14 @@ template <typename T>
class OperationPass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTSHAPECONSTRAINTSPASS
-#define GEN_PASS_DECL_CONVERTSHAPETOSTANDARDPASS
-#include "mlir/Conversion/Passes.h.inc"
-
void populateShapeToStandardConversionPatterns(RewritePatternSet &patterns);
+std::unique_ptr<OperationPass<ModuleOp>> createConvertShapeToStandardPass();
+
void populateConvertShapeConstraintsConversionPatterns(
RewritePatternSet &patterns);
-std::unique_ptr<OperationPass<ModuleOp>> createConvertShapeToStandardPass();
+std::unique_ptr<Pass> createConvertShapeConstraintsPass();
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h b/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h
index b70aa1d8f33c7..2f32179cd2184 100644
--- a/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h
+++ b/mlir/include/mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h
@@ -18,9 +18,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_CONVERTTENSORTOLINALGPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert Tensor ops to Linalg ops.
std::unique_ptr<OperationPass<ModuleOp>> createConvertTensorToLinalgPass();
diff --git a/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h b/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h
index 2d377623a58a5..5f9081f0bb3ad 100644
--- a/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h
@@ -18,9 +18,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_CONVERTTENSORTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert Tensor ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertTensorToSPIRVPass();
diff --git a/mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h b/mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
index e6ad7354c5ed2..62f5a0f6d8712 100644
--- a/mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
+++ b/mlir/include/mlir/Conversion/TosaToArith/TosaToArith.h
@@ -16,12 +16,10 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
-
-#define GEN_PASS_DECL_CONVERTTOSATOARITHPASS
-#include "mlir/Conversion/Passes.h.inc"
-
namespace tosa {
+std::unique_ptr<Pass> createTosaToArith();
+
void populateTosaToArithConversionPatterns(RewritePatternSet *patterns);
void populateTosaRescaleToArithConversionPatterns(RewritePatternSet *patterns,
diff --git a/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h b/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
index 73c1b9928779d..fc7fd3790cbf5 100644
--- a/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
+++ b/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
@@ -17,13 +17,11 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
-
-#define GEN_PASS_DECL_CONVERTTOSATOLINALGPASS
-#define GEN_PASS_DECL_CONVERTTOSATOLINALGNAMEDPASS
-#include "mlir/Conversion/Passes.h.inc"
-
namespace tosa {
+std::unique_ptr<Pass> createTosaToLinalg();
+std::unique_ptr<Pass> createTosaToLinalgNamed();
+
/// Populates passes to convert from TOSA to Linalg on buffers. At the end of
/// the pass, the function will only contain linalg ops or standard ops if the
/// pipeline succeeds. The option to disable decompositions is available for
diff --git a/mlir/include/mlir/Conversion/TosaToSCF/TosaToSCF.h b/mlir/include/mlir/Conversion/TosaToSCF/TosaToSCF.h
index b2cd5f8b6c1ca..e3b2e04dd61fd 100644
--- a/mlir/include/mlir/Conversion/TosaToSCF/TosaToSCF.h
+++ b/mlir/include/mlir/Conversion/TosaToSCF/TosaToSCF.h
@@ -16,12 +16,10 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
-
-#define GEN_PASS_DECL_CONVERTTOSATOSCFPASS
-#include "mlir/Conversion/Passes.h.inc"
-
namespace tosa {
+std::unique_ptr<Pass> createTosaToSCF();
+
void populateTosaToSCFConversionPatterns(RewritePatternSet *patterns);
/// Populates passes to convert from TOSA to SCF.
diff --git a/mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h b/mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h
index dfe49c6849579..3a686e5ef00e9 100644
--- a/mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h
+++ b/mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h
@@ -16,12 +16,10 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
-
-#define GEN_PASS_DECL_CONVERTTOSATOTENSORPASS
-#include "mlir/Conversion/Passes.h.inc"
-
namespace tosa {
+std::unique_ptr<Pass> createTosaToTensor();
+
void populateTosaToTensorConversionPatterns(RewritePatternSet *patterns);
} // namespace tosa
diff --git a/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h b/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h
index 473917dac8d44..1ba5b3f90d9a8 100644
--- a/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h
+++ b/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h
@@ -16,9 +16,6 @@ class MLIRContext;
class Pass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTVECTORTOGPUPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Patterns to transform vector ops into a canonical form to convert to MMA
/// matrix operations. If `useNvGpu` is true, then the patterns will populated
/// will prepare for conversion to `nvgpu` mma operations rather than the `gpu`
diff --git a/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h b/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
index 33aeec7c66e95..80a6454a42498 100644
--- a/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
+++ b/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h
@@ -16,9 +16,6 @@ class ModuleOp;
template <typename T>
class OperationPass;
-#define GEN_PASS_DECL_CONVERTVECTORTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Options to control Vector to LLVM lowering.
///
/// This should kept in sync with VectorToLLVM options defined for the
diff --git a/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h b/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
index 492067d0fa1e5..1f649f358a2a4 100644
--- a/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
+++ b/mlir/include/mlir/Conversion/VectorToSCF/VectorToSCF.h
@@ -16,9 +16,6 @@ class MLIRContext;
class Pass;
class RewritePatternSet;
-#define GEN_PASS_DECL_CONVERTVECTORTOSCFPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// When lowering an N-d vector transfer op to an (N-1)-d vector transfer op,
/// a temporary buffer is created through which individual (N-1)-d vector are
/// staged. This pattern can be applied multiple time, until the transfer op
diff --git a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h
index 859adc0a7a33d..5335221bbd42f 100644
--- a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h
+++ b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h
@@ -18,9 +18,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_CONVERTVECTORTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-
/// Creates a pass to convert Vector Ops to SPIR-V ops.
std::unique_ptr<OperationPass<>> createConvertVectorToSPIRVPass();
diff --git a/mlir/include/mlir/Dialect/Affine/Passes.h b/mlir/include/mlir/Dialect/Affine/Passes.h
index a339294d3de13..bab315ecffde4 100644
--- a/mlir/include/mlir/Dialect/Affine/Passes.h
+++ b/mlir/include/mlir/Dialect/Affine/Passes.h
@@ -28,22 +28,6 @@ class AffineForOp;
/// producer-consumer and sibling fusion.
enum FusionMode { Greedy, ProducerConsumer, Sibling };
-#define GEN_PASS_DECL_AFFINEDATACOPYGENERATIONPASS
-#define GEN_PASS_DECL_AFFINELOOPFUSIONPASS
-#define GEN_PASS_DECL_AFFINELOOPINVARIANTCODEMOTIONPASS
-#define GEN_PASS_DECL_AFFINELOOPTILINGPASS
-#define GEN_PASS_DECL_AFFINELOOPUNROLLPASS
-#define GEN_PASS_DECL_AFFINELOOPUNROLLANDJAMPASS
-#define GEN_PASS_DECL_AFFINEPIPELINEDATATRANSFERPASS
-#define GEN_PASS_DECL_AFFINESCALARREPLACEMENTPASS
-#define GEN_PASS_DECL_AFFINEVECTORIZEPASS
-#define GEN_PASS_DECL_AFFINEPARALLELIZEPASS
-#define GEN_PASS_DECL_AFFINELOOPNORMALIZEPASS
-#define GEN_PASS_DECL_LOOPCOALESCINGPASS
-#define GEN_PASS_DECL_SIMPLIFYAFFINESTRUCTURESPASS
-#define GEN_PASS_DECL_AFFINEEXPANDINDEXOPSPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-
/// Creates a simplification pass for affine structures (maps and sets). In
/// addition, this pass also normalizes memrefs to have the trivial (identity)
/// layout map.
diff --git a/mlir/include/mlir/Dialect/Affine/Passes.td b/mlir/include/mlir/Dialect/Affine/Passes.td
index 48c422b365f1e..1f31bccf5f861 100644
--- a/mlir/include/mlir/Dialect/Affine/Passes.td
+++ b/mlir/include/mlir/Dialect/Affine/Passes.td
@@ -15,7 +15,7 @@
include "mlir/Pass/PassBase.td"
-def AffineDataCopyGenerationPass : Pass<"affine-data-copy-generate", "func::FuncOp"> {
+def AffineDataCopyGeneration : Pass<"affine-data-copy-generate", "func::FuncOp"> {
let summary = "Generate explicit copying for affine memory operations";
let constructor = "mlir::createAffineDataCopyGenerationPass()";
let dependentDialects = ["memref::MemRefDialect"];
@@ -43,7 +43,7 @@ def AffineDataCopyGenerationPass : Pass<"affine-data-copy-generate", "func::Func
];
}
-def AffineLoopFusionPass : Pass<"affine-loop-fusion", "func::FuncOp"> {
+def AffineLoopFusion : Pass<"affine-loop-fusion", "func::FuncOp"> {
let summary = "Fuse affine loop nests";
let description = [{
This pass performs fusion of loop nests using a slicing-based approach. It
@@ -175,13 +175,13 @@ def AffineLoopFusionPass : Pass<"affine-loop-fusion", "func::FuncOp"> {
let dependentDialects = ["memref::MemRefDialect"];
}
-def AffineLoopInvariantCodeMotionPass
+def AffineLoopInvariantCodeMotion
: Pass<"affine-loop-invariant-code-motion", "func::FuncOp"> {
let summary = "Hoist loop invariant instructions outside of affine loops";
let constructor = "mlir::createAffineLoopInvariantCodeMotionPass()";
}
-def AffineLoopTilingPass : Pass<"affine-loop-tile", "func::FuncOp"> {
+def AffineLoopTiling : Pass<"affine-loop-tile", "func::FuncOp"> {
let summary = "Tile affine loop nests";
let constructor = "mlir::createLoopTilingPass()";
let options = [
@@ -197,7 +197,7 @@ def AffineLoopTilingPass : Pass<"affine-loop-tile", "func::FuncOp"> {
];
}
-def AffineLoopUnrollPass : Pass<"affine-loop-unroll", "func::FuncOp"> {
+def AffineLoopUnroll : Pass<"affine-loop-unroll", "func::FuncOp"> {
let summary = "Unroll affine loops";
let constructor = "mlir::createLoopUnrollPass()";
let options = [
@@ -217,7 +217,7 @@ def AffineLoopUnrollPass : Pass<"affine-loop-unroll", "func::FuncOp"> {
];
}
-def AffineLoopUnrollAndJamPass : Pass<"affine-loop-unroll-jam", "func::FuncOp"> {
+def AffineLoopUnrollAndJam : Pass<"affine-loop-unroll-jam", "func::FuncOp"> {
let summary = "Unroll and jam affine loops";
let constructor = "mlir::createLoopUnrollAndJamPass()";
let options = [
@@ -227,7 +227,7 @@ def AffineLoopUnrollAndJamPass : Pass<"affine-loop-unroll-jam", "func::FuncOp">
];
}
-def AffinePipelineDataTransferPass
+def AffinePipelineDataTransfer
: Pass<"affine-pipeline-data-transfer", "func::FuncOp"> {
let summary = "Pipeline non-blocking data transfers between explicitly "
"managed levels of the memory hierarchy";
@@ -296,7 +296,7 @@ def AffinePipelineDataTransferPass
let constructor = "mlir::createPipelineDataTransferPass()";
}
-def AffineScalarReplacementPass : Pass<"affine-scalrep", "func::FuncOp"> {
+def AffineScalarReplacement : Pass<"affine-scalrep", "func::FuncOp"> {
let summary = "Replace affine memref acceses by scalars by forwarding stores "
"to loads and eliminating redundant loads";
let description = [{
@@ -342,7 +342,7 @@ def AffineScalarReplacementPass : Pass<"affine-scalrep", "func::FuncOp"> {
let constructor = "mlir::createAffineScalarReplacementPass()";
}
-def AffineVectorizePass : Pass<"affine-super-vectorize", "func::FuncOp"> {
+def AffineVectorize : Pass<"affine-super-vectorize", "func::FuncOp"> {
let summary = "Vectorize to a target independent n-D vector abstraction";
let constructor = "mlir::createSuperVectorizePass()";
let dependentDialects = ["vector::VectorDialect"];
@@ -366,7 +366,7 @@ def AffineVectorizePass : Pass<"affine-super-vectorize", "func::FuncOp"> {
];
}
-def AffineParallelizePass : Pass<"affine-parallelize", "func::FuncOp"> {
+def AffineParallelize : Pass<"affine-parallelize", "func::FuncOp"> {
let summary = "Convert affine.for ops into 1-D affine.parallel";
let constructor = "mlir::createAffineParallelizePass()";
let options = [
@@ -379,25 +379,25 @@ def AffineParallelizePass : Pass<"affine-parallelize", "func::FuncOp"> {
];
}
-def AffineLoopNormalizePass : Pass<"affine-loop-normalize", "func::FuncOp"> {
+def AffineLoopNormalize : Pass<"affine-loop-normalize", "func::FuncOp"> {
let summary = "Apply normalization transformations to affine loop-like ops";
let constructor = "mlir::createAffineLoopNormalizePass()";
}
-def LoopCoalescingPass : Pass<"affine-loop-coalescing", "func::FuncOp"> {
+def LoopCoalescing : Pass<"affine-loop-coalescing", "func::FuncOp"> {
let summary = "Coalesce nested loops with independent bounds into a single "
"loop";
let constructor = "mlir::createLoopCoalescingPass()";
let dependentDialects = ["arith::ArithmeticDialect"];
}
-def SimplifyAffineStructuresPass : Pass<"affine-simplify-structures", "func::FuncOp"> {
+def SimplifyAffineStructures : Pass<"affine-simplify-structures", "func::FuncOp"> {
let summary = "Simplify affine expressions in maps/sets and normalize "
"memrefs";
let constructor = "mlir::createSimplifyAffineStructuresPass()";
}
-def AffineExpandIndexOpsPass : Pass<"affine-expand-index-ops"> {
+def AffineExpandIndexOps : Pass<"affine-expand-index-ops"> {
let summary = "Lower affine operations operating on indices into more fundamental operations";
let constructor = "mlir::createAffineExpandIndexOpsPass()";
}
diff --git a/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.h b/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.h
index 43ef369de6330..9b9331f23230a 100644
--- a/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.h
@@ -14,11 +14,6 @@
namespace mlir {
namespace arith {
-#define GEN_PASS_DECL_ARITHMETICBUFFERIZEPASS
-#define GEN_PASS_DECL_ARITHMETICEXPANDOPSPASS
-#define GEN_PASS_DECL_ARITHMETICUNSIGNEDWHENEQUIVALENTPASS
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
-
/// Create a pass to bufferize Arithmetic ops.
std::unique_ptr<Pass> createArithmeticBufferizePass();
diff --git a/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td b/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td
index abfa407e80c66..752d715087959 100644
--- a/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Arithmetic/Transforms/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def ArithmeticBufferizePass : Pass<"arith-bufferize", "ModuleOp"> {
+def ArithmeticBufferize : Pass<"arith-bufferize", "ModuleOp"> {
let summary = "Bufferize Arithmetic dialect ops.";
let description = [{
This pass bufferizes arith dialect ops.
@@ -28,12 +28,12 @@ def ArithmeticBufferizePass : Pass<"arith-bufferize", "ModuleOp"> {
];
}
-def ArithmeticExpandOpsPass : Pass<"arith-expand"> {
+def ArithmeticExpandOps : Pass<"arith-expand"> {
let summary = "Legalize Arithmetic ops to be convertible to LLVM.";
let constructor = "mlir::arith::createArithmeticExpandOpsPass()";
}
-def ArithmeticUnsignedWhenEquivalentPass : Pass<"arith-unsigned-when-equivalent"> {
+def ArithmeticUnsignedWhenEquivalent : Pass<"arith-unsigned-when-equivalent"> {
let summary = "Replace signed ops with unsigned ones where they are proven equivalent";
let description = [{
Replace signed ops with their unsigned equivalents when integer range analysis
diff --git a/mlir/include/mlir/Dialect/Async/Passes.h b/mlir/include/mlir/Dialect/Async/Passes.h
index a3569c7cde444..af0f228377617 100644
--- a/mlir/include/mlir/Dialect/Async/Passes.h
+++ b/mlir/include/mlir/Dialect/Async/Passes.h
@@ -18,13 +18,6 @@
namespace mlir {
class ModuleOp;
-#define GEN_PASS_DECL_ASYNCPARALLELFORPASS
-#define GEN_PASS_DECL_ASYNCTOASYNCRUNTIMEPASS
-#define GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGPASS
-#define GEN_PASS_DECL_ASYNCRUNTIMEREFCOUNTINGOPTPASS
-#define GEN_PASS_DECL_ASYNCRUNTIMEPOLICYBASEDREFCOUNTINGPASS
-#include "mlir/Dialect/Async/Passes.h.inc"
-
std::unique_ptr<Pass> createAsyncParallelForPass();
std::unique_ptr<Pass> createAsyncParallelForPass(bool asyncDispatch,
diff --git a/mlir/include/mlir/Dialect/Async/Passes.td b/mlir/include/mlir/Dialect/Async/Passes.td
index d70f4efc4b5ec..8eb1eef9b71fd 100644
--- a/mlir/include/mlir/Dialect/Async/Passes.td
+++ b/mlir/include/mlir/Dialect/Async/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def AsyncParallelForPass : Pass<"async-parallel-for", "ModuleOp"> {
+def AsyncParallelFor : Pass<"async-parallel-for", "ModuleOp"> {
let summary = "Convert scf.parallel operations to multiple async compute ops "
"executed concurrently for non-overlapping iteration ranges";
let constructor = "mlir::createAsyncParallelForPass()";
@@ -40,7 +40,7 @@ def AsyncParallelForPass : Pass<"async-parallel-for", "ModuleOp"> {
];
}
-def AsyncToAsyncRuntimePass : Pass<"async-to-async-runtime", "ModuleOp"> {
+def AsyncToAsyncRuntime : Pass<"async-to-async-runtime", "ModuleOp"> {
let summary = "Lower high level async operations (e.g. async.execute) to the"
"explicit async.runtime and async.coro operations";
let constructor = "mlir::createAsyncToAsyncRuntimePass()";
@@ -54,7 +54,7 @@ def AsyncToAsyncRuntimePass : Pass<"async-to-async-runtime", "ModuleOp"> {
let dependentDialects = ["async::AsyncDialect"];
}
-def AsyncRuntimeRefCountingPass : Pass<"async-runtime-ref-counting"> {
+def AsyncRuntimeRefCounting : Pass<"async-runtime-ref-counting"> {
let summary = "Automatic reference counting for Async runtime operations";
let description = [{
This pass works at the async runtime abtraction level, after all
@@ -71,14 +71,14 @@ def AsyncRuntimeRefCountingPass : Pass<"async-runtime-ref-counting"> {
let dependentDialects = ["async::AsyncDialect"];
}
-def AsyncRuntimeRefCountingOptPass : Pass<"async-runtime-ref-counting-opt"> {
+def AsyncRuntimeRefCountingOpt : Pass<"async-runtime-ref-counting-opt"> {
let summary = "Optimize automatic reference counting operations for the"
"Async runtime by removing redundant operations";
let constructor = "mlir::createAsyncRuntimeRefCountingOptPass()";
let dependentDialects = ["async::AsyncDialect"];
}
-def AsyncRuntimePolicyBasedRefCountingPass
+def AsyncRuntimePolicyBasedRefCounting
: Pass<"async-runtime-policy-based-ref-counting"> {
let summary = "Policy based reference counting for Async runtime operations";
let description = [{
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
index 649784a0ae3bb..df49a0ab3aa77 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.h
@@ -17,19 +17,6 @@ struct OneShotBufferizationOptions;
// Passes
//===----------------------------------------------------------------------===//
-#define GEN_PASS_DECL_BUFFERDEALLOCATIONPASS
-#define GEN_PASS_DECL_BUFFERHOISTINGPASS
-#define GEN_PASS_DECL_BUFFERLOOPHOISTINGPASS
-#define GEN_PASS_DECL_BUFFERRESULTSTOOUTPARAMSPASS
-#define GEN_PASS_DECL_FINALIZINGBUFFERIZEPASS
-#define GEN_PASS_DECL_BUFFERIZATIONBUFFERIZEPASS
-#define GEN_PASS_DECL_DROPEQUIVALENTBUFFERRESULTSPASS
-#define GEN_PASS_DECL_ONESHOTBUFFERIZEPASS
-#define GEN_PASS_DECL_PROMOTEBUFFERSTOSTACKPASS
-#define GEN_PASS_DECL_TENSORCOPYINSERTIONPASS
-#define GEN_PASS_DECL_ALLOCTENSORELIMINATIONPASS
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-
/// Creates an instance of the BufferDeallocation pass to free all allocated
/// buffers.
std::unique_ptr<Pass> createBufferDeallocationPass();
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
index 47d6a8558a1b9..97684fb4a9310 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def BufferDeallocationPass : Pass<"buffer-deallocation", "func::FuncOp"> {
+def BufferDeallocation : Pass<"buffer-deallocation", "func::FuncOp"> {
let summary = "Adds all required dealloc operations for all allocations in "
"the input program";
let description = [{
@@ -88,7 +88,7 @@ def BufferDeallocationPass : Pass<"buffer-deallocation", "func::FuncOp"> {
let constructor = "mlir::bufferization::createBufferDeallocationPass()";
}
-def BufferHoistingPass : Pass<"buffer-hoisting", "func::FuncOp"> {
+def BufferHoisting : Pass<"buffer-hoisting", "func::FuncOp"> {
let summary = "Optimizes placement of allocation operations by moving them "
"into common dominators and out of nested regions";
let description = [{
@@ -98,7 +98,7 @@ def BufferHoistingPass : Pass<"buffer-hoisting", "func::FuncOp"> {
let constructor = "mlir::bufferization::createBufferHoistingPass()";
}
-def BufferLoopHoistingPass : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
+def BufferLoopHoisting : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
let summary = "Optimizes placement of allocation operations by moving them "
"out of loop nests";
let description = [{
@@ -108,7 +108,7 @@ def BufferLoopHoistingPass : Pass<"buffer-loop-hoisting", "func::FuncOp"> {
let constructor = "mlir::bufferization::createBufferLoopHoistingPass()";
}
-def BufferResultsToOutParamsPass : Pass<"buffer-results-to-out-params", "ModuleOp"> {
+def BufferResultsToOutParams : Pass<"buffer-results-to-out-params", "ModuleOp"> {
let summary = "Converts memref-typed function results to out-params";
let description = [{
Some calling conventions prefer to pass output memrefs as "out params". The
@@ -133,7 +133,7 @@ def BufferResultsToOutParamsPass : Pass<"buffer-results-to-out-params", "ModuleO
let dependentDialects = ["memref::MemRefDialect"];
}
-def FinalizingBufferizePass : Pass<"finalizing-bufferize", "func::FuncOp"> {
+def FinalizingBufferize : Pass<"finalizing-bufferize", "func::FuncOp"> {
let summary = "Finalize a partial bufferization";
let description = [{
A bufferize pass that finalizes a partial bufferization by removing
@@ -149,12 +149,12 @@ def FinalizingBufferizePass : Pass<"finalizing-bufferize", "func::FuncOp"> {
let constructor = "mlir::bufferization::createFinalizingBufferizePass()";
}
-def BufferizationBufferizePass : Pass<"bufferization-bufferize", "func::FuncOp"> {
+def BufferizationBufferize : Pass<"bufferization-bufferize", "func::FuncOp"> {
let summary = "Bufferize the `bufferization` dialect";
let constructor = "mlir::bufferization::createBufferizationBufferizePass()";
}
-def DropEquivalentBufferResultsPass : Pass<"drop-equivalent-buffer-results", "ModuleOp"> {
+def DropEquivalentBufferResults : Pass<"drop-equivalent-buffer-results", "ModuleOp"> {
let summary = "Remove MemRef return values that are equivalent to a bbArg";
let description = [{
This pass removes MemRef return values from functions if they are equivalent
@@ -168,7 +168,7 @@ def DropEquivalentBufferResultsPass : Pass<"drop-equivalent-buffer-results", "Mo
let dependentDialects = ["memref::MemRefDialect"];
}
-def OneShotBufferizePass : Pass<"one-shot-bufferize", "ModuleOp"> {
+def OneShotBufferize : Pass<"one-shot-bufferize", "ModuleOp"> {
let summary = "One-Shot Bufferize";
let description = [{
This pass bufferizes all ops that implement `BufferizableOpInterface`. It
@@ -303,7 +303,7 @@ def OneShotBufferizePass : Pass<"one-shot-bufferize", "ModuleOp"> {
let constructor = "mlir::bufferization::createOneShotBufferizePass()";
}
-def PromoteBuffersToStackPass : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
+def PromoteBuffersToStack : Pass<"promote-buffers-to-stack", "func::FuncOp"> {
let summary = "Promotes heap-based allocations to automatically managed "
"stack-based allocations";
let description = [{
@@ -324,7 +324,7 @@ def PromoteBuffersToStackPass : Pass<"promote-buffers-to-stack", "func::FuncOp">
];
}
-def TensorCopyInsertionPass : Pass<"tensor-copy-insertion"> {
+def TensorCopyInsertion : Pass<"tensor-copy-insertion"> {
let summary = "Make all tensor IR inplaceable by inserting copies";
let description = [{
This pass runs One-Shot Analysis and inserts copies for all OpOperands that
@@ -355,7 +355,7 @@ def TensorCopyInsertionPass : Pass<"tensor-copy-insertion"> {
let constructor = "mlir::bufferization::createTensorCopyInsertionPass()";
}
-def AllocTensorEliminationPass : Pass<"eliminate-alloc-tensors"> {
+def AllocTensorElimination : Pass<"eliminate-alloc-tensors"> {
let summary = "Try to eliminate all alloc_tensor ops.";
let description = [{
This pass tries to eliminate all insert_slice op-anchored alloc_tensor ops.
diff --git a/mlir/include/mlir/Dialect/Func/Transforms/Passes.h b/mlir/include/mlir/Dialect/Func/Transforms/Passes.h
index 3fa6fdc9cc65e..82dd886b3a00f 100644
--- a/mlir/include/mlir/Dialect/Func/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Func/Transforms/Passes.h
@@ -25,10 +25,6 @@ class BufferizeTypeConverter;
class RewritePatternSet;
namespace func {
-
-#define GEN_PASS_DECL_FUNCBUFFERIZEPASS
-#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
-
/// Creates an instance of func bufferization pass.
std::unique_ptr<Pass> createFuncBufferizePass();
diff --git a/mlir/include/mlir/Dialect/Func/Transforms/Passes.td b/mlir/include/mlir/Dialect/Func/Transforms/Passes.td
index 565d79cbf1029..54fe4fdd6bbe6 100644
--- a/mlir/include/mlir/Dialect/Func/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Func/Transforms/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def FuncBufferizePass : Pass<"func-bufferize", "ModuleOp"> {
+def FuncBufferize : Pass<"func-bufferize", "ModuleOp"> {
let summary = "Bufferize func/call/return ops";
let description = [{
A bufferize pass that bufferizes func.func and func.call ops.
diff --git a/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h b/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h
index fd6af68e437e2..0ef83bc7a6ba3 100644
--- a/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/GPU/Transforms/Passes.h
@@ -27,12 +27,6 @@ namespace func {
class FuncOp;
} // namespace func
-#define GEN_PASS_DECL_GPULAUNCHSINKINDEXCOMPUTATIONSPASS
-#define GEN_PASS_DECL_GPUKERNELOUTLININGPASS
-#define GEN_PASS_DECL_GPUASYNCREGIONPASS
-#define GEN_PASS_DECL_GPUMAPPARALLELLOOPSPASS
-#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
-
/// Pass that moves ops which are likely an index computation into gpu.launch
/// body.
std::unique_ptr<Pass> createGpuLauchSinkIndexComputationsPass();
diff --git a/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td b/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
index 1ff089d6489b0..a144fa4127ddf 100644
--- a/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/GPU/Transforms/Passes.td
@@ -11,13 +11,13 @@
include "mlir/Pass/PassBase.td"
-def GpuLaunchSinkIndexComputationsPass : Pass<"gpu-launch-sink-index-computations"> {
+def GpuLaunchSinkIndexComputations : Pass<"gpu-launch-sink-index-computations"> {
let summary = "Sink index computations into gpu.launch body";
let constructor = "mlir::createGpuLauchSinkIndexComputationsPass()";
let dependentDialects = ["mlir::gpu::GPUDialect"];
}
-def GpuKernelOutliningPass : Pass<"gpu-kernel-outlining", "ModuleOp"> {
+def GpuKernelOutlining : Pass<"gpu-kernel-outlining", "ModuleOp"> {
let summary = "Outline gpu.launch bodies to kernel functions";
let constructor = "mlir::createGpuKernelOutliningPass()";
let dependentDialects = ["mlir::DLTIDialect"];
diff --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h b/mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h
index 353b10086b3ad..01977067b3139 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h
@@ -17,9 +17,6 @@ class Pass;
namespace LLVM {
-#define GEN_PASS_DECL_LLVMLEGALIZEFOREXPORTPASS
-#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
-
/// Make argument-taking successors of each block distinct. PHI nodes in LLVM
/// IR use the predecessor ID to identify which value to take. They do not
/// support
diff erent values coming from the same predecessor. If a block has
diff --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h b/mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h
index 8889b60ee78a5..af0c4ea4e568c 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h
@@ -16,9 +16,6 @@ class Pass;
namespace NVVM {
-#define GEN_PASS_DECL_NVVMOPTIMIZEFORTARGETPASS
-#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
-
/// Creates a pass that optimizes LLVM IR for the NVVM target.
std::unique_ptr<Pass> createOptimizeForTargetPass();
diff --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
index 00cc7bc56b304..a22efd392d5e6 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
@@ -11,12 +11,12 @@
include "mlir/Pass/PassBase.td"
-def LLVMLegalizeForExportPass : Pass<"llvm-legalize-for-export"> {
+def LLVMLegalizeForExport : Pass<"llvm-legalize-for-export"> {
let summary = "Legalize LLVM dialect to be convertible to LLVM IR";
let constructor = "::mlir::LLVM::createLegalizeForExportPass()";
}
-def LLVMRequestCWrappersPass
+def LLVMRequestCWrappers
: Pass<"llvm-request-c-wrappers", "::mlir::func::FuncOp"> {
let summary = "Request C wrapper emission for all functions";
let description = [{
@@ -29,7 +29,7 @@ def LLVMRequestCWrappersPass
let constructor = "::mlir::LLVM::createRequestCWrappersPass()";
}
-def NVVMOptimizeForTargetPass : Pass<"llvm-optimize-for-nvvm-target"> {
+def NVVMOptimizeForTarget : Pass<"llvm-optimize-for-nvvm-target"> {
let summary = "Optimize NVVM IR";
let constructor = "::mlir::NVVM::createOptimizeForTargetPass()";
}
diff --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h b/mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h
index 991405a4ef9bc..166ae6a35cd8e 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h
@@ -15,10 +15,6 @@ namespace mlir {
class Pass;
namespace LLVM {
-
-#define GEN_PASS_DECL_LLVMREQUESTCWRAPPERSPASS
-#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
-
std::unique_ptr<Pass> createRequestCWrappersPass();
} // namespace LLVM
} // namespace mlir
diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.h b/mlir/include/mlir/Dialect/Linalg/Passes.h
index 2cc81e459772b..543a531f1234f 100644
--- a/mlir/include/mlir/Dialect/Linalg/Passes.h
+++ b/mlir/include/mlir/Dialect/Linalg/Passes.h
@@ -26,30 +26,6 @@ namespace bufferization {
struct OneShotBufferizationOptions;
} // namespace bufferization
-#define GEN_PASS_DECL_CONVERTELEMENTWISETOLINALGPASS
-#define GEN_PASS_DECL_LINALGINITTENSORTOALLOCTENSORPASS
-#define GEN_PASS_DECL_LINALGFOLDUNITEXTENTDIMSPASS
-#define GEN_PASS_DECL_LINALGELEMENTWISEOPFUSIONPASS
-#define GEN_PASS_DECL_LINALGNAMEDOPCONVERSIONPASS
-#define GEN_PASS_DECL_LINALGINLINESCALAROPERANDSPASS
-#define GEN_PASS_DECL_LINALGLOWERTOAFFINELOOPSPASS
-#define GEN_PASS_DECL_LINALGLOWERTOLOOPSPASS
-#define GEN_PASS_DECL_LINALGLOWERTOPARALLELLOOPSPASS
-#define GEN_PASS_DECL_LINALGBUFFERIZEPASS
-#define GEN_PASS_DECL_LINALGTILINGPASS
-#define GEN_PASS_DECL_LINALGGENERALIZATIONPASS
-#define GEN_PASS_DECL_LINALGDETENSORIZEPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYTILEANDFUSEPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYTILEPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYPADPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYDECOMPOSEPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYPEELPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYVECTORIZEPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYENABLEPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYLOWERVECTORSPASS
-#define GEN_PASS_DECL_LINALGSTRATEGYREMOVEMARKERSPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-
std::unique_ptr<Pass> createConvertElementwiseToLinalgPass();
std::unique_ptr<Pass> createLinalgFoldUnitExtentDimsPass();
diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.td b/mlir/include/mlir/Dialect/Linalg/Passes.td
index cc4415d7d93a5..826d59f9b5415 100644
--- a/mlir/include/mlir/Dialect/Linalg/Passes.td
+++ b/mlir/include/mlir/Dialect/Linalg/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def ConvertElementwiseToLinalgPass : Pass<"convert-elementwise-to-linalg", ""> {
+def ConvertElementwiseToLinalg : Pass<"convert-elementwise-to-linalg", ""> {
let summary = "Convert ElementwiseMappable ops to linalg";
let description = [{
Convert ops with the `ElementwiseMappable` trait to linalg parallel loops.
@@ -24,7 +24,7 @@ def ConvertElementwiseToLinalgPass : Pass<"convert-elementwise-to-linalg", ""> {
let dependentDialects = ["linalg::LinalgDialect", "memref::MemRefDialect"];
}
-def LinalgInitTensorToAllocTensorPass : Pass<"linalg-init-tensor-to-alloc-tensor"> {
+def LinalgInitTensorToAllocTensor : Pass<"linalg-init-tensor-to-alloc-tensor"> {
let summary = "Replace all init_tensor ops by alloc_tensor ops.";
let description = [{
init_tensor ops return a tensor of unspecified contents who's only purpose
@@ -34,7 +34,7 @@ def LinalgInitTensorToAllocTensorPass : Pass<"linalg-init-tensor-to-alloc-tensor
let constructor = "mlir::createLinalgInitTensorToAllocTensorPass()";
}
-def LinalgFoldUnitExtentDimsPass : Pass<"linalg-fold-unit-extent-dims", ""> {
+def LinalgFoldUnitExtentDims : Pass<"linalg-fold-unit-extent-dims", ""> {
let summary = "Remove unit-extent dimension in Linalg ops on tensors";
let constructor = "mlir::createLinalgFoldUnitExtentDimsPass()";
let options = [
@@ -48,7 +48,7 @@ def LinalgFoldUnitExtentDimsPass : Pass<"linalg-fold-unit-extent-dims", ""> {
];
}
-def LinalgElementwiseOpFusionPass : Pass<"linalg-fuse-elementwise-ops"> {
+def LinalgElementwiseOpFusion : Pass<"linalg-fuse-elementwise-ops"> {
let summary = "Fuse elementwise operations on tensors";
let constructor = "mlir::createLinalgElementwiseOpFusionPass()";
let dependentDialects = [
@@ -56,13 +56,13 @@ def LinalgElementwiseOpFusionPass : Pass<"linalg-fuse-elementwise-ops"> {
];
}
-def LinalgNamedOpConversionPass : Pass<"linalg-named-op-conversion"> {
+def LinalgNamedOpConversion: Pass<"linalg-named-op-conversion"> {
let summary = "Convert from one named linalg op to another.";
let constructor = "mlir::createLinalgNamedOpConversionPass()";
let dependentDialects = ["linalg::LinalgDialect", "tensor::TensorDialect"];
}
-def LinalgInlineScalarOperandsPass : Pass<"linalg-inline-scalar-operands", "func::FuncOp"> {
+def LinalgInlineScalarOperands : Pass<"linalg-inline-scalar-operands", "func::FuncOp"> {
let summary = "Inline scalar operands into linalg generic ops";
let constructor = "mlir::createLinalgInlineScalarOperandsPass()";
let dependentDialects = [
@@ -70,7 +70,7 @@ def LinalgInlineScalarOperandsPass : Pass<"linalg-inline-scalar-operands", "func
];
}
-def LinalgLowerToAffineLoopsPass : Pass<"convert-linalg-to-affine-loops", "func::FuncOp"> {
+def LinalgLowerToAffineLoops : Pass<"convert-linalg-to-affine-loops", "func::FuncOp"> {
let summary = "Lower the operations from the linalg dialect into affine "
"loops";
let constructor = "mlir::createConvertLinalgToAffineLoopsPass()";
@@ -78,7 +78,7 @@ def LinalgLowerToAffineLoopsPass : Pass<"convert-linalg-to-affine-loops", "func:
"AffineDialect", "linalg::LinalgDialect", "memref::MemRefDialect"];
}
-def LinalgLowerToLoopsPass : Pass<"convert-linalg-to-loops", "func::FuncOp"> {
+def LinalgLowerToLoops : Pass<"convert-linalg-to-loops", "func::FuncOp"> {
let summary = "Lower the operations from the linalg dialect into loops";
let constructor = "mlir::createConvertLinalgToLoopsPass()";
let dependentDialects = [
@@ -88,7 +88,7 @@ def LinalgLowerToLoopsPass : Pass<"convert-linalg-to-loops", "func::FuncOp"> {
];
}
-def LinalgLowerToParallelLoopsPass
+def LinalgLowerToParallelLoops
: Pass<"convert-linalg-to-parallel-loops", "func::FuncOp"> {
let summary = "Lower the operations from the linalg dialect into parallel "
"loops";
@@ -101,7 +101,7 @@ def LinalgLowerToParallelLoopsPass
];
}
-def LinalgBufferizePass : Pass<"linalg-bufferize", "func::FuncOp"> {
+def LinalgBufferize : Pass<"linalg-bufferize", "func::FuncOp"> {
let summary = "Bufferize the linalg dialect";
let constructor = "mlir::createLinalgBufferizePass()";
let dependentDialects = [
@@ -112,7 +112,7 @@ def LinalgBufferizePass : Pass<"linalg-bufferize", "func::FuncOp"> {
];
}
-def LinalgTilingPass : Pass<"linalg-tile", "func::FuncOp"> {
+def LinalgTiling : Pass<"linalg-tile", "func::FuncOp"> {
let summary = "Tile operations in the linalg dialect";
let constructor = "mlir::createLinalgTilingPass()";
let dependentDialects = [
@@ -128,13 +128,13 @@ def LinalgTilingPass : Pass<"linalg-tile", "func::FuncOp"> {
];
}
-def LinalgGeneralizationPass : Pass<"linalg-generalize-named-ops", "func::FuncOp"> {
+def LinalgGeneralization : Pass<"linalg-generalize-named-ops", "func::FuncOp"> {
let summary = "Convert named ops into generic ops";
let constructor = "mlir::createLinalgGeneralizationPass()";
let dependentDialects = ["linalg::LinalgDialect"];
}
-def LinalgDetensorizePass : Pass<"linalg-detensorize", ""> {
+def LinalgDetensorize : Pass<"linalg-detensorize", ""> {
let summary = "Detensorize linalg ops";
let constructor = "mlir::createLinalgDetensorizePass()";
let dependentDialects = [];
diff --git a/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h b/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
index 1144ab216ae51..82c2b5bceb9a2 100644
--- a/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.h
@@ -86,13 +86,6 @@ LogicalResult multiBuffer(memref::AllocOp allocOp, unsigned multiplier);
// Passes
//===----------------------------------------------------------------------===//
-#define GEN_PASS_DECL_EXPANDOPSPASS
-#define GEN_PASS_DECL_FOLDMEMREFALIASOPSPASS
-#define GEN_PASS_DECL_NORMALIZEMEMREFSPASS
-#define GEN_PASS_DECL_RESOLVERANKEDSHAPETYPERESULTDIMSPASS
-#define GEN_PASS_DECL_RESOLVESHAPEDTYPERESULTDIMSPASS
-#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
-
/// Creates an instance of the ExpandOps pass that legalizes memref dialect ops
/// to be convertible to LLVM. For example, `memref.reshape` gets converted to
/// `memref_reinterpret_cast`.
diff --git a/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td b/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
index 5546f84537926..5ac124a0fcaa8 100644
--- a/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/MemRef/Transforms/Passes.td
@@ -11,12 +11,12 @@
include "mlir/Pass/PassBase.td"
-def ExpandOpsPass : Pass<"memref-expand"> {
+def ExpandOps : Pass<"memref-expand"> {
let summary = "Legalize memref operations to be convertible to LLVM.";
let constructor = "mlir::memref::createExpandOpsPass()";
}
-def FoldMemRefAliasOpsPass : Pass<"fold-memref-alias-ops"> {
+def FoldMemRefAliasOps : Pass<"fold-memref-alias-ops"> {
let summary = "Fold memref alias ops into consumer load/store ops";
let description = [{
The pass folds loading/storing from/to memref aliasing ops to loading/storing
@@ -28,7 +28,7 @@ def FoldMemRefAliasOpsPass : Pass<"fold-memref-alias-ops"> {
];
}
-def NormalizeMemRefsPass : Pass<"normalize-memrefs", "ModuleOp"> {
+def NormalizeMemRefs : Pass<"normalize-memrefs", "ModuleOp"> {
let summary = "Normalize memrefs";
let description = [{
This pass transforms memref types with a non-trivial
@@ -144,7 +144,7 @@ def NormalizeMemRefsPass : Pass<"normalize-memrefs", "ModuleOp"> {
let dependentDialects = ["AffineDialect"];
}
-def ResolveRankedShapeTypeResultDimsPass :
+def ResolveRankedShapeTypeResultDims :
Pass<"resolve-ranked-shaped-type-result-dims"> {
let summary = "Resolve memref.dim of result values of ranked shape type";
let description = [{
@@ -159,7 +159,7 @@ def ResolveRankedShapeTypeResultDimsPass :
];
}
-def ResolveShapedTypeResultDimsPass : Pass<"resolve-shaped-type-result-dims"> {
+def ResolveShapedTypeResultDims : Pass<"resolve-shaped-type-result-dims"> {
let summary = "Resolve memref.dim of result values";
let description = [{
The pass resolves memref.dim of result of operations that
diff --git a/mlir/include/mlir/Dialect/NVGPU/Passes.h b/mlir/include/mlir/Dialect/NVGPU/Passes.h
index 05ea47ebc3ef0..3131984c302e7 100644
--- a/mlir/include/mlir/Dialect/NVGPU/Passes.h
+++ b/mlir/include/mlir/Dialect/NVGPU/Passes.h
@@ -17,9 +17,6 @@
namespace mlir {
namespace nvgpu {
-#define GEN_PASS_DECL_OPTIMIZESHAREDMEMORYPASS
-#include "mlir/Dialect/NVGPU/Passes.h.inc"
-
/// Create a pass to optimize shared memory reads and writes.
std::unique_ptr<Pass> createOptimizeSharedMemoryPass();
diff --git a/mlir/include/mlir/Dialect/NVGPU/Passes.td b/mlir/include/mlir/Dialect/NVGPU/Passes.td
index 59a88c0cca0d2..87b773134784b 100644
--- a/mlir/include/mlir/Dialect/NVGPU/Passes.td
+++ b/mlir/include/mlir/Dialect/NVGPU/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def OptimizeSharedMemoryPass : Pass<"nvgpu-optimize-shared-memory"> {
+def OptimizeSharedMemory : Pass<"nvgpu-optimize-shared-memory"> {
let summary = "Optimizes accesses to shard memory memrefs in order to reduce bank conflicts.";
let constructor = "mlir::nvgpu::createOptimizeSharedMemoryPass()";
let dependentDialects = [
diff --git a/mlir/include/mlir/Dialect/SCF/Transforms/Passes.h b/mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
index 0e80fe3f1ab71..4f25ff6f82a2d 100644
--- a/mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
@@ -17,17 +17,47 @@
namespace mlir {
-#define GEN_PASS_DECL_SCFBUFFERIZEPASS
-#define GEN_PASS_DECL_SCFFORLOOPCANONICALIZATIONPASS
-#define GEN_PASS_DECL_SCFFORLOOPPEELINGPASS
-#define GEN_PASS_DECL_SCFFORLOOPSPECIALIZATIONPASS
-#define GEN_PASS_DECL_SCFPARALLELLOOPFUSIONPASS
-#define GEN_PASS_DECL_SCFPARALLELLOOPCOLLAPSINGPASS
-#define GEN_PASS_DECL_SCFPARALLELLOOPSPECIALIZATIONPASS
-#define GEN_PASS_DECL_SCFPARALLELLOOPTILINGPASS
-#define GEN_PASS_DECL_SCFFORLOOPRANGEFOLDINGPASS
-#define GEN_PASS_DECL_SCFFORTOWHILELOOPPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+/// Creates a pass that bufferizes the SCF dialect.
+std::unique_ptr<Pass> createSCFBufferizePass();
+
+/// Creates a pass that specializes for loop for unrolling and
+/// vectorization.
+std::unique_ptr<Pass> createForLoopSpecializationPass();
+
+/// Creates a pass that peels for loops at their upper bounds for
+/// better vectorization.
+std::unique_ptr<Pass> createForLoopPeelingPass();
+
+/// Creates a pass that canonicalizes affine.min and affine.max operations
+/// inside of scf.for loops with known lower and upper bounds.
+std::unique_ptr<Pass> createSCFForLoopCanonicalizationPass();
+
+/// Creates a pass that transforms a single ParallelLoop over N induction
+/// variables into another ParallelLoop over less than N induction variables.
+std::unique_ptr<Pass> createParallelLoopCollapsingPass();
+
+/// Creates a loop fusion pass which fuses parallel loops.
+std::unique_ptr<Pass> createParallelLoopFusionPass();
+
+/// Creates a pass that specializes parallel loop for unrolling and
+/// vectorization.
+std::unique_ptr<Pass> createParallelLoopSpecializationPass();
+
+/// Creates a pass which tiles innermost parallel loops.
+/// If noMinMaxBounds, the upper bound of the inner loop will
+/// be a same value among
diff erent outter loop iterations, and
+/// an additional inbound check will be emitted inside the internal
+/// loops.
+std::unique_ptr<Pass>
+createParallelLoopTilingPass(llvm::ArrayRef<int64_t> tileSize = {},
+ bool noMinMaxBounds = false);
+
+/// Creates a pass which folds arith ops on induction variable into
+/// loop range.
+std::unique_ptr<Pass> createForLoopRangeFoldingPass();
+
+// Creates a pass which lowers for loops into while loops.
+std::unique_ptr<Pass> createForToWhileLoopPass();
//===----------------------------------------------------------------------===//
// Registration
diff --git a/mlir/include/mlir/Dialect/SCF/Transforms/Passes.td b/mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
index 44b343308d509..9abffe58a9240 100644
--- a/mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
@@ -11,30 +11,26 @@
include "mlir/Pass/PassBase.td"
-def SCFBufferizePass : Pass<"scf-bufferize"> {
+def SCFBufferize : Pass<"scf-bufferize"> {
let summary = "Bufferize the scf dialect.";
+ let constructor = "mlir::createSCFBufferizePass()";
let dependentDialects = ["bufferization::BufferizationDialect",
"memref::MemRefDialect"];
}
// Note: Making these canonicalization patterns would require a dependency
// of the SCF dialect on the Affine/Tensor/MemRef dialects or vice versa.
-def SCFForLoopCanonicalizationPass
+def SCFForLoopCanonicalization
: Pass<"scf-for-loop-canonicalization"> {
let summary = "Canonicalize operations within scf.for loop bodies";
- let description = [{
- Canonicalize `affine.min` and `affine.max` operations inside of `scf.for`
- loops with known lower and upper bounds.
- }];
+ let constructor = "mlir::createSCFForLoopCanonicalizationPass()";
let dependentDialects = ["AffineDialect", "tensor::TensorDialect",
"memref::MemRefDialect"];
}
-def SCFForLoopPeelingPass : Pass<"scf-for-loop-peeling"> {
+def SCFForLoopPeeling : Pass<"scf-for-loop-peeling"> {
let summary = "Peel `for` loops at their upper bounds.";
- let description = [{
- Peel for loops at their upper bounds for better vectorization.
- }];
+ let constructor = "mlir::createForLoopPeelingPass()";
let options = [
Option<"skipPartial", "skip-partial", "bool",
/*default=*/"true",
@@ -44,20 +40,19 @@ def SCFForLoopPeelingPass : Pass<"scf-for-loop-peeling"> {
let dependentDialects = ["AffineDialect"];
}
-def SCFForLoopSpecializationPass : Pass<"scf-for-loop-specialization"> {
+def SCFForLoopSpecialization : Pass<"scf-for-loop-specialization"> {
let summary = "Specialize `for` loops for vectorization";
+ let constructor = "mlir::createForLoopSpecializationPass()";
}
-def SCFParallelLoopFusionPass : Pass<"scf-parallel-loop-fusion"> {
+def SCFParallelLoopFusion : Pass<"scf-parallel-loop-fusion"> {
let summary = "Fuse adjacent parallel loops";
+ let constructor = "mlir::createParallelLoopFusionPass()";
}
-def SCFParallelLoopCollapsingPass : Pass<"scf-parallel-loop-collapsing"> {
+def SCFParallelLoopCollapsing : Pass<"scf-parallel-loop-collapsing"> {
let summary = "Collapse parallel loops to use less induction variables";
- let description = [{
- Transforms a single `ParallelLoop` over N induction variables into
- another `ParallelLoop` over less than N induction variables.
- }];
+ let constructor = "mlir::createParallelLoopCollapsingPass()";
let options = [
ListOption<"clCollapsedIndices0", "collapsed-indices-0", "unsigned",
"Which loop indices to combine 0th loop index">,
@@ -68,22 +63,15 @@ def SCFParallelLoopCollapsingPass : Pass<"scf-parallel-loop-collapsing"> {
];
}
-def SCFParallelLoopSpecializationPass
+def SCFParallelLoopSpecialization
: Pass<"scf-parallel-loop-specialization"> {
let summary = "Specialize parallel loops for vectorization";
- let description = [{
- Specialize parallel loop for unrolling and vectorization.
- }];
+ let constructor = "mlir::createParallelLoopSpecializationPass()";
}
-def SCFParallelLoopTilingPass : Pass<"scf-parallel-loop-tiling"> {
+def SCFParallelLoopTiling : Pass<"scf-parallel-loop-tiling"> {
let summary = "Tile parallel loops";
- let description = [{
- Tile innermost parallel loops.
- If `noMinMaxBounds`, the upper bound of the inner loop will be a same
- value among
diff erent outter loop iterations, and an additional inbound
- check will be emitted inside the internal loops.
- }];
+ let constructor = "mlir::createParallelLoopTilingPass()";
let options = [
ListOption<"tileSizes", "parallel-loop-tile-sizes", "int64_t",
"Factors to tile parallel loops by">,
@@ -95,15 +83,14 @@ def SCFParallelLoopTilingPass : Pass<"scf-parallel-loop-tiling"> {
let dependentDialects = ["AffineDialect"];
}
-def SCFForLoopRangeFoldingPass : Pass<"scf-for-loop-range-folding"> {
+def SCFForLoopRangeFolding : Pass<"scf-for-loop-range-folding"> {
let summary = "Fold add/mul ops into loop range";
- let description = [{
- Fold arith ops on induction variable into loop range.
- }];
+ let constructor = "mlir::createForLoopRangeFoldingPass()";
}
-def SCFForToWhileLoopPass : Pass<"scf-for-to-while"> {
+def SCFForToWhileLoop : Pass<"scf-for-to-while"> {
let summary = "Convert SCF for loops to SCF while loops";
+ let constructor = "mlir::createForToWhileLoopPass()";
let description = [{
This pass transforms SCF.ForOp operations to SCF.WhileOp. The For loop
condition is placed in the 'before' region of the while operation, and the
diff --git a/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h b/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h
index a0f9281fcd411..523be40238df4 100644
--- a/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.h
@@ -27,14 +27,6 @@ class ModuleOp;
// Passes
//===----------------------------------------------------------------------===//
-#define GEN_PASS_DECL_SPIRVDECORATECOMPOSITETYPELAYOUTPASS
-#define GEN_PASS_DECL_SPIRVCANONICALIZEGLPASS
-#define GEN_PASS_DECL_SPIRVLOWERABIATTRIBUTESPASS
-#define GEN_PASS_DECL_SPIRVREWRITEINSERTSPASS
-#define GEN_PASS_DECL_SPIRVUNIFYALIASEDRESOURCEPASS
-#define GEN_PASS_DECL_SPIRVUPDATEVCEPASS
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
-
/// Creates a pass to run canoncalization patterns that involve GL ops.
/// These patterns cannot be run in default canonicalization because GL ops
/// aren't always available. So they should be involed specifically when needed.
diff --git a/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td b/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td
index ed6d8d29771e2..d52718597222f 100644
--- a/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/SPIRV/Transforms/Passes.td
@@ -11,18 +11,18 @@
include "mlir/Pass/PassBase.td"
-def SPIRVDecorateCompositeTypeLayoutPass
- : Pass<"decorate-spirv-composite-type-layout", "mlir::ModuleOp"> {
+def SPIRVCompositeTypeLayout
+ : Pass<"decorate-spirv-composite-type-layout", "ModuleOp"> {
let summary = "Decorate SPIR-V composite type with layout info";
let constructor = "mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass()";
}
-def SPIRVCanonicalizeGLPass : Pass<"spirv-canonicalize-gl", ""> {
+def SPIRVCanonicalizeGL : Pass<"spirv-canonicalize-gl", ""> {
let summary = "Run canonicalization involving GLSL ops";
let constructor = "mlir::spirv::createCanonicalizeGLPass()";
}
-def SPIRVLowerABIAttributesPass : Pass<"spirv-lower-abi-attrs", "spirv::ModuleOp"> {
+def SPIRVLowerABIAttributes : Pass<"spirv-lower-abi-attrs", "spirv::ModuleOp"> {
let summary = "Decorate SPIR-V composite type with layout info";
let constructor = "mlir::spirv::createLowerABIAttributesPass()";
}
@@ -40,7 +40,7 @@ def SPIRVUnifyAliasedResourcePass
let constructor = "mlir::spirv::createUnifyAliasedResourcePass()";
}
-def SPIRVUpdateVCEPass : Pass<"spirv-update-vce", "spirv::ModuleOp"> {
+def SPIRVUpdateVCE : Pass<"spirv-update-vce", "spirv::ModuleOp"> {
let summary = "Deduce and attach minimal (version, capabilities, extensions) "
"requirements to spv.module ops";
let constructor = "mlir::spirv::createUpdateVersionCapabilityExtensionPass()";
diff --git a/mlir/include/mlir/Dialect/Shape/Transforms/Passes.h b/mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
index 06665e5767cbe..a489ba342ed5f 100644
--- a/mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Shape/Transforms/Passes.h
@@ -25,12 +25,6 @@ class FuncOp;
} // namespace mlir
namespace mlir {
-
-#define GEN_PASS_DECL_SHAPETOSHAPELOWERINGPASS
-#define GEN_PASS_DECL_REMOVESHAPECONSTRAINTSPASS
-#define GEN_PASS_DECL_SHAPEBUFFERIZEPASS
-#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
-
/// Creates an instance of the ShapeToShapeLowering pass that legalizes Shape
/// dialect to be convertible to Arithmetic. For example, `shape.num_elements`
/// get transformed to `shape.reduce`, which can be lowered to SCF and
diff --git a/mlir/include/mlir/Dialect/Shape/Transforms/Passes.td b/mlir/include/mlir/Dialect/Shape/Transforms/Passes.td
index a0c470a6fa436..47d16ce64d670 100644
--- a/mlir/include/mlir/Dialect/Shape/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Shape/Transforms/Passes.td
@@ -11,18 +11,18 @@
include "mlir/Pass/PassBase.td"
-def RemoveShapeConstraintsPass : Pass<"remove-shape-constraints", "func::FuncOp"> {
+def RemoveShapeConstraints : Pass<"remove-shape-constraints", "func::FuncOp"> {
let summary = "Replace all cstr_ ops with a true witness";
let constructor = "mlir::createRemoveShapeConstraintsPass()";
}
-def ShapeToShapeLoweringPass : Pass<"shape-to-shape-lowering", "func::FuncOp"> {
+def ShapeToShapeLowering : Pass<"shape-to-shape-lowering", "func::FuncOp"> {
let summary = "Legalize Shape dialect to be convertible to Arithmetic";
let constructor = "mlir::createShapeToShapeLowering()";
}
// TODO: Generalize this to allow any type conversions desired.
-def ShapeBufferizePass : Pass<"shape-bufferize", "func::FuncOp"> {
+def ShapeBufferize : Pass<"shape-bufferize", "func::FuncOp"> {
let summary = "Bufferize the shape dialect.";
let constructor = "mlir::createShapeBufferizePass()";
let dependentDialects = ["bufferization::BufferizationDialect",
diff --git a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
index cba4b2e20c9ce..2d4bdb3a4b5e6 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h
@@ -26,11 +26,6 @@ namespace bufferization {
struct OneShotBufferizationOptions;
} // namespace bufferization
-#define GEN_PASS_DECL_SPARSIFICATIONPASS
-#define GEN_PASS_DECL_SPARSETENSORCONVERSIONPASS
-#define GEN_PASS_DECL_SPARSETENSORCODEGENPASS
-#include "mlir/Dialect/SparseTensor/Transforms/Passes.h.inc"
-
//===----------------------------------------------------------------------===//
// The Sparsification pass.
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
index b599ecd859d50..4ca224b167f20 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def SparsificationPass : Pass<"sparsification", "ModuleOp"> {
+def Sparsification : Pass<"sparsification", "ModuleOp"> {
let summary = "Automatically generate sparse tensor code from sparse tensor types";
let description = [{
A pass that implements the core functionality of a **sparse compiler**.
@@ -76,7 +76,7 @@ def SparsificationPass : Pass<"sparsification", "ModuleOp"> {
];
}
-def SparseTensorConversionPass : Pass<"sparse-tensor-conversion", "ModuleOp"> {
+def SparseTensorConversion : Pass<"sparse-tensor-conversion", "ModuleOp"> {
let summary = "Convert sparse tensors and primitives to library calls";
let description = [{
A pass that converts sparse tensor primitives into calls into a runtime
@@ -122,7 +122,7 @@ def SparseTensorConversionPass : Pass<"sparse-tensor-conversion", "ModuleOp"> {
];
}
-def SparseTensorCodegenPass : Pass<"sparse-tensor-codegen", "ModuleOp"> {
+def SparseTensorCodegen : Pass<"sparse-tensor-codegen", "ModuleOp"> {
let summary = "Convert sparse tensors and primitives to actual code";
let description = [{
A pass that converts sparse tensor types and primitives to actual
diff --git a/mlir/include/mlir/Dialect/Tensor/Transforms/Passes.h b/mlir/include/mlir/Dialect/Tensor/Transforms/Passes.h
index c0854f93d176f..a346577e2f569 100644
--- a/mlir/include/mlir/Dialect/Tensor/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Tensor/Transforms/Passes.h
@@ -12,15 +12,14 @@
#include "mlir/Pass/Pass.h"
namespace mlir {
-namespace tensor {
-
-#define GEN_PASS_DECL_TENSORBUFFERIZEPASS
-#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
+/// Creates an instance of `tensor` dialect bufferization pass.
+std::unique_ptr<Pass> createTensorBufferizePass();
//===----------------------------------------------------------------------===//
// Registration
//===----------------------------------------------------------------------===//
+namespace tensor {
/// Generate the code for registering passes.
#define GEN_PASS_REGISTRATION
#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
diff --git a/mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td b/mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td
index 3e7ccfb29e582..2bf774d404bf5 100644
--- a/mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Tensor/Transforms/Passes.td
@@ -11,8 +11,9 @@
include "mlir/Pass/PassBase.td"
-def TensorBufferizePass : Pass<"tensor-bufferize", "func::FuncOp"> {
+def TensorBufferize : Pass<"tensor-bufferize", "func::FuncOp"> {
let summary = "Bufferize the `tensor` dialect";
+ let constructor = "mlir::createTensorBufferizePass()";
}
#endif // MLIR_DIALECT_TENSOR_TRANSFORMS_PASSES
diff --git a/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h b/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..218aa120718da
--- /dev/null
+++ b/mlir/include/mlir/Dialect/Tosa/Transforms/PassDetail.h
@@ -0,0 +1,24 @@
+//===- PassDetail.h - TOSA Pass class details -------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
+#define MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Tensor/IR/Tensor.h"
+#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSDETAIL_H
diff --git a/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.h b/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.h
index 26a2df4001420..9ffccfc948824 100644
--- a/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.h
@@ -19,12 +19,6 @@
namespace mlir {
namespace tosa {
-#define GEN_PASS_DECL_TOSALAYERWISECONSTANTFOLDPASS
-#define GEN_PASS_DECL_TOSAINFERSHAPESPASS
-#define GEN_PASS_DECL_TOSAMAKEBROADCASTABLEPASS
-#define GEN_PASS_DECL_TOSAOPTIONALDECOMPOSITIONSPASS
-#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
-
// Expose Rewrite Functions that decompose TOSA Ops into further TOSA Ops.
// The rewrites can be selectively added to a conversion pass.
void populateTosaDecomposeConv2D(MLIRContext *ctx, RewritePatternSet &patterns);
@@ -35,6 +29,12 @@ void populateTosaDecomposeDepthwise(MLIRContext *ctx,
void populateTosaFoldConstantTransposePatterns(MLIRContext *ctx,
RewritePatternSet &patterns);
+std::unique_ptr<Pass> createTosaLayerwiseConstantFoldPass();
+std::unique_ptr<Pass> createTosaInferShapesPass();
+std::unique_ptr<Pass> createTosaMakeBroadcastablePass();
+std::unique_ptr<Pass> createTosaTestQuantUtilAPIPass();
+std::unique_ptr<Pass> createTosaOptionalDecompositions();
+
#define GEN_PASS_REGISTRATION
#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
diff --git a/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td b/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td
index 45d96ad2a19e7..46bd7a4780e00 100644
--- a/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Tosa/Transforms/Passes.td
@@ -20,14 +20,18 @@ def TosaLayerwiseConstantFoldPass : Pass<"tosa-layerwise-constant-fold", "func::
let description = [{
Pass that enables folding of full-layer operations on constant tensors.
}];
+
+ let constructor = "createTosaLayerwiseConstantFoldPass()";
}
-def TosaInferShapesPass : Pass<"tosa-infer-shapes", "func::FuncOp"> {
+def TosaInferShapes : Pass<"tosa-infer-shapes", "func::FuncOp"> {
let summary = "Propagate shapes across TOSA operations";
let description = [{
Pass that uses operand types and propagates shapes to TOSA operations.
This includes legalizing rankless and dynamic shapes towards static.
}];
+
+ let constructor = "createTosaInferShapesPass()";
let dependentDialects = [
"func::FuncDialect",
"tensor::TensorDialect",
@@ -35,7 +39,7 @@ def TosaInferShapesPass : Pass<"tosa-infer-shapes", "func::FuncOp"> {
];
}
-def TosaMakeBroadcastablePass : Pass<"tosa-make-broadcastable", "func::FuncOp"> {
+def TosaMakeBroadcastable : Pass<"tosa-make-broadcastable", "func::FuncOp"> {
let summary = "TOSA rank Reshape to enable Broadcasting";
let description = [{
Pass that enables broadcast by making all input arrays have the same
@@ -44,15 +48,19 @@ def TosaMakeBroadcastablePass : Pass<"tosa-make-broadcastable", "func::FuncOp">
approach similar to step 1 of Numpy 4-step broadcasting:
https://numpy.org/doc/stable/reference/ufuncs.html#broadcasting
}];
+
+ let constructor = "createTosaMakeBroadcastablePass()";
}
-def TosaOptionalDecompositionsPass
+def TosaOptionalDecompositions
: Pass<"tosa-optional-decompositions", "func::FuncOp"> {
let summary = "Applies Tosa operations optional decompositions";
let description = [{
Pass to apply the Tosa operations decompositions
exposed as populate functions in include/mlir/Dialect/Tosa/Transforms/Passes.h
}];
+
+ let constructor = "tosa::createTosaOptionalDecompositions()";
}
#endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSES
diff --git a/mlir/include/mlir/Dialect/Transform/Transforms/Passes.h b/mlir/include/mlir/Dialect/Transform/Transforms/Passes.h
index be5cbd500b1c4..a567db6bc8e7a 100644
--- a/mlir/include/mlir/Dialect/Transform/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Transform/Transforms/Passes.h
@@ -16,8 +16,7 @@ namespace mlir {
class Pass;
namespace transform {
-#define GEN_PASS_DECL_CHECKUSESPASS
-#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
+std::unique_ptr<Pass> createCheckUsesPass();
#define GEN_PASS_REGISTRATION
#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
diff --git a/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td b/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td
index 4fdd2e3d875ff..1d7d8652c6501 100644
--- a/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Transform/Transforms/Passes.td
@@ -11,7 +11,7 @@
include "mlir/Pass/PassBase.td"
-def CheckUsesPass : Pass<"transform-dialect-check-uses"> {
+def CheckUses : Pass<"transform-dialect-check-uses"> {
let summary = "warn about potential use-after-free in the transform dialect";
let description = [{
This pass analyzes operations from the transform dialect and its extensions
@@ -30,6 +30,7 @@ def CheckUsesPass : Pass<"transform-dialect-check-uses"> {
prior to this pass provided that transform ops implement the relevant
control flow interfaces.
}];
+ let constructor = "::mlir::transform::createCheckUsesPass()";
}
#endif // MLIR_DIALECT_TRANSFORM_TRANSFORMS_PASSES
diff --git a/mlir/include/mlir/Dialect/Vector/Transforms/Passes.h b/mlir/include/mlir/Dialect/Vector/Transforms/Passes.h
index 1d36132070802..7734fe9d9cc98 100644
--- a/mlir/include/mlir/Dialect/Vector/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/Vector/Transforms/Passes.h
@@ -13,8 +13,8 @@
namespace mlir {
namespace vector {
-#define GEN_PASS_DECL_VECTORBUFFERIZEPASS
-#include "mlir/Dialect/Vector/Transforms/Passes.h.inc"
+/// Creates an instance of the `vector` dialect bufferization pass.
+std::unique_ptr<Pass> createVectorBufferizePass();
//===----------------------------------------------------------------------===//
// Registration
diff --git a/mlir/include/mlir/Dialect/Vector/Transforms/Passes.td b/mlir/include/mlir/Dialect/Vector/Transforms/Passes.td
index c7850933f0de1..a1971a7121b0d 100644
--- a/mlir/include/mlir/Dialect/Vector/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/Vector/Transforms/Passes.td
@@ -11,8 +11,9 @@
include "mlir/Pass/PassBase.td"
-def VectorBufferizePass : Pass<"vector-bufferize", "func::FuncOp"> {
+def VectorBufferize : Pass<"vector-bufferize", "func::FuncOp"> {
let summary = "Bufferize Vector dialect ops";
+ let constructor = "mlir::vector::createVectorBufferizePass()";
}
#endif // MLIR_DIALECT_VECTOR_TRANSFORMS_PASSES
diff --git a/mlir/include/mlir/Reducer/PassDetail.h b/mlir/include/mlir/Reducer/PassDetail.h
new file mode 100644
index 0000000000000..327d9b581514d
--- /dev/null
+++ b/mlir/include/mlir/Reducer/PassDetail.h
@@ -0,0 +1,22 @@
+//===- PassDetail.h - Reducer Pass class details ----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_REDUCER_PASSDETAIL_H
+#define MLIR_REDUCER_PASSDETAIL_H
+
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Reducer/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // MLIR_REDUCER_PASSDETAIL_H
diff --git a/mlir/include/mlir/Reducer/Passes.h b/mlir/include/mlir/Reducer/Passes.h
index a6d37f1aabc10..c0d46bfccf54b 100644
--- a/mlir/include/mlir/Reducer/Passes.h
+++ b/mlir/include/mlir/Reducer/Passes.h
@@ -12,10 +12,6 @@
namespace mlir {
-#define GEN_PASS_DECL_REDUCTIONTREEPASS
-#define GEN_PASS_DECL_OPTREDUCTIONPASS
-#include "mlir/Reducer/Passes.h.inc"
-
std::unique_ptr<Pass> createReductionTreePass();
std::unique_ptr<Pass> createOptReductionPass();
diff --git a/mlir/include/mlir/Reducer/Passes.td b/mlir/include/mlir/Reducer/Passes.td
index 26a56e77b686f..cf89176106050 100644
--- a/mlir/include/mlir/Reducer/Passes.td
+++ b/mlir/include/mlir/Reducer/Passes.td
@@ -24,7 +24,7 @@ def CommonReductionPassOptions {
];
}
-def ReductionTreePass : Pass<"reduction-tree"> {
+def ReductionTree : Pass<"reduction-tree"> {
let summary = "Reduce the input with reduction-tree algorithm";
let constructor = "mlir::createReductionTreePass()";
@@ -36,7 +36,7 @@ def ReductionTreePass : Pass<"reduction-tree"> {
] # CommonReductionPassOptions.options;
}
-def OptReductionPass : Pass<"opt-reduction-pass", "ModuleOp"> {
+def OptReduction : Pass<"opt-reduction-pass", "ModuleOp"> {
let summary = "A wrapper pass that reduces the file with optimization passes";
let constructor = "mlir::createOptReductionPass()";
diff --git a/mlir/include/mlir/Transforms/LocationSnapshot.h b/mlir/include/mlir/Transforms/LocationSnapshot.h
index 7f30e578902b3..1da114574c9a6 100644
--- a/mlir/include/mlir/Transforms/LocationSnapshot.h
+++ b/mlir/include/mlir/Transforms/LocationSnapshot.h
@@ -26,9 +26,6 @@ class Operation;
class OpPrintingFlags;
class Pass;
-#define GEN_PASS_DECL_LOCATIONSNAPSHOTPASS
-#include "mlir/Transforms/Passes.h.inc"
-
/// This function generates new locations from the given IR by snapshotting the
/// IR to the given stream, and using the printed locations within that stream.
/// The generated locations replace the current operation locations.
diff --git a/mlir/include/mlir/Transforms/Passes.h b/mlir/include/mlir/Transforms/Passes.h
index 7463e626f9d6e..16862ae4fe586 100644
--- a/mlir/include/mlir/Transforms/Passes.h
+++ b/mlir/include/mlir/Transforms/Passes.h
@@ -28,19 +28,6 @@ class GreedyRewriteConfig;
// Passes
//===----------------------------------------------------------------------===//
-#define GEN_PASS_DECL_CANONICALIZERPASS
-#define GEN_PASS_DECL_CONTROLFLOWSINKPASS
-#define GEN_PASS_DECL_CSEPASS
-#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
-#define GEN_PASS_DECL_STRIPDEBUGINFOPASS
-#define GEN_PASS_DECL_PRINTOPSTATSPASS
-#define GEN_PASS_DECL_INLINERPASS
-#define GEN_PASS_DECL_SCCPPASS
-#define GEN_PASS_DECL_SYMBOLDCEPASS
-#define GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
-#define GEN_PASS_DECL_TOPOLOGICALSORTPASS
-#include "mlir/Transforms/Passes.h.inc"
-
/// Creates an instance of the Canonicalizer pass, configured with default
/// settings (which can be overridden by pass options on the command line).
std::unique_ptr<Pass> createCanonicalizerPass();
@@ -58,6 +45,19 @@ createCanonicalizerPass(const GreedyRewriteConfig &config,
ArrayRef<std::string> disabledPatterns = llvm::None,
ArrayRef<std::string> enabledPatterns = llvm::None);
+/// Creates a pass to perform control-flow sinking.
+std::unique_ptr<Pass> createControlFlowSinkPass();
+
+/// Creates a pass to perform common sub expression elimination.
+std::unique_ptr<Pass> createCSEPass();
+
+/// Creates a loop invariant code motion pass that hoists loop invariant
+/// instructions out of the loop.
+std::unique_ptr<Pass> createLoopInvariantCodeMotionPass();
+
+/// Creates a pass to strip debug information from a function.
+std::unique_ptr<Pass> createStripDebugInfoPass();
+
/// Creates a pass which prints the list of ops and the number of occurrences in
/// the module.
std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os = llvm::errs());
@@ -83,11 +83,24 @@ std::unique_ptr<Pass>
createInlinerPass(llvm::StringMap<OpPassManager> opPipelines,
std::function<void(OpPassManager &)> defaultPipelineBuilder);
+/// Creates a pass which performs sparse conditional constant propagation over
+/// nested operations.
+std::unique_ptr<Pass> createSCCPPass();
+
+/// Creates a pass which delete symbol operations that are unreachable. This
+/// pass may *only* be scheduled on an operation that defines a SymbolTable.
+std::unique_ptr<Pass> createSymbolDCEPass();
+
/// Creates a pass which marks top-level symbol operations as `private` unless
/// listed in `excludeSymbols`.
std::unique_ptr<Pass>
createSymbolPrivatizePass(ArrayRef<std::string> excludeSymbols = {});
+/// Creates a pass that recursively sorts nested regions without SSA dominance
+/// topologically such that, as much as possible, users of values appear after
+/// their producers.
+std::unique_ptr<Pass> createTopologicalSortPass();
+
//===----------------------------------------------------------------------===//
// Registration
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Transforms/Passes.td b/mlir/include/mlir/Transforms/Passes.td
index d13c4628e0efd..8b8e6a1001574 100644
--- a/mlir/include/mlir/Transforms/Passes.td
+++ b/mlir/include/mlir/Transforms/Passes.td
@@ -16,7 +16,7 @@
include "mlir/Pass/PassBase.td"
include "mlir/Rewrite/PassUtil.td"
-def CanonicalizerPass : Pass<"canonicalize"> {
+def Canonicalizer : Pass<"canonicalize"> {
let summary = "Canonicalize operations";
let description = [{
This pass performs various types of canonicalizations over a set of
@@ -37,7 +37,7 @@ def CanonicalizerPass : Pass<"canonicalize"> {
] # RewritePassUtils.options;
}
-def ControlFlowSinkPass : Pass<"control-flow-sink"> {
+def ControlFlowSink : Pass<"control-flow-sink"> {
let summary = "Sink operations into conditional blocks";
let description = [{
This pass implements control-flow sink on operations that implement
@@ -55,12 +55,13 @@ def ControlFlowSinkPass : Pass<"control-flow-sink"> {
blocks: ops in unreachable blocks may prevent other operations from being
sunk as they may contain uses of their results
}];
+ let constructor = "::mlir::createControlFlowSinkPass()";
let statistics = [
Statistic<"numSunk", "num-sunk", "Number of operations sunk">,
];
}
-def CSEPass : Pass<"cse"> {
+def CSE : Pass<"cse"> {
let summary = "Eliminate common sub-expressions";
let description = [{
This pass implements a generalized algorithm for common sub-expression
@@ -69,13 +70,14 @@ def CSEPass : Pass<"cse"> {
operations. See [Common subexpression elimination](https://en.wikipedia.org/wiki/Common_subexpression_elimination)
for more general details on this optimization.
}];
+ let constructor = "mlir::createCSEPass()";
let statistics = [
Statistic<"numCSE", "num-cse'd", "Number of operations CSE'd">,
Statistic<"numDCE", "num-dce'd", "Number of operations DCE'd">
];
}
-def InlinerPass : Pass<"inline"> {
+def Inliner : Pass<"inline"> {
let summary = "Inline function calls";
let constructor = "mlir::createInlinerPass()";
let options = [
@@ -90,7 +92,7 @@ def InlinerPass : Pass<"inline"> {
];
}
-def LocationSnapshotPass : Pass<"snapshot-op-locations"> {
+def LocationSnapshot : Pass<"snapshot-op-locations"> {
let summary = "Generate new locations from the current IR";
let description = [{
This pass allows for generating new locations from the IR during any stage
@@ -135,11 +137,12 @@ def LocationSnapshotPass : Pass<"snapshot-op-locations"> {
];
}
-def LoopInvariantCodeMotionPass : Pass<"loop-invariant-code-motion"> {
+def LoopInvariantCodeMotion : Pass<"loop-invariant-code-motion"> {
let summary = "Hoist loop invariant instructions outside of the loop";
+ let constructor = "mlir::createLoopInvariantCodeMotionPass()";
}
-def PrintOpStatsPass : Pass<"print-op-stats"> {
+def PrintOpStats : Pass<"print-op-stats"> {
let summary = "Print statistics of operations";
let constructor = "mlir::createPrintOpStatsPass()";
let options = [
@@ -148,7 +151,7 @@ def PrintOpStatsPass : Pass<"print-op-stats"> {
];
}
-def SCCPPass : Pass<"sccp"> {
+def SCCP : Pass<"sccp"> {
let summary = "Sparse Conditional Constant Propagation";
let description = [{
This pass implements a general algorithm for sparse conditional constant
@@ -159,17 +162,19 @@ def SCCPPass : Pass<"sccp"> {
This implementation is based on the algorithm described by Wegman and Zadeck
in [“Constant Propagation with Conditional Branches”](https://dl.acm.org/doi/10.1145/103135.103136) (1991).
}];
+ let constructor = "mlir::createSCCPPass()";
}
-def StripDebugInfoPass : Pass<"strip-debuginfo"> {
+def StripDebugInfo : Pass<"strip-debuginfo"> {
let summary = "Strip debug info from all operations";
let description = [{
This pass strips the IR of any location information, by replacing all
operation locations with [`unknown`](Diagnostics.md#unknown-location).
}];
+ let constructor = "mlir::createStripDebugInfoPass()";
}
-def SymbolDCEPass : Pass<"symbol-dce"> {
+def SymbolDCE : Pass<"symbol-dce"> {
let summary = "Eliminate dead symbols";
let description = [{
This pass deletes all symbols that are found to be unreachable. This is done
@@ -209,13 +214,14 @@ def SymbolDCEPass : Pass<"symbol-dce"> {
See [Symbols and SymbolTables](SymbolsAndSymbolTables.md) for more
information on `Symbols`.
}];
+ let constructor = "mlir::createSymbolDCEPass()";
let statistics = [
Statistic<"numDCE", "num-dce'd", "Number of symbols DCE'd">,
];
}
-def SymbolPrivatizePass : Pass<"symbol-privatize"> {
+def SymbolPrivatize : Pass<"symbol-privatize"> {
let summary = "Mark symbols private";
let description = [{
This pass marks all top-level symbols of the operation run as `private`
@@ -228,7 +234,7 @@ def SymbolPrivatizePass : Pass<"symbol-privatize"> {
let constructor = "mlir::createSymbolPrivatizePass()";
}
-def ViewOpGraphPass : Pass<"view-op-graph"> {
+def ViewOpGraph : Pass<"view-op-graph"> {
let summary = "Print Graphviz visualization of an operation";
let description = [{
This pass prints a Graphviz graph of a module.
@@ -255,10 +261,10 @@ def ViewOpGraphPass : Pass<"view-op-graph"> {
Option<"printResultTypes", "print-result-types", "bool",
/*default=*/"true", "Print result types of operations">
];
- let constructor = "mlir::createViewOpGraphPass()";
+ let constructor = "mlir::createPrintOpGraphPass()";
}
-def TopologicalSortPass : Pass<"topological-sort"> {
+def TopologicalSort : Pass<"topological-sort"> {
let summary = "Sort regions without SSA dominance in topological order";
let description = [{
Recursively sorts all nested regions without SSA dominance in topological
@@ -271,6 +277,8 @@ def TopologicalSortPass : Pass<"topological-sort"> {
is not changed. Operations that form a cycle are moved to the end of the
regions in a stable order.
}];
+
+ let constructor = "mlir::createTopologicalSortPass()";
}
#endif // MLIR_TRANSFORMS_PASSES
diff --git a/mlir/include/mlir/Transforms/ViewOpGraph.h b/mlir/include/mlir/Transforms/ViewOpGraph.h
index f8abc1436f4fe..ab52ec7646211 100644
--- a/mlir/include/mlir/Transforms/ViewOpGraph.h
+++ b/mlir/include/mlir/Transforms/ViewOpGraph.h
@@ -19,11 +19,8 @@
namespace mlir {
class Pass;
-#define GEN_PASS_DECL_VIEWOPGRAPHPASS
-#include "mlir/Transforms/Passes.h.inc"
-
/// Creates a pass to print op graphs.
-std::unique_ptr<Pass> createViewOpGraphPass(raw_ostream &os = llvm::errs());
+std::unique_ptr<Pass> createPrintOpGraphPass(raw_ostream &os = llvm::errs());
} // namespace mlir
diff --git a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
index e292bf348e8dc..0e2894aae7566 100644
--- a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
+++ b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
@@ -7,17 +7,11 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/AMDGPU/AMDGPUDialect.h"
#include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTAMDGPUTOROCDLPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
using namespace mlir::amdgpu;
@@ -275,8 +269,8 @@ struct LDSBarrierOpLowering : public ConvertOpToLLVMPattern<LDSBarrierOp> {
};
struct ConvertAMDGPUToROCDLPass
- : public impl::ConvertAMDGPUToROCDLPassBase<ConvertAMDGPUToROCDLPass> {
- using ConvertAMDGPUToROCDLPassBase::ConvertAMDGPUToROCDLPassBase;
+ : public ConvertAMDGPUToROCDLBase<ConvertAMDGPUToROCDLPass> {
+ ConvertAMDGPUToROCDLPass() = default;
void runOnOperation() override {
MLIRContext *ctx = &getContext();
@@ -309,3 +303,7 @@ void mlir::populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter,
RawBufferOpLowering<RawBufferAtomicFaddOp, ROCDL::RawBufferAtomicFAddOp>>(
converter, chipset);
}
+
+std::unique_ptr<Pass> mlir::createConvertAMDGPUToROCDLPass() {
+ return std::make_unique<ConvertAMDGPUToROCDLPass>();
+}
diff --git a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
index 67835c05b263e..2c9a1eaa2bf62 100644
--- a/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
+++ b/mlir/lib/Conversion/AffineToStandard/AffineToStandard.cpp
@@ -13,6 +13,7 @@
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
@@ -21,14 +22,10 @@
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/MLIRContext.h"
+#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTAFFINETOSTANDARDPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::vector;
@@ -547,11 +544,7 @@ void mlir::populateAffineToVectorConversionPatterns(
}
namespace {
-class ConvertAffineToStandardPass
- : public impl::ConvertAffineToStandardPassBase<
- ConvertAffineToStandardPass> {
- using ConvertAffineToStandardPassBase::ConvertAffineToStandardPassBase;
-
+class LowerAffinePass : public ConvertAffineToStandardBase<LowerAffinePass> {
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
populateAffineToStdConversionPatterns(patterns);
@@ -565,3 +558,9 @@ class ConvertAffineToStandardPass
}
};
} // namespace
+
+/// Lowers If and For operations within a function into their lower level CFG
+/// equivalent blocks.
+std::unique_ptr<Pass> mlir::createLowerAffinePass() {
+ return std::make_unique<LowerAffinePass>();
+}
diff --git a/mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp b/mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
index e579f278617bc..df6df155f41d8 100644
--- a/mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
+++ b/mlir/lib/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.cpp
@@ -7,18 +7,12 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/VectorPattern.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTARITHMETICTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -321,9 +315,8 @@ CmpFOpLowering::matchAndRewrite(arith::CmpFOp op, OpAdaptor adaptor,
namespace {
struct ConvertArithmeticToLLVMPass
- : public impl::ConvertArithmeticToLLVMPassBase<
- ConvertArithmeticToLLVMPass> {
- using ConvertArithmeticToLLVMPassBase::ConvertArithmeticToLLVMPassBase;
+ : public ConvertArithmeticToLLVMBase<ConvertArithmeticToLLVMPass> {
+ ConvertArithmeticToLLVMPass() = default;
void runOnOperation() override {
LLVMConversionTarget target(getContext());
@@ -396,3 +389,7 @@ void mlir::arith::populateArithmeticToLLVMConversionPatterns(
>(converter);
// clang-format on
}
+
+std::unique_ptr<Pass> mlir::arith::createConvertArithmeticToLLVMPass() {
+ return std::make_unique<ConvertArithmeticToLLVMPass>();
+}
diff --git a/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp b/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
index 8e54e0de4784e..6ca37c667daba 100644
--- a/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
+++ b/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
-
+#include "../PassDetail.h"
#include "../SPIRVCommon/Pattern.h"
#include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
@@ -20,11 +20,6 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTARITHMETICTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "arith-to-spirv-pattern"
using namespace mlir;
@@ -860,8 +855,8 @@ AddICarryOpPattern::matchAndRewrite(arith::AddUICarryOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const {
Type dstElemTy = adaptor.getLhs().getType();
Location loc = op->getLoc();
- Value result = rewriter.create<spirv::IAddCarryOp>(loc, adaptor.getLhs(),
- adaptor.getRhs());
+ Value result = rewriter.create<spirv::IAddCarryOp>(
+ loc, adaptor.getLhs(), adaptor.getRhs());
Value sumResult = rewriter.create<spirv::CompositeExtractOp>(
loc, result, llvm::makeArrayRef(0));
@@ -953,10 +948,7 @@ void mlir::arith::populateArithmeticToSPIRVPatterns(
namespace {
struct ConvertArithmeticToSPIRVPass
- : public impl::ConvertArithmeticToSPIRVPassBase<
- ConvertArithmeticToSPIRVPass> {
- using ConvertArithmeticToSPIRVPassBase::ConvertArithmeticToSPIRVPassBase;
-
+ : public ConvertArithmeticToSPIRVBase<ConvertArithmeticToSPIRVPass> {
void runOnOperation() override {
Operation *op = getOperation();
auto targetAttr = spirv::lookupTargetEnvOrDefault(op);
@@ -986,6 +978,7 @@ struct ConvertArithmeticToSPIRVPass
};
} // namespace
-std::unique_ptr<OperationPass<>> mlir::createConvertArithmeticToSPIRVPass() {
+std::unique_ptr<OperationPass<>>
+mlir::arith::createConvertArithmeticToSPIRVPass() {
return std::make_unique<ConvertArithmeticToSPIRVPass>();
}
diff --git a/mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp b/mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp
index a963e71d92881..a2f5641a0f5e2 100644
--- a/mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp
+++ b/mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h"
-
+#include "../PassDetail.h"
#include "mlir/Dialect/ArmNeon/ArmNeonDialect.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/PatternMatch.h"
@@ -15,11 +15,6 @@
#include "mlir/Pass/PassRegistry.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTARMNEON2DTOINTRPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::arm_neon;
@@ -51,10 +46,8 @@ class Sdot2dLoweringPattern : public OpRewritePattern<Sdot2dOp> {
}
};
-class ConvertArmNeon2dToIntrPass
- : public impl::ConvertArmNeon2dToIntrPassBase<ConvertArmNeon2dToIntrPass> {
- using ConvertArmNeon2dToIntrPassBase::ConvertArmNeon2dToIntrPassBase;
-
+class ConvertArmNeon2dToIntr
+ : public ConvertArmNeon2dToIntrBase<ConvertArmNeon2dToIntr> {
void runOnOperation() override {
auto *context = &getContext();
@@ -72,3 +65,7 @@ class ConvertArmNeon2dToIntrPass
void mlir::populateConvertArmNeon2dToIntrPatterns(RewritePatternSet &patterns) {
patterns.add<Sdot2dLoweringPattern>(patterns.getContext());
}
+
+std::unique_ptr<Pass> mlir::createConvertArmNeon2dToIntrPass() {
+ return std::make_unique<ConvertArmNeon2dToIntr>();
+}
diff --git a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
index 7ed8348d631b6..26154e4ed66d9 100644
--- a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
+++ b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
@@ -8,6 +8,7 @@
#include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
@@ -23,11 +24,6 @@
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTASYNCTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "convert-async-to-llvm"
using namespace mlir;
@@ -990,9 +986,7 @@ class ReturnOpOpConversion : public OpConversionPattern<func::ReturnOp> {
namespace {
struct ConvertAsyncToLLVMPass
- : public impl::ConvertAsyncToLLVMPassBase<ConvertAsyncToLLVMPass> {
- using ConvertAsyncToLLVMPassBase::ConvertAsyncToLLVMPassBase;
-
+ : public ConvertAsyncToLLVMBase<ConvertAsyncToLLVMPass> {
void runOnOperation() override;
};
} // namespace
@@ -1123,6 +1117,10 @@ class ConvertYieldOpTypes : public OpConversionPattern<async::YieldOp> {
};
} // namespace
+std::unique_ptr<OperationPass<ModuleOp>> mlir::createConvertAsyncToLLVMPass() {
+ return std::make_unique<ConvertAsyncToLLVMPass>();
+}
+
void mlir::populateAsyncStructuralTypeConversionsAndLegality(
TypeConverter &typeConverter, RewritePatternSet &patterns,
ConversionTarget &target) {
@@ -1138,7 +1136,3 @@ void mlir::populateAsyncStructuralTypeConversionsAndLegality(
target.addDynamicallyLegalOp<AwaitOp, ExecuteOp, async::YieldOp>(
[&](Operation *op) { return typeConverter.isLegal(op); });
}
-
-std::unique_ptr<OperationPass<ModuleOp>> mlir::createConvertAsyncToLLVMPass() {
- return std::make_unique<ConvertAsyncToLLVMPass>();
-}
diff --git a/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp b/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
index d1a575ca4e5df..d98bb2a233358 100644
--- a/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
+++ b/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
@@ -12,20 +12,14 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/BufferizationToMemRef/BufferizationToMemRef.h"
-
+#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/BuiltinTypes.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTBUFFERIZATIONTOMEMREFPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -87,11 +81,9 @@ void mlir::populateBufferizationToMemRefConversionPatterns(
}
namespace {
-struct ConvertBufferizationToMemRefPass
- : public impl::ConvertBufferizationToMemRefPassBase<
- ConvertBufferizationToMemRefPass> {
- using ConvertBufferizationToMemRefPassBase::
- ConvertBufferizationToMemRefPassBase;
+struct BufferizationToMemRefPass
+ : public ConvertBufferizationToMemRefBase<BufferizationToMemRefPass> {
+ BufferizationToMemRefPass() = default;
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
@@ -108,3 +100,7 @@ struct ConvertBufferizationToMemRefPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createBufferizationToMemRefPass() {
+ return std::make_unique<BufferizationToMemRefPass>();
+}
diff --git a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
index 8b5861d1fd99c..820086e6d2ba9 100644
--- a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
+++ b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
@@ -8,17 +8,12 @@
#include "mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTCOMPLEXTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
using namespace mlir::LLVM;
@@ -323,9 +318,7 @@ void mlir::populateComplexToLLVMConversionPatterns(
namespace {
struct ConvertComplexToLLVMPass
- : public impl::ConvertComplexToLLVMPassBase<ConvertComplexToLLVMPass> {
- using ConvertComplexToLLVMPassBase::ConvertComplexToLLVMPassBase;
-
+ : public ConvertComplexToLLVMBase<ConvertComplexToLLVMPass> {
void runOnOperation() override;
};
} // namespace
@@ -342,3 +335,7 @@ void ConvertComplexToLLVMPass::runOnOperation() {
applyPartialConversion(getOperation(), target, std::move(patterns))))
signalPassFailure();
}
+
+std::unique_ptr<Pass> mlir::createConvertComplexToLLVMPass() {
+ return std::make_unique<ConvertComplexToLLVMPass>();
+}
diff --git a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
index e8da779a515c1..558b1cc66a324 100644
--- a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
+++ b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
@@ -8,15 +8,10 @@
#include "mlir/Conversion/ComplexToLibm/ComplexToLibm.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTCOMPLEXTOLIBMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -122,9 +117,7 @@ void mlir::populateComplexToLibmConversionPatterns(RewritePatternSet &patterns,
namespace {
struct ConvertComplexToLibmPass
- : public impl::ConvertComplexToLibmPassBase<ConvertComplexToLibmPass> {
- using ConvertComplexToLibmPassBase::ConvertComplexToLibmPassBase;
-
+ : public ConvertComplexToLibmBase<ConvertComplexToLibmPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
index b7b833b52ee2b..064b0db08a413 100644
--- a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
+++ b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp
@@ -8,20 +8,16 @@
#include "mlir/Conversion/ComplexToStandard/ComplexToStandard.h"
+#include <memory>
+#include <type_traits>
+
+#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
-#include <memory>
-#include <type_traits>
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTCOMPLEXTOSTANDARDPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -1085,10 +1081,7 @@ void mlir::populateComplexToStandardConversionPatterns(
namespace {
struct ConvertComplexToStandardPass
- : public impl::ConvertComplexToStandardPassBase<
- ConvertComplexToStandardPass> {
- using ConvertComplexToStandardPassBase::ConvertComplexToStandardPassBase;
-
+ : public ConvertComplexToStandardBase<ConvertComplexToStandardPass> {
void runOnOperation() override;
};
@@ -1105,3 +1098,7 @@ void ConvertComplexToStandardPass::runOnOperation() {
signalPassFailure();
}
} // namespace
+
+std::unique_ptr<Pass> mlir::createConvertComplexToStandardPass() {
+ return std::make_unique<ConvertComplexToStandardPass>();
+}
diff --git a/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp b/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
index b5e435bf3a6e7..89012704541d6 100644
--- a/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
+++ b/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/LLVMCommon/VectorPattern.h"
@@ -21,16 +21,10 @@
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/StringRef.h"
#include <functional>
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTCONTROLFLOWTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
#define PASS_NAME "convert-cf-to-llvm"
@@ -201,10 +195,9 @@ void mlir::cf::populateControlFlowToLLVMConversionPatterns(
namespace {
/// A pass converting MLIR operations into the LLVM IR dialect.
-struct ConvertControlFlowToLLVMPass
- : public impl::ConvertControlFlowToLLVMPassBase<
- ConvertControlFlowToLLVMPass> {
- using ConvertControlFlowToLLVMPassBase::ConvertControlFlowToLLVMPassBase;
+struct ConvertControlFlowToLLVM
+ : public ConvertControlFlowToLLVMBase<ConvertControlFlowToLLVM> {
+ ConvertControlFlowToLLVM() = default;
/// Run the dialect converter on the module.
void runOnOperation() override {
@@ -224,3 +217,7 @@ struct ConvertControlFlowToLLVMPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::cf::createConvertControlFlowToLLVMPass() {
+ return std::make_unique<ConvertControlFlowToLLVM>();
+}
diff --git a/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp b/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp
index 5eb51d52790a9..6cd237ea3e0e1 100644
--- a/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.cpp
@@ -11,25 +11,17 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRVPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTCONTROLFLOWTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// A pass converting MLIR ControlFlow operations into the SPIR-V dialect.
class ConvertControlFlowToSPIRVPass
- : public impl::ConvertControlFlowToSPIRVPassBase<
- ConvertControlFlowToSPIRVPass> {
- using ConvertControlFlowToSPIRVPassBase::ConvertControlFlowToSPIRVPassBase;
-
+ : public ConvertControlFlowToSPIRVBase<ConvertControlFlowToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
index 08979ccef9eb3..4b80bcb90cc3e 100644
--- a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
+++ b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
@@ -11,12 +11,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Analysis/DataLayoutAnalysis.h"
#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
+#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/LLVMCommon/VectorPattern.h"
@@ -47,11 +47,6 @@
#include <algorithm>
#include <functional>
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTFUNCTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
#define PASS_NAME "convert-func-to-llvm"
@@ -704,7 +699,7 @@ void mlir::populateFuncToLLVMConversionPatterns(LLVMTypeConverter &converter,
namespace {
/// A pass converting Func operations into the LLVM IR dialect.
struct ConvertFuncToLLVMPass
- : public impl::ConvertFuncToLLVMPassBase<ConvertFuncToLLVMPass> {
+ : public ConvertFuncToLLVMBase<ConvertFuncToLLVMPass> {
ConvertFuncToLLVMPass() = default;
ConvertFuncToLLVMPass(bool useBarePtrCallConv, unsigned indexBitwidth,
bool useAlignedAlloc,
diff --git a/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp b/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp
index 131623f532640..d2416feea763c 100644
--- a/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRVPass.cpp
@@ -11,24 +11,17 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/FuncToSPIRV/FuncToSPIRVPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTFUNCTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// A pass converting MLIR Func operations into the SPIR-V dialect.
class ConvertFuncToSPIRVPass
- : public impl::ConvertFuncToSPIRVPassBase<ConvertFuncToSPIRVPass> {
- using ConvertFuncToSPIRVPassBase::ConvertFuncToSPIRVPassBase;
-
+ : public ConvertFuncToSPIRVBase<ConvertFuncToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
index 875772617fd72..e4448ff1f3100 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
@@ -15,6 +15,7 @@
#include "mlir/Conversion/GPUCommon/GPUCommonPass.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
#include "mlir/Conversion/AsyncToLLVM/AsyncToLLVM.h"
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
@@ -37,29 +38,25 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/FormatVariadic.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTGPUTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
static constexpr const char *kGpuBinaryStorageSuffix = "_gpubin_cst";
namespace {
-class ConvertGpuToLLVMPass
- : public impl::ConvertGpuToLLVMPassBase<ConvertGpuToLLVMPass> {
+class GpuToLLVMConversionPass
+ : public GpuToLLVMConversionPassBase<GpuToLLVMConversionPass> {
public:
- ConvertGpuToLLVMPass() = default;
+ GpuToLLVMConversionPass() = default;
- ConvertGpuToLLVMPass(bool kernelBarePtrCallConv) : ConvertGpuToLLVMPass() {
+ GpuToLLVMConversionPass(bool kernelBarePtrCallConv)
+ : GpuToLLVMConversionPass() {
if (this->kernelBarePtrCallConv.getNumOccurrences() == 0)
this->kernelBarePtrCallConv = kernelBarePtrCallConv;
}
- ConvertGpuToLLVMPass(const ConvertGpuToLLVMPass &other)
- : ConvertGpuToLLVMPassBase(other) {}
+ GpuToLLVMConversionPass(const GpuToLLVMConversionPass &other)
+ : GpuToLLVMConversionPassBase(other) {}
// Run the dialect converter on the module.
void runOnOperation() override;
@@ -380,7 +377,7 @@ class ConvertSetDefaultDeviceOpToGpuRuntimeCallPattern
};
} // namespace
-void ConvertGpuToLLVMPass::runOnOperation() {
+void GpuToLLVMConversionPass::runOnOperation() {
LLVMTypeConverter converter(&getContext());
RewritePatternSet patterns(&getContext());
LLVMConversionTarget target(getContext());
@@ -899,6 +896,11 @@ LogicalResult ConvertSetDefaultDeviceOpToGpuRuntimeCallPattern::matchAndRewrite(
return success();
}
+std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
+mlir::createGpuToLLVMConversionPass(bool kernelBarePtrCallConv) {
+ return std::make_unique<GpuToLLVMConversionPass>(kernelBarePtrCallConv);
+}
+
void mlir::populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
RewritePatternSet &patterns,
StringRef gpuBinaryAnnotation,
@@ -920,8 +922,3 @@ void mlir::populateGpuToLLVMConversionPatterns(LLVMTypeConverter &converter,
converter, gpuBinaryAnnotation, kernelBarePtrCallConv);
patterns.add<EraseGpuModuleOpPattern>(&converter.getContext());
}
-
-std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
-mlir::createConvertGpuToLLVMPass(bool kernelBarePtrCallConv) {
- return std::make_unique<ConvertGpuToLLVMPass>(kernelBarePtrCallConv);
-}
diff --git a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
index 07af892ef520a..2e89a3a235085 100644
--- a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
+++ b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
@@ -36,11 +36,7 @@
#include "../GPUCommon/GPUOpsLowering.h"
#include "../GPUCommon/IndexIntrinsicsOpLowering.h"
#include "../GPUCommon/OpToFuncCallLowering.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTGPUTONVVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
+#include "../PassDetail.h"
using namespace mlir;
@@ -155,10 +151,10 @@ struct GPULaneIdOpToNVVM : ConvertOpToLLVMPattern<gpu::LaneIdOp> {
///
/// This pass only handles device code and is not meant to be run on GPU host
/// code.
-struct ConvertGpuToNVVMPass
- : public impl::ConvertGpuToNVVMPassBase<ConvertGpuToNVVMPass> {
- ConvertGpuToNVVMPass() = default;
- ConvertGpuToNVVMPass(unsigned indexBitwidth) {
+struct LowerGpuOpsToNVVMOpsPass
+ : public ConvertGpuOpsToNVVMOpsBase<LowerGpuOpsToNVVMOpsPass> {
+ LowerGpuOpsToNVVMOpsPass() = default;
+ LowerGpuOpsToNVVMOpsPass(unsigned indexBitwidth) {
this->indexBitwidth = indexBitwidth;
}
@@ -293,6 +289,6 @@ void mlir::populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter,
}
std::unique_ptr<OperationPass<gpu::GPUModuleOp>>
-mlir::createConvertGpuToNVVMPass(unsigned indexBitwidth) {
- return std::make_unique<ConvertGpuToNVVMPass>(indexBitwidth);
+mlir::createLowerGpuOpsToNVVMOpsPass(unsigned indexBitwidth) {
+ return std::make_unique<LowerGpuOpsToNVVMOpsPass>(indexBitwidth);
}
diff --git a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
index 3e6b844785257..2c7f700465193 100644
--- a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
+++ b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp
@@ -37,11 +37,7 @@
#include "../GPUCommon/GPUOpsLowering.h"
#include "../GPUCommon/IndexIntrinsicsOpLowering.h"
#include "../GPUCommon/OpToFuncCallLowering.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTGPUTOROCDLPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
+#include "../PassDetail.h"
using namespace mlir;
@@ -65,11 +61,12 @@ namespace {
//
// This pass only handles device code and is not meant to be run on GPU host
// code.
-struct ConvertGpuToROCDLPass
- : public impl::ConvertGpuToROCDLPassBase<ConvertGpuToROCDLPass> {
- ConvertGpuToROCDLPass() = default;
- ConvertGpuToROCDLPass(const std::string &chipset, unsigned indexBitwidth,
- bool useBarePtrCallConv, gpu::amd::Runtime runtime) {
+struct LowerGpuOpsToROCDLOpsPass
+ : public ConvertGpuOpsToROCDLOpsBase<LowerGpuOpsToROCDLOpsPass> {
+ LowerGpuOpsToROCDLOpsPass() = default;
+ LowerGpuOpsToROCDLOpsPass(const std::string &chipset, unsigned indexBitwidth,
+ bool useBarePtrCallConv,
+ gpu::amd::Runtime runtime) {
if (this->chipset.getNumOccurrences() == 0)
this->chipset = chipset;
if (this->indexBitwidth.getNumOccurrences() == 0)
@@ -223,10 +220,10 @@ void mlir::populateGpuToROCDLConversionPatterns(
}
std::unique_ptr<OperationPass<gpu::GPUModuleOp>>
-mlir::createConvertGpuToROCDLPass(const std::string &chipset,
- unsigned indexBitwidth,
- bool useBarePtrCallConv,
- gpu::amd::Runtime runtime) {
- return std::make_unique<ConvertGpuToROCDLPass>(chipset, indexBitwidth,
- useBarePtrCallConv, runtime);
+mlir::createLowerGpuOpsToROCDLOpsPass(const std::string &chipset,
+ unsigned indexBitwidth,
+ bool useBarePtrCallConv,
+ gpu::amd::Runtime runtime) {
+ return std::make_unique<LowerGpuOpsToROCDLOpsPass>(
+ chipset, indexBitwidth, useBarePtrCallConv, runtime);
}
diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
index f5fa81c49cecc..480c903f83ec1 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
@@ -13,6 +13,7 @@
#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRVPass.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
#include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h"
@@ -22,11 +23,6 @@
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTGPUTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -39,10 +35,9 @@ namespace {
/// replace it).
///
/// 2) Lower the body of the spirv::ModuleOp.
-class ConvertGPUToSPIRVPass
- : public impl::ConvertGPUToSPIRVPassBase<ConvertGPUToSPIRVPass> {
+class GPUToSPIRVPass : public ConvertGPUToSPIRVBase<GPUToSPIRVPass> {
public:
- explicit ConvertGPUToSPIRVPass(bool mapMemorySpace)
+ explicit GPUToSPIRVPass(bool mapMemorySpace)
: mapMemorySpace(mapMemorySpace) {}
void runOnOperation() override;
@@ -51,7 +46,7 @@ class ConvertGPUToSPIRVPass
};
} // namespace
-void ConvertGPUToSPIRVPass::runOnOperation() {
+void GPUToSPIRVPass::runOnOperation() {
MLIRContext *context = &getContext();
ModuleOp module = getOperation();
@@ -99,5 +94,5 @@ void ConvertGPUToSPIRVPass::runOnOperation() {
std::unique_ptr<OperationPass<ModuleOp>>
mlir::createConvertGPUToSPIRVPass(bool mapMemorySpace) {
- return std::make_unique<ConvertGPUToSPIRVPass>(mapMemorySpace);
+ return std::make_unique<GPUToSPIRVPass>(mapMemorySpace);
}
diff --git a/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp b/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
index 64f6106c02b80..361dae64ceaf6 100644
--- a/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
+++ b/mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
@@ -13,8 +13,8 @@
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
-
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
@@ -23,14 +23,8 @@
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Target/SPIRV/Serialization.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTGPULAUNCHFUNCTOVULKANLAUNCHFUNCPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
static constexpr const char *kSPIRVBlobAttrName = "spirv_blob";
@@ -43,13 +37,10 @@ namespace {
/// SPIR-V binary shader from `spirv::ModuleOp` using `spirv::serialize`
/// function and attaching binary data and entry point name as an attributes to
/// created vulkan launch call op.
-class ConvertGpuLaunchFuncToVulkanLaunchFuncPass
- : public impl::ConvertGpuLaunchFuncToVulkanLaunchFuncPassBase<
- ConvertGpuLaunchFuncToVulkanLaunchFuncPass> {
+class ConvertGpuLaunchFuncToVulkanLaunchFunc
+ : public ConvertGpuLaunchFuncToVulkanLaunchFuncBase<
+ ConvertGpuLaunchFuncToVulkanLaunchFunc> {
public:
- using ConvertGpuLaunchFuncToVulkanLaunchFuncPassBase::
- ConvertGpuLaunchFuncToVulkanLaunchFuncPassBase;
-
void runOnOperation() override;
private:
@@ -85,7 +76,7 @@ class ConvertGpuLaunchFuncToVulkanLaunchFuncPass
} // namespace
-void ConvertGpuLaunchFuncToVulkanLaunchFuncPass::runOnOperation() {
+void ConvertGpuLaunchFuncToVulkanLaunchFunc::runOnOperation() {
bool done = false;
getOperation().walk([this, &done](gpu::LaunchFuncOp op) {
if (done) {
@@ -106,8 +97,7 @@ void ConvertGpuLaunchFuncToVulkanLaunchFuncPass::runOnOperation() {
spirvModule.erase();
}
-LogicalResult
-ConvertGpuLaunchFuncToVulkanLaunchFuncPass::declareVulkanLaunchFunc(
+LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFunc::declareVulkanLaunchFunc(
Location loc, gpu::LaunchFuncOp launchOp) {
auto builder = OpBuilder::atBlockEnd(getOperation().getBody());
@@ -138,7 +128,7 @@ ConvertGpuLaunchFuncToVulkanLaunchFuncPass::declareVulkanLaunchFunc(
return success();
}
-LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFuncPass::createBinaryShader(
+LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFunc::createBinaryShader(
ModuleOp module, std::vector<char> &binaryShader) {
bool done = false;
SmallVector<uint32_t, 0> binary;
@@ -156,7 +146,7 @@ LogicalResult ConvertGpuLaunchFuncToVulkanLaunchFuncPass::createBinaryShader(
return success();
}
-void ConvertGpuLaunchFuncToVulkanLaunchFuncPass::convertGpuLaunchFunc(
+void ConvertGpuLaunchFuncToVulkanLaunchFunc::convertGpuLaunchFunc(
gpu::LaunchFuncOp launchOp) {
ModuleOp module = getOperation();
OpBuilder builder(launchOp);
@@ -198,5 +188,5 @@ void ConvertGpuLaunchFuncToVulkanLaunchFuncPass::convertGpuLaunchFunc(
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
mlir::createConvertGpuLaunchFuncToVulkanLaunchFuncPass() {
- return std::make_unique<ConvertGpuLaunchFuncToVulkanLaunchFuncPass>();
+ return std::make_unique<ConvertGpuLaunchFuncToVulkanLaunchFunc>();
}
diff --git a/mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp b/mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
index 043612ab52290..3242add0799d1 100644
--- a/mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
+++ b/mlir/lib/Conversion/GPUToVulkan/ConvertLaunchFuncToVulkanCalls.cpp
@@ -14,21 +14,16 @@
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/GPUToVulkan/ConvertGPUToVulkanPass.h"
-
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
-#include "mlir/Pass/Pass.h"
+
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/FormatVariadic.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTVULKANLAUNCHFUNCTOVULKANCALLSPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
static constexpr const char *kCInterfaceVulkanLaunch =
@@ -58,7 +53,7 @@ namespace {
/// * deinitVulkan -- deinitializes vulkan runtime
///
class VulkanLaunchFuncToVulkanCallsPass
- : public impl::ConvertVulkanLaunchFuncToVulkanCallsPassBase<
+ : public ConvertVulkanLaunchFuncToVulkanCallsBase<
VulkanLaunchFuncToVulkanCallsPass> {
private:
void initializeCachedTypes() {
@@ -154,9 +149,6 @@ class VulkanLaunchFuncToVulkanCallsPass
}
public:
- using ConvertVulkanLaunchFuncToVulkanCallsPassBase::
- ConvertVulkanLaunchFuncToVulkanCallsPassBase;
-
void runOnOperation() override;
private:
diff --git a/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp b/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
index 26066ac474613..04512f0bf61fb 100644
--- a/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
+++ b/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
@@ -8,6 +8,7 @@
#include "mlir/Conversion/LinalgToLLVM/LinalgToLLVM.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/AffineToStandard/AffineToStandard.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
@@ -40,11 +41,6 @@
#include "llvm/Support/Allocator.h"
#include "llvm/Support/ErrorHandling.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTLINALGTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::LLVM;
using namespace mlir::linalg;
@@ -78,9 +74,7 @@ void mlir::populateLinalgToLLVMConversionPatterns(LLVMTypeConverter &converter,
namespace {
struct ConvertLinalgToLLVMPass
- : public impl::ConvertLinalgToLLVMPassBase<ConvertLinalgToLLVMPass> {
- using ConvertLinalgToLLVMPassBase::ConvertLinalgToLLVMPassBase;
-
+ : public ConvertLinalgToLLVMBase<ConvertLinalgToLLVMPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
index 0e37717eb5f0e..1238cfe4bc874 100644
--- a/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.cpp
@@ -7,31 +7,22 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRVPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/LinalgToSPIRV/LinalgToSPIRV.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTLINALGTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
namespace {
/// A pass converting MLIR Linalg ops into SPIR-V ops.
-class ConvertLinalgToSPIRVPass
- : public impl::ConvertLinalgToSPIRVPassBase<ConvertLinalgToSPIRVPass> {
- using ConvertLinalgToSPIRVPassBase::ConvertLinalgToSPIRVPassBase;
-
+class LinalgToSPIRVPass : public ConvertLinalgToSPIRVBase<LinalgToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
-void ConvertLinalgToSPIRVPass::runOnOperation() {
+void LinalgToSPIRVPass::runOnOperation() {
MLIRContext *context = &getContext();
ModuleOp module = getOperation();
@@ -55,7 +46,6 @@ void ConvertLinalgToSPIRVPass::runOnOperation() {
return signalPassFailure();
}
-std::unique_ptr<OperationPass<ModuleOp>>
-mlir::createConvertLinalgToSPIRVPass() {
- return std::make_unique<ConvertLinalgToSPIRVPass>();
+std::unique_ptr<OperationPass<ModuleOp>> mlir::createLinalgToSPIRVPass() {
+ return std::make_unique<LinalgToSPIRVPass>();
}
diff --git a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
index 313f86e6a4f1c..2779d247ddf14 100644
--- a/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
+++ b/mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
@@ -8,6 +8,7 @@
#include "mlir/Conversion/LinalgToStandard/LinalgToStandard.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
@@ -15,12 +16,6 @@
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTLINALGTOSTANDARDPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
using namespace mlir::linalg;
@@ -126,10 +121,7 @@ void mlir::linalg::populateLinalgToStandardConversionPatterns(
namespace {
struct ConvertLinalgToStandardPass
- : public impl::ConvertLinalgToStandardPassBase<
- ConvertLinalgToStandardPass> {
- using ConvertLinalgToStandardPassBase::ConvertLinalgToStandardPassBase;
-
+ : public ConvertLinalgToStandardBase<ConvertLinalgToStandardPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp b/mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
index be0048b9f17d8..25ee8cec62d85 100644
--- a/mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
+++ b/mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/MathToFuncs/MathToFuncs.h"
-
+#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
@@ -18,16 +18,10 @@
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTMATHTOFUNCSPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -324,8 +318,8 @@ IPowIOpLowering::matchAndRewrite(math::IPowIOp op,
namespace {
struct ConvertMathToFuncsPass
- : public impl::ConvertMathToFuncsPassBase<ConvertMathToFuncsPass> {
- using ConvertMathToFuncsPassBase::ConvertMathToFuncsPassBase;
+ : public ConvertMathToFuncsBase<ConvertMathToFuncsPass> {
+ ConvertMathToFuncsPass() = default;
void runOnOperation() override;
@@ -383,3 +377,7 @@ void ConvertMathToFuncsPass::runOnOperation() {
if (failed(applyPartialConversion(module, target, std::move(patterns))))
signalPassFailure();
}
+
+std::unique_ptr<Pass> mlir::createConvertMathToFuncsPass() {
+ return std::make_unique<ConvertMathToFuncsPass>();
+}
diff --git a/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp b/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
index f53d43674b6ac..8161cc5e419ff 100644
--- a/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
+++ b/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp
@@ -7,19 +7,13 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/MathToLLVM/MathToLLVM.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Conversion/LLVMCommon/VectorPattern.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTMATHTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -256,8 +250,8 @@ struct RsqrtOpLowering : public ConvertOpToLLVMPattern<math::RsqrtOp> {
};
struct ConvertMathToLLVMPass
- : public impl::ConvertMathToLLVMPassBase<ConvertMathToLLVMPass> {
- using ConvertMathToLLVMPassBase::ConvertMathToLLVMPassBase;
+ : public ConvertMathToLLVMBase<ConvertMathToLLVMPass> {
+ ConvertMathToLLVMPass() = default;
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
@@ -301,3 +295,7 @@ void mlir::populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter,
>(converter);
// clang-format on
}
+
+std::unique_ptr<Pass> mlir::createConvertMathToLLVMPass() {
+ return std::make_unique<ConvertMathToLLVMPass>();
+}
diff --git a/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp b/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
index 553b88d4456b3..6dcf4532dd824 100644
--- a/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
+++ b/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
@@ -8,6 +8,7 @@
#include "mlir/Conversion/MathToLibm/MathToLibm.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
@@ -17,12 +18,6 @@
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/BuiltinDialect.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTMATHTOLIBMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -198,9 +193,7 @@ void mlir::populateMathToLibmConversionPatterns(
namespace {
struct ConvertMathToLibmPass
- : public impl::ConvertMathToLibmPassBase<ConvertMathToLibmPass> {
- using ConvertMathToLibmPassBase::ConvertMathToLibmPassBase;
-
+ : public ConvertMathToLibmBase<ConvertMathToLibmPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp b/mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp
index d86abdabf6831..6ef71d9f27a19 100644
--- a/mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/MathToSPIRV/MathToSPIRVPass.cpp
@@ -11,25 +11,17 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/MathToSPIRV/MathToSPIRVPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/MathToSPIRV/MathToSPIRV.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTMATHTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
namespace {
/// A pass converting MLIR Math operations into the SPIR-V dialect.
class ConvertMathToSPIRVPass
- : public impl::ConvertMathToSPIRVPassBase<ConvertMathToSPIRVPass> {
- using ConvertMathToSPIRVPassBase::ConvertMathToSPIRVPassBase;
-
+ : public ConvertMathToSPIRVBase<ConvertMathToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
index bacea717cd6e3..8b3348f039b28 100644
--- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
+++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
-
+#include "../PassDetail.h"
#include "mlir/Analysis/DataLayoutAnalysis.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
@@ -20,14 +20,8 @@
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BlockAndValueMapping.h"
-#include "mlir/Pass/Pass.h"
#include "llvm/ADT/SmallBitVector.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTMEMREFTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -2048,9 +2042,8 @@ void mlir::populateMemRefToLLVMConversionPatterns(LLVMTypeConverter &converter,
}
namespace {
-struct ConvertMemRefToLLVMPass
- : public impl::ConvertMemRefToLLVMPassBase<ConvertMemRefToLLVMPass> {
- using ConvertMemRefToLLVMPassBase::ConvertMemRefToLLVMPassBase;
+struct MemRefToLLVMPass : public ConvertMemRefToLLVMBase<MemRefToLLVMPass> {
+ MemRefToLLVMPass() = default;
void runOnOperation() override {
Operation *op = getOperation();
@@ -2077,3 +2070,7 @@ struct ConvertMemRefToLLVMPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createMemRefToLLVMPass() {
+ return std::make_unique<MemRefToLLVMPass>();
+}
diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
index b55e69f076465..e63f0594cf230 100644
--- a/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
+++ b/mlir/lib/Conversion/MemRefToSPIRV/MapMemRefStorageClassPass.cpp
@@ -11,9 +11,9 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
+#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
@@ -23,11 +23,6 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_MAPMEMREFSTORAGECLASSPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "mlir-map-memref-storage-class"
using namespace mlir;
@@ -289,7 +284,7 @@ void spirv::populateMemorySpaceToStorageClassPatterns(
namespace {
class MapMemRefStorageClassPass final
- : public impl::MapMemRefStorageClassPassBase<MapMemRefStorageClassPass> {
+ : public MapMemRefStorageClassBase<MapMemRefStorageClassPass> {
public:
explicit MapMemRefStorageClassPass() {
memorySpaceMap = spirv::mapMemorySpaceToVulkanStorageClass;
diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp
index a97f4c3193dd3..44fc17bde62fb 100644
--- a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.cpp
@@ -11,24 +11,17 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRVPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTMEMREFTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// A pass converting MLIR MemRef operations into the SPIR-V dialect.
class ConvertMemRefToSPIRVPass
- : public impl::ConvertMemRefToSPIRVPassBase<ConvertMemRefToSPIRVPass> {
- using ConvertMemRefToSPIRVPassBase::ConvertMemRefToSPIRVPassBase;
-
+ : public ConvertMemRefToSPIRVBase<ConvertMemRefToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp b/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
index 955a7dcced7b6..ff515bc69d676 100644
--- a/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
+++ b/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
@@ -7,18 +7,12 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/Dialect/NVGPU/IR/NVGPUDialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTNVGPUTONVVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -333,8 +327,8 @@ struct MmaSyncOptoNVVM : public ConvertOpToLLVMPattern<nvgpu::MmaSyncOp> {
};
struct ConvertNVGPUToNVVMPass
- : public impl::ConvertNVGPUToNVVMPassBase<ConvertNVGPUToNVVMPass> {
- using ConvertNVGPUToNVVMPassBase::ConvertNVGPUToNVVMPassBase;
+ : public ConvertNVGPUToNVVMBase<ConvertNVGPUToNVVMPass> {
+ ConvertNVGPUToNVVMPass() = default;
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
@@ -444,3 +438,7 @@ void mlir::populateNVGPUToNVVMConversionPatterns(LLVMTypeConverter &converter,
NVGPUAsyncCreateGroupLowering, NVGPUAsyncWaitLowering>(
converter);
}
+
+std::unique_ptr<Pass> mlir::createConvertNVGPUToNVVMPass() {
+ return std::make_unique<ConvertNVGPUToNVVMPass>();
+}
diff --git a/mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp b/mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
index eab0abc14255c..43a49a59fca31 100644
--- a/mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
+++ b/mlir/lib/Conversion/OpenACCToLLVM/OpenACCToLLVM.cpp
@@ -6,18 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/LLVMCommon/Pattern.h"
+#include "mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/IR/Builders.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTOPENACCTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -154,9 +148,7 @@ void mlir::populateOpenACCToLLVMConversionPatterns(
namespace {
struct ConvertOpenACCToLLVMPass
- : public impl::ConvertOpenACCToLLVMPassBase<ConvertOpenACCToLLVMPass> {
- using ConvertOpenACCToLLVMPassBase::ConvertOpenACCToLLVMPassBase;
-
+ : public ConvertOpenACCToLLVMBase<ConvertOpenACCToLLVMPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp b/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
index 34a4fdf7ba8c9..ddc4517383cb9 100644
--- a/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
+++ b/mlir/lib/Conversion/OpenACCToSCF/OpenACCToSCF.cpp
@@ -6,19 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/OpenACCToSCF/ConvertOpenACCToSCF.h"
-
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTOPENACCTOSCFPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
//===----------------------------------------------------------------------===//
@@ -62,9 +56,7 @@ void mlir::populateOpenACCToSCFConversionPatterns(RewritePatternSet &patterns) {
namespace {
struct ConvertOpenACCToSCFPass
- : public impl::ConvertOpenACCToSCFPassBase<ConvertOpenACCToSCFPass> {
- using ConvertOpenACCToSCFPassBase::ConvertOpenACCToSCFPassBase;
-
+ : public ConvertOpenACCToSCFBase<ConvertOpenACCToSCFPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp b/mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp
index 5ae5093dea0d4..4552465115332 100644
--- a/mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp
+++ b/mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp
@@ -8,6 +8,7 @@
#include "mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
#include "mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
@@ -17,12 +18,6 @@
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTOPENMPTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -137,9 +132,7 @@ void mlir::populateOpenMPToLLVMConversionPatterns(LLVMTypeConverter &converter,
namespace {
struct ConvertOpenMPToLLVMPass
- : public impl::ConvertOpenMPToLLVMPassBase<ConvertOpenMPToLLVMPass> {
- using ConvertOpenMPToLLVMPassBase::ConvertOpenMPToLLVMPassBase;
-
+ : public ConvertOpenMPToLLVMBase<ConvertOpenMPToLLVMPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
index bdff7750382aa..c24620a6729b9 100644
--- a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
+++ b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h"
-
+#include "../PassDetail.h"
#include "PredicateTree.h"
#include "mlir/Dialect/PDL/IR/PDL.h"
#include "mlir/Dialect/PDL/IR/PDLTypes.h"
@@ -20,11 +20,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTPDLTOPDLINTERPPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::pdl_to_pdl_interp;
@@ -913,17 +908,15 @@ void PatternLowering::generateOperationResultTypeRewriter(
//===----------------------------------------------------------------------===//
namespace {
-struct ConvertPDLToPDLInterpPass
- : public impl::ConvertPDLToPDLInterpPassBase<ConvertPDLToPDLInterpPass> {
- using ConvertPDLToPDLInterpPassBase::ConvertPDLToPDLInterpPassBase;
-
+struct PDLToPDLInterpPass
+ : public ConvertPDLToPDLInterpBase<PDLToPDLInterpPass> {
void runOnOperation() final;
};
} // namespace
/// Convert the given module containing PDL pattern operations into a PDL
/// Interpreter operations.
-void ConvertPDLToPDLInterpPass::runOnOperation() {
+void PDLToPDLInterpPass::runOnOperation() {
ModuleOp module = getOperation();
// Create the main matcher function This function contains all of the match
@@ -951,5 +944,5 @@ void ConvertPDLToPDLInterpPass::runOnOperation() {
}
std::unique_ptr<OperationPass<ModuleOp>> mlir::createPDLToPDLInterpPass() {
- return std::make_unique<ConvertPDLToPDLInterpPass>();
+ return std::make_unique<PDLToPDLInterpPass>();
}
diff --git a/mlir/lib/Conversion/PassDetail.h b/mlir/lib/Conversion/PassDetail.h
new file mode 100644
index 0000000000000..530e156024fdc
--- /dev/null
+++ b/mlir/lib/Conversion/PassDetail.h
@@ -0,0 +1,115 @@
+//===- PassDetail.h - Conversion Pass class details -------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CONVERSION_PASSDETAIL_H_
+#define CONVERSION_PASSDETAIL_H_
+
+#include "mlir/Pass/Pass.h"
+
+#include "mlir/Conversion/GPUToROCDL/Runtimes.h"
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/IR/FunctionInterfaces.h"
+
+namespace mlir {
+class AffineDialect;
+
+// Forward declaration from Dialect.h
+template <typename ConcreteDialect>
+void registerDialect(DialectRegistry ®istry);
+
+namespace acc {
+class OpenACCDialect;
+} // namespace acc
+
+namespace arith {
+class ArithmeticDialect;
+} // namespace arith
+
+namespace cf {
+class ControlFlowDialect;
+} // namespace cf
+
+namespace complex {
+class ComplexDialect;
+} // namespace complex
+
+namespace gpu {
+class GPUDialect;
+class GPUModuleOp;
+} // namespace gpu
+
+namespace func {
+class FuncDialect;
+} // namespace func
+
+namespace linalg {
+class LinalgDialect;
+} // namespace linalg
+
+namespace LLVM {
+class LLVMDialect;
+} // namespace LLVM
+
+namespace nvgpu {
+class NVGPUDialect;
+}
+
+namespace NVVM {
+class NVVMDialect;
+} // namespace NVVM
+
+namespace math {
+class MathDialect;
+} // namespace math
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+namespace omp {
+class OpenMPDialect;
+} // namespace omp
+
+namespace pdl_interp {
+class PDLInterpDialect;
+} // namespace pdl_interp
+
+namespace ROCDL {
+class ROCDLDialect;
+} // namespace ROCDL
+
+namespace scf {
+class SCFDialect;
+} // namespace scf
+
+namespace spirv {
+class SPIRVDialect;
+} // namespace spirv
+
+namespace tensor {
+class TensorDialect;
+} // namespace tensor
+
+namespace tosa {
+class TosaDialect;
+} // namespace tosa
+
+namespace vector {
+class VectorDialect;
+} // namespace vector
+
+namespace arm_neon {
+class ArmNeonDialect;
+} // namespace arm_neon
+
+#define GEN_PASS_CLASSES
+#include "mlir/Conversion/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // CONVERSION_PASSDETAIL_H_
diff --git a/mlir/lib/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.cpp b/mlir/lib/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.cpp
index cc468ce8cbf88..773e9b267c4f0 100644
--- a/mlir/lib/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.cpp
+++ b/mlir/lib/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.cpp
@@ -7,17 +7,12 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h"
-
+#include "../PassDetail.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_RECONCILEUNREALIZEDCASTSPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -107,10 +102,9 @@ struct UnrealizedConversionCastPassthrough
};
/// Pass to simplify and eliminate unrealized conversion casts.
-struct ReconcileUnrealizedCastsPass
- : public impl::ReconcileUnrealizedCastsPassBase<
- ReconcileUnrealizedCastsPass> {
- using ReconcileUnrealizedCastsPassBase::ReconcileUnrealizedCastsPassBase;
+struct ReconcileUnrealizedCasts
+ : public ReconcileUnrealizedCastsBase<ReconcileUnrealizedCasts> {
+ ReconcileUnrealizedCasts() = default;
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
@@ -129,3 +123,7 @@ void mlir::populateReconcileUnrealizedCastsPatterns(
RewritePatternSet &patterns) {
patterns.add<UnrealizedConversionCastPassthrough>(patterns.getContext());
}
+
+std::unique_ptr<Pass> mlir::createReconcileUnrealizedCastsPass() {
+ return std::make_unique<ReconcileUnrealizedCasts>();
+}
diff --git a/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp b/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
index 13035ec41bc40..8bdf68354daa6 100644
--- a/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
+++ b/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
-
+#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
@@ -24,21 +24,13 @@
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTSCFTOCONTROLFLOWPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::scf;
namespace {
-struct ConvertSCFToControlFlowPass
- : public impl::ConvertSCFToControlFlowPassBase<
- ConvertSCFToControlFlowPass> {
- using ConvertSCFToControlFlowPassBase::ConvertSCFToControlFlowPassBase;
-
+struct SCFToControlFlowPass
+ : public SCFToControlFlowBase<SCFToControlFlowPass> {
void runOnOperation() override;
};
@@ -625,7 +617,7 @@ void mlir::populateSCFToControlFlowConversionPatterns(
patterns.add<DoWhileLowering>(patterns.getContext(), /*benefit=*/2);
}
-void ConvertSCFToControlFlowPass::runOnOperation() {
+void SCFToControlFlowPass::runOnOperation() {
RewritePatternSet patterns(&getContext());
populateSCFToControlFlowConversionPatterns(patterns);
@@ -638,3 +630,7 @@ void ConvertSCFToControlFlowPass::runOnOperation() {
applyPartialConversion(getOperation(), target, std::move(patterns))))
signalPassFailure();
}
+
+std::unique_ptr<Pass> mlir::createConvertSCFToCFPass() {
+ return std::make_unique<SCFToControlFlowPass>();
+}
diff --git a/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp b/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp
index 350b77550df3b..42260b5987ebe 100644
--- a/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp
+++ b/mlir/lib/Conversion/SCFToGPU/SCFToGPUPass.cpp
@@ -7,24 +7,18 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/SCFToGPU/SCFToGPUPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/SCFToGPU/SCFToGPU.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
+
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/CommandLine.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTAFFINEFORTOGPUPASS
-#define GEN_PASS_DEF_CONVERTPARALLELLOOPTOGPUPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::scf;
@@ -32,8 +26,7 @@ namespace {
// A pass that traverses top-level loops in the function and converts them to
// GPU launch operations. Nested launches are not allowed, so this does not
// walk the function recursively to avoid considering nested loops.
-struct ForLoopMapper
- : public impl::ConvertAffineForToGPUPassBase<ForLoopMapper> {
+struct ForLoopMapper : public ConvertAffineForToGPUBase<ForLoopMapper> {
ForLoopMapper() = default;
ForLoopMapper(unsigned numBlockDims, unsigned numThreadDims) {
this->numBlockDims = numBlockDims;
@@ -53,9 +46,7 @@ struct ForLoopMapper
};
struct ParallelLoopToGpuPass
- : public impl::ConvertParallelLoopToGpuPassBase<ParallelLoopToGpuPass> {
- using ConvertParallelLoopToGpuPassBase::ConvertParallelLoopToGpuPassBase;
-
+ : public ConvertParallelLoopToGpuBase<ParallelLoopToGpuPass> {
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
populateParallelLoopToGPUPatterns(patterns);
@@ -79,3 +70,7 @@ std::unique_ptr<InterfacePass<FunctionOpInterface>>
mlir::createAffineForToGPUPass() {
return std::make_unique<ForLoopMapper>();
}
+
+std::unique_ptr<Pass> mlir::createParallelLoopToGpuPass() {
+ return std::make_unique<ParallelLoopToGpuPass>();
+}
diff --git a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
index 593149a2a41e2..e963f02de5284 100644
--- a/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
+++ b/mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/SCFToOpenMP/SCFToOpenMP.h"
-
+#include "../PassDetail.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
@@ -22,14 +22,8 @@
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/SymbolTable.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTSCFTOOPENMPPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
/// Matches a block containing a "simple" reduction. The expected shape of the
@@ -449,10 +443,7 @@ static LogicalResult applyPatterns(ModuleOp module) {
}
/// A pass converting SCF operations to OpenMP operations.
-struct ConvertSCFToOpenMPPass
- : public impl::ConvertSCFToOpenMPPassBase<ConvertSCFToOpenMPPass> {
- using ConvertSCFToOpenMPPassBase::ConvertSCFToOpenMPPassBase;
-
+struct SCFToOpenMPPass : public ConvertSCFToOpenMPBase<SCFToOpenMPPass> {
/// Pass entry point.
void runOnOperation() override {
if (failed(applyPatterns(getOperation())))
@@ -463,5 +454,5 @@ struct ConvertSCFToOpenMPPass
} // namespace
std::unique_ptr<OperationPass<ModuleOp>> mlir::createConvertSCFToOpenMPPass() {
- return std::make_unique<ConvertSCFToOpenMPPass>();
+ return std::make_unique<SCFToOpenMPPass>();
}
diff --git a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp
index c907cad1d4481..1b22fadc4a348 100644
--- a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRVPass.cpp
@@ -12,6 +12,7 @@
#include "mlir/Conversion/SCFToSPIRV/SCFToSPIRVPass.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
#include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
@@ -20,23 +21,15 @@
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTSCFTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
-struct ConvertSCFToSPIRVPass
- : public impl::ConvertSCFToSPIRVPassBase<ConvertSCFToSPIRVPass> {
- using ConvertSCFToSPIRVPassBase::ConvertSCFToSPIRVPassBase;
-
+struct SCFToSPIRVPass : public SCFToSPIRVBase<SCFToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
-void ConvertSCFToSPIRVPass::runOnOperation() {
+void SCFToSPIRVPass::runOnOperation() {
MLIRContext *context = &getContext();
Operation *op = getOperation();
@@ -61,5 +54,5 @@ void ConvertSCFToSPIRVPass::runOnOperation() {
}
std::unique_ptr<OperationPass<>> mlir::createConvertSCFToSPIRVPass() {
- return std::make_unique<ConvertSCFToSPIRVPass>();
+ return std::make_unique<SCFToSPIRVPass>();
}
diff --git a/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp b/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
index 74e38cfcc0bb4..f383f9a3995eb 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
@@ -11,8 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/ArithmeticToLLVM/ArithmeticToLLVM.h"
#include "mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h"
#include "mlir/Conversion/LLVMCommon/LoweringOptions.h"
@@ -20,23 +19,19 @@
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h"
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h"
+#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/SymbolTable.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
+
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/FormatVariadic.h"
-namespace mlir {
-#define GEN_PASS_DEF_LOWERHOSTCODETOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
static constexpr const char kSPIRVModule[] = "__spv__";
@@ -275,11 +270,9 @@ class GPULaunchLowering : public ConvertOpToLLVMPattern<gpu::LaunchFuncOp> {
}
};
-class LowerHostCodeToLLVMPass
- : public impl::LowerHostCodeToLLVMPassBase<LowerHostCodeToLLVMPass> {
+class LowerHostCodeToLLVM
+ : public LowerHostCodeToLLVMBase<LowerHostCodeToLLVM> {
public:
- using LowerHostCodeToLLVMPassBase::LowerHostCodeToLLVMPassBase;
-
void runOnOperation() override {
ModuleOp module = getOperation();
@@ -324,5 +317,5 @@ class LowerHostCodeToLLVMPass
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
mlir::createLowerHostCodeToLLVMPass() {
- return std::make_unique<LowerHostCodeToLLVMPass>();
+ return std::make_unique<LowerHostCodeToLLVM>();
}
diff --git a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp
index d2067cd52a64d..4c0f558157444 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.cpp
@@ -11,26 +11,18 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTSPIRVTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
namespace {
/// A pass converting MLIR SPIR-V operations into LLVM dialect.
class ConvertSPIRVToLLVMPass
- : public impl::ConvertSPIRVToLLVMPassBase<ConvertSPIRVToLLVMPass> {
- using ConvertSPIRVToLLVMPassBase::ConvertSPIRVToLLVMPassBase;
-
+ : public ConvertSPIRVToLLVMBase<ConvertSPIRVToLLVMPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp b/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp
index f92bf8994e369..b3422767e1afc 100644
--- a/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp
+++ b/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp
@@ -8,6 +8,7 @@
#include "mlir/Conversion/ShapeToStandard/ShapeToStandard.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
@@ -17,13 +18,7 @@
#include "mlir/Pass/PassRegistry.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTSHAPECONSTRAINTSPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
-
namespace {
#include "ShapeToStandard.cpp.inc"
} // namespace
@@ -53,11 +48,8 @@ namespace {
// eager (side-effecting) error handling code. After eager error handling code
// is emitted, witnesses are satisfied, so they are replace with
// `shape.const_witness true`.
-class ConvertShapeConstraintsPass
- : public impl::ConvertShapeConstraintsPassBase<
- ConvertShapeConstraintsPass> {
- using ConvertShapeConstraintsPassBase::ConvertShapeConstraintsPassBase;
-
+class ConvertShapeConstraints
+ : public ConvertShapeConstraintsBase<ConvertShapeConstraints> {
void runOnOperation() override {
auto *func = getOperation();
auto *context = &getContext();
@@ -70,3 +62,7 @@ class ConvertShapeConstraintsPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createConvertShapeConstraintsPass() {
+ return std::make_unique<ConvertShapeConstraints>();
+}
diff --git a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
index 4fdaee6698319..3a3a336f3ee6a 100644
--- a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
+++ b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
@@ -8,6 +8,7 @@
#include "mlir/Conversion/ShapeToStandard/ShapeToStandard.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
@@ -15,15 +16,9 @@
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/STLExtras.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTSHAPETOSTANDARDPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::shape;
using namespace mlir::scf;
@@ -685,8 +680,7 @@ namespace {
namespace {
/// Conversion pass.
class ConvertShapeToStandardPass
- : public impl::ConvertShapeToStandardPassBase<ConvertShapeToStandardPass> {
- using ConvertShapeToStandardPassBase::ConvertShapeToStandardPassBase;
+ : public ConvertShapeToStandardBase<ConvertShapeToStandardPass> {
void runOnOperation() override;
};
diff --git a/mlir/lib/Conversion/TensorToLinalg/TensorToLinalgPass.cpp b/mlir/lib/Conversion/TensorToLinalg/TensorToLinalgPass.cpp
index 281ace9f4a158..8be029e8c5c24 100644
--- a/mlir/lib/Conversion/TensorToLinalg/TensorToLinalgPass.cpp
+++ b/mlir/lib/Conversion/TensorToLinalg/TensorToLinalgPass.cpp
@@ -11,25 +11,18 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/TensorToLinalg/TensorToLinalgPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/TensorToLinalg/TensorToLinalg.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTTENSORTOLINALGPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// A pass converting MLIR Tensor operations into the Linalg dialect.
class ConvertTensorToLinalgPass
- : public impl::ConvertTensorToLinalgPassBase<ConvertTensorToLinalgPass> {
- using ConvertTensorToLinalgPassBase::ConvertTensorToLinalgPassBase;
-
+ : public ConvertTensorToLinalgBase<ConvertTensorToLinalgPass> {
void runOnOperation() override {
auto &context = getContext();
ConversionTarget target(context);
diff --git a/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp b/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp
index 6b4ef16a5f1c2..3a8ccc8a7b85a 100644
--- a/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRVPass.cpp
@@ -11,26 +11,19 @@
//===----------------------------------------------------------------------===//
#include "mlir/Conversion/TensorToSPIRV/TensorToSPIRVPass.h"
-
+#include "../PassDetail.h"
#include "mlir/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.h"
#include "mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h"
#include "mlir/Conversion/TensorToSPIRV/TensorToSPIRV.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTTENSORTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// A pass converting MLIR Tensor operations into the SPIR-V dialect.
class ConvertTensorToSPIRVPass
- : public impl::ConvertTensorToSPIRVPassBase<ConvertTensorToSPIRVPass> {
- using ConvertTensorToSPIRVPassBase::ConvertTensorToSPIRVPassBase;
-
+ : public ConvertTensorToSPIRVBase<ConvertTensorToSPIRVPass> {
void runOnOperation() override {
MLIRContext *context = &getContext();
Operation *op = getOperation();
diff --git a/mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp b/mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
index 8aa27359571e0..a4e4de6ef7a80 100644
--- a/mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
+++ b/mlir/lib/Conversion/TosaToArith/TosaToArithPass.cpp
@@ -10,30 +10,23 @@
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/TosaToArith/TosaToArith.h"
-
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTTOSATOARITHPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace tosa;
namespace {
-struct ConvertTosaToArithPass
- : public impl::ConvertTosaToArithPassBase<ConvertTosaToArithPass> {
+struct TosaToArith : public TosaToArithBase<TosaToArith> {
public:
- using ConvertTosaToArithPassBase::ConvertTosaToArithPassBase;
-
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
ConversionTarget target(getContext());
@@ -54,3 +47,7 @@ struct ConvertTosaToArithPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::tosa::createTosaToArith() {
+ return std::make_unique<TosaToArith>();
+}
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp
index 38c07f8775e9d..0743f5702ee72 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamedPass.cpp
@@ -10,15 +10,15 @@
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"
-
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
#include "mlir/IR/PatternMatch.h"
@@ -26,20 +26,11 @@
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTTOSATOLINALGNAMEDPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
-struct ConvertTosaToLinalgNamedPass
- : public impl::ConvertTosaToLinalgNamedPassBase<
- ConvertTosaToLinalgNamedPass> {
+struct TosaToLinalgNamed : public TosaToLinalgNamedBase<TosaToLinalgNamed> {
public:
- using ConvertTosaToLinalgNamedPassBase::ConvertTosaToLinalgNamedPassBase;
-
void getDependentDialects(DialectRegistry ®istry) const override {
registry
.insert<arith::ArithmeticDialect, linalg::LinalgDialect,
@@ -69,3 +60,7 @@ struct ConvertTosaToLinalgNamedPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::tosa::createTosaToLinalgNamed() {
+ return std::make_unique<TosaToLinalgNamed>();
+}
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
index 16de7551e69d6..f8f4a8f01b190 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
@@ -10,15 +10,15 @@
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"
-
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
#include "mlir/IR/PatternMatch.h"
@@ -27,19 +27,11 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/Passes.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTTOSATOLINALGPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
-struct ConvertTosaToLinalgPass
- : public impl::ConvertTosaToLinalgPassBase<ConvertTosaToLinalgPass> {
+struct TosaToLinalg : public TosaToLinalgBase<TosaToLinalg> {
public:
- using ConvertTosaToLinalgPassBase::ConvertTosaToLinalgPassBase;
-
void getDependentDialects(DialectRegistry ®istry) const override {
registry
.insert<arith::ArithmeticDialect, linalg::LinalgDialect,
@@ -70,19 +62,22 @@ struct ConvertTosaToLinalgPass
};
} // namespace
+std::unique_ptr<Pass> mlir::tosa::createTosaToLinalg() {
+ return std::make_unique<TosaToLinalg>();
+}
+
void mlir::tosa::addTosaToLinalgPasses(OpPassManager &pm,
bool disableTosaDecompositions) {
// Optional decompositions are designed to benefit linalg.
if (!disableTosaDecompositions)
- pm.addNestedPass<func::FuncOp>(
- tosa::createTosaOptionalDecompositionsPass());
+ pm.addNestedPass<func::FuncOp>(tosa::createTosaOptionalDecompositions());
pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
pm.addNestedPass<func::FuncOp>(tosa::createTosaMakeBroadcastablePass());
- pm.addNestedPass<func::FuncOp>(createConvertTosaToLinalgNamedPass());
+ pm.addNestedPass<func::FuncOp>(tosa::createTosaToLinalgNamed());
pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
// TODO: Remove pass that operates on const tensor and enable optionality
pm.addNestedPass<func::FuncOp>(tosa::createTosaLayerwiseConstantFoldPass());
pm.addNestedPass<func::FuncOp>(tosa::createTosaMakeBroadcastablePass());
- pm.addNestedPass<func::FuncOp>(createConvertTosaToLinalgPass());
+ pm.addNestedPass<func::FuncOp>(tosa::createTosaToLinalg());
}
diff --git a/mlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp b/mlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp
index 00de6f04edfbd..c86216a0c43a0 100644
--- a/mlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp
+++ b/mlir/lib/Conversion/TosaToSCF/TosaToSCFPass.cpp
@@ -10,28 +10,23 @@
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/TosaToSCF/TosaToSCF.h"
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTTOSATOSCFPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace tosa;
namespace {
-struct TosaToSCF : public impl::ConvertTosaToSCFPassBase<TosaToSCF> {
+struct TosaToSCF : public TosaToSCFBase<TosaToSCF> {
public:
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
@@ -48,6 +43,10 @@ struct TosaToSCF : public impl::ConvertTosaToSCFPassBase<TosaToSCF> {
};
} // namespace
+std::unique_ptr<Pass> mlir::tosa::createTosaToSCF() {
+ return std::make_unique<TosaToSCF>();
+}
+
void mlir::tosa::addTosaToSCFPasses(OpPassManager &pm) {
- pm.addNestedPass<func::FuncOp>(createConvertTosaToSCFPass());
+ pm.addNestedPass<func::FuncOp>(createTosaToSCF());
}
diff --git a/mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp b/mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp
index 6b903235e0932..08d5c7d50640b 100644
--- a/mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp
+++ b/mlir/lib/Conversion/TosaToTensor/TosaToTensorPass.cpp
@@ -10,31 +10,24 @@
//
//===----------------------------------------------------------------------===//
+#include "../PassDetail.h"
#include "mlir/Conversion/TosaToTensor/TosaToTensor.h"
-
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTTOSATOTENSORPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace tosa;
namespace {
-struct ConvertTosaToTensorPass
- : public impl::ConvertTosaToTensorPassBase<ConvertTosaToTensorPass> {
+struct TosaToTensor : public TosaToTensorBase<TosaToTensor> {
public:
- using ConvertTosaToTensorPassBase::ConvertTosaToTensorPassBase;
-
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
ConversionTarget target(getContext());
@@ -50,3 +43,7 @@ struct ConvertTosaToTensorPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::tosa::createTosaToTensor() {
+ return std::make_unique<TosaToTensor>();
+}
diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
index c07bd4b043ca3..26758825bb01a 100644
--- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
+++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
@@ -15,6 +15,7 @@
#include "NvGpuSupport.h"
#include "mlir/Conversion/VectorToGPU/VectorToGPU.h"
+#include "../PassDetail.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
@@ -30,11 +31,6 @@
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTVECTORTOGPUPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
/// For a vector TransferOpType `xferOp`, an empty `indices` vector, and an
@@ -886,7 +882,7 @@ LogicalResult mlir::convertVectorToNVVMCompatibleMMASync(Operation *rootOp) {
namespace {
struct ConvertVectorToGPUPass
- : public impl::ConvertVectorToGPUPassBase<ConvertVectorToGPUPass> {
+ : public ConvertVectorToGPUBase<ConvertVectorToGPUPass> {
explicit ConvertVectorToGPUPass(bool useNvGpu_) {
useNvGpu.setValue(useNvGpu_);
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
index cc5937c4e2bfa..3493e2c751654 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp
@@ -8,6 +8,8 @@
#include "mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h"
+#include "../PassDetail.h"
+
#include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Dialect/AMX/AMXDialect.h"
@@ -22,21 +24,15 @@
#include "mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h"
#include "mlir/Dialect/X86Vector/Transforms.h"
#include "mlir/Dialect/X86Vector/X86VectorDialect.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTVECTORTOLLVMPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::vector;
namespace {
-struct ConvertVectorToLLVMPass
- : public impl::ConvertVectorToLLVMPassBase<ConvertVectorToLLVMPass> {
- ConvertVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
+struct LowerVectorToLLVMPass
+ : public ConvertVectorToLLVMBase<LowerVectorToLLVMPass> {
+ LowerVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
this->reassociateFPReductions = options.reassociateFPReductions;
this->force32BitVectorIndices = options.force32BitVectorIndices;
this->armNeon = options.armNeon;
@@ -62,7 +58,7 @@ struct ConvertVectorToLLVMPass
};
} // namespace
-void ConvertVectorToLLVMPass::runOnOperation() {
+void LowerVectorToLLVMPass::runOnOperation() {
// Perform progressive lowering of operations on slices and
// all contraction operations. Also applies folding and DCE.
{
@@ -119,5 +115,5 @@ void ConvertVectorToLLVMPass::runOnOperation() {
std::unique_ptr<OperationPass<ModuleOp>>
mlir::createConvertVectorToLLVMPass(const LowerVectorToLLVMOptions &options) {
- return std::make_unique<ConvertVectorToLLVMPass>(options);
+ return std::make_unique<LowerVectorToLLVMPass>(options);
}
diff --git a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
index e50dd26588479..6bcceb6ed08a5 100644
--- a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
+++ b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
@@ -14,6 +14,7 @@
#include "mlir/Conversion/VectorToSCF/VectorToSCF.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
@@ -25,11 +26,6 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/Passes.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTVECTORTOSCFPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using vector::TransferReadOp;
using vector::TransferWriteOp;
@@ -1285,7 +1281,7 @@ void mlir::populateVectorToSCFConversionPatterns(
namespace {
struct ConvertVectorToSCFPass
- : public impl::ConvertVectorToSCFPassBase<ConvertVectorToSCFPass> {
+ : public ConvertVectorToSCFBase<ConvertVectorToSCFPass> {
ConvertVectorToSCFPass() = default;
ConvertVectorToSCFPass(const VectorTransferToSCFOptions &options) {
this->fullUnroll = options.unroll;
diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
index 483619ba708d9..04bc41ebb0aa0 100644
--- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
+++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
@@ -12,6 +12,7 @@
#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h"
+#include "../PassDetail.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp
index 830b79b3c62f3..d3585cad4897a 100644
--- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRVPass.cpp
@@ -12,24 +12,18 @@
#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRVPass.h"
+#include "../PassDetail.h"
#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTVECTORTOSPIRVPASS
-#include "mlir/Conversion/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
struct ConvertVectorToSPIRVPass
- : public impl::ConvertVectorToSPIRVPassBase<ConvertVectorToSPIRVPass> {
- using ConvertVectorToSPIRVPassBase::ConvertVectorToSPIRVPassBase;
-
+ : public ConvertVectorToSPIRVBase<ConvertVectorToSPIRVPass> {
void runOnOperation() override;
};
} // namespace
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
index b0e2584d9b415..303498b8e2aa3 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp
@@ -19,13 +19,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
+#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/MapVector.h"
@@ -33,11 +32,6 @@
#include "llvm/Support/Debug.h"
#include <algorithm>
-namespace mlir {
-#define GEN_PASS_DEF_AFFINEDATACOPYGENERATIONPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "affine-data-copy-generate"
using namespace mlir;
@@ -55,15 +49,14 @@ namespace {
/// provided.
// TODO: We currently can't generate copies correctly when stores
// are strided. Check for strided stores.
-struct AffineDataCopyGenerationPass
- : public impl::AffineDataCopyGenerationPassBase<
- AffineDataCopyGenerationPass> {
- AffineDataCopyGenerationPass() = default;
- explicit AffineDataCopyGenerationPass(unsigned slowMemorySpace,
- unsigned fastMemorySpace,
- unsigned tagMemorySpace,
- int minDmaTransferSize,
- uint64_t fastMemCapacityBytes) {
+struct AffineDataCopyGeneration
+ : public AffineDataCopyGenerationBase<AffineDataCopyGeneration> {
+ AffineDataCopyGeneration() = default;
+ explicit AffineDataCopyGeneration(unsigned slowMemorySpace,
+ unsigned fastMemorySpace,
+ unsigned tagMemorySpace,
+ int minDmaTransferSize,
+ uint64_t fastMemCapacityBytes) {
this->slowMemorySpace = slowMemorySpace;
this->fastMemorySpace = fastMemorySpace;
this->tagMemorySpace = tagMemorySpace;
@@ -90,21 +83,21 @@ mlir::createAffineDataCopyGenerationPass(unsigned slowMemorySpace,
unsigned tagMemorySpace,
int minDmaTransferSize,
uint64_t fastMemCapacityBytes) {
- return std::make_unique<AffineDataCopyGenerationPass>(
+ return std::make_unique<AffineDataCopyGeneration>(
slowMemorySpace, fastMemorySpace, tagMemorySpace, minDmaTransferSize,
fastMemCapacityBytes);
}
std::unique_ptr<OperationPass<func::FuncOp>>
mlir::createAffineDataCopyGenerationPass() {
- return std::make_unique<AffineDataCopyGenerationPass>();
+ return std::make_unique<AffineDataCopyGeneration>();
}
/// Generate copies for this block. The block is partitioned into separate
/// ranges: each range is either a sequence of one or more operations starting
/// and ending with an affine load or store op, or just an affine.forop (which
/// could have other affine for op's nested within).
-void AffineDataCopyGenerationPass::runOnBlock(
- Block *block, DenseSet<Operation *> ©Nests) {
+void AffineDataCopyGeneration::runOnBlock(Block *block,
+ DenseSet<Operation *> ©Nests) {
if (block->empty())
return;
@@ -205,7 +198,7 @@ void AffineDataCopyGenerationPass::runOnBlock(
}
}
-void AffineDataCopyGenerationPass::runOnOperation() {
+void AffineDataCopyGeneration::runOnOperation() {
func::FuncOp f = getOperation();
OpBuilder topBuilder(f.getBody());
zeroIndex = topBuilder.create<arith::ConstantIndexOp>(f.getLoc(), 0);
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp
index c48abc4e79d91..c162aa2f2d058 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp
@@ -10,17 +10,13 @@
// fundamental operations.
//===----------------------------------------------------------------------===//
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h"
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_AFFINEEXPANDINDEXOPSPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -42,7 +38,7 @@ struct LowerDelinearizeIndexOps
};
class ExpandAffineIndexOpsPass
- : public impl::AffineExpandIndexOpsPassBase<ExpandAffineIndexOpsPass> {
+ : public AffineExpandIndexOpsBase<ExpandAffineIndexOpsPass> {
public:
ExpandAffineIndexOpsPass() = default;
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
index 0d67f357f0232..280e928d56de8 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
@@ -10,8 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
@@ -19,9 +18,9 @@
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
+#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
@@ -33,11 +32,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
-namespace mlir {
-#define GEN_PASS_DEF_AFFINELOOPINVARIANTCODEMOTIONPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "licm"
using namespace mlir;
@@ -50,8 +44,7 @@ namespace {
/// TODO: This code should be removed once the new LICM pass can handle its
/// uses.
struct LoopInvariantCodeMotion
- : public impl::AffineLoopInvariantCodeMotionPassBase<
- LoopInvariantCodeMotion> {
+ : public AffineLoopInvariantCodeMotionBase<LoopInvariantCodeMotion> {
void runOnOperation() override;
void runOnAffineForOp(AffineForOp forOp);
};
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
index e664dd75791c5..28b6b9976bd6b 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
@@ -10,16 +10,10 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Affine/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_AFFINELOOPNORMALIZEPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
@@ -29,7 +23,7 @@ namespace {
/// As currently implemented, this pass cannot fail, but it might skip over ops
/// that are already in a normalized form.
struct AffineLoopNormalizePass
- : public impl::AffineLoopNormalizePassBase<AffineLoopNormalizePass> {
+ : public AffineLoopNormalizeBase<AffineLoopNormalizePass> {
void runOnOperation() override {
getOperation().walk([](Operation *op) {
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
index 9955f4cca4eb5..dbd55411c0bf8 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineParallelize.cpp
@@ -11,8 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
@@ -20,25 +19,19 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
+#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Affine/Passes.h.inc"
#include "mlir/Dialect/Affine/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "llvm/Support/Debug.h"
#include <deque>
-namespace mlir {
-#define GEN_PASS_DEF_AFFINEPARALLELIZEPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "affine-parallel"
using namespace mlir;
namespace {
/// Convert all parallel affine.for op into 1-D affine.parallel op.
-struct AffineParallelize
- : public impl::AffineParallelizePassBase<AffineParallelize> {
+struct AffineParallelize : public AffineParallelizeBase<AffineParallelize> {
void runOnOperation() override;
};
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp
index 965c6509411d7..efc1676378df2 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp
@@ -16,24 +16,19 @@
#include "mlir/Dialect/Affine/Passes.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Dominance.h"
#include "mlir/Support/LogicalResult.h"
#include <algorithm>
-namespace mlir {
-#define GEN_PASS_DEF_AFFINESCALARREPLACEMENTPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "affine-scalrep"
using namespace mlir;
namespace {
struct AffineScalarReplacement
- : public impl::AffineScalarReplacementPassBase<AffineScalarReplacement> {
+ : public AffineScalarReplacementBase<AffineScalarReplacement> {
void runOnOperation() override;
};
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopCoalescing.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopCoalescing.cpp
index 4ae38c2e87f63..765bc05a13a9f 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopCoalescing.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopCoalescing.cpp
@@ -6,31 +6,23 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/RegionUtils.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_LOOPCOALESCINGPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
#define PASS_NAME "loop-coalescing"
#define DEBUG_TYPE PASS_NAME
using namespace mlir;
namespace {
-struct LoopCoalescingPass
- : public impl::LoopCoalescingPassBase<LoopCoalescingPass> {
+struct LoopCoalescingPass : public LoopCoalescingBase<LoopCoalescingPass> {
/// Walk either an scf.for or an affine.for to find a band to coalesce.
template <typename LoopOpTy>
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
index b0fbdb386ac4c..81b4e4d65fc45 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
@@ -10,8 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
@@ -20,7 +19,6 @@
#include "mlir/Dialect/Affine/LoopFusionUtils.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Dialect/Affine/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
@@ -35,12 +33,6 @@
#include "llvm/Support/raw_ostream.h"
#include <iomanip>
#include <sstream>
-
-namespace mlir {
-#define GEN_PASS_DEF_AFFINELOOPFUSIONPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "affine-loop-fusion"
using namespace mlir;
@@ -55,7 +47,7 @@ namespace {
// TODO: Extend this pass to check for fusion preventing dependences,
// and add support for more general loop fusion algorithms.
-struct LoopFusion : public impl::AffineLoopFusionPassBase<LoopFusion> {
+struct LoopFusion : public AffineLoopFusionBase<LoopFusion> {
LoopFusion() = default;
LoopFusion(unsigned fastMemorySpace, uint64_t localBufSizeThresholdBytes,
bool maximalFusion, enum FusionMode affineFusionMode) {
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
index 632ab6477b972..3cdae8ab02659 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
@@ -10,8 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
@@ -19,26 +18,20 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
+#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Affine/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_AFFINELOOPTILINGPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
+using namespace mlir;
#define DEBUG_TYPE "affine-loop-tile"
-using namespace mlir;
-
namespace {
/// A pass to perform loop tiling on all suitable loop nests of a Function.
-struct LoopTiling : public impl::AffineLoopTilingPassBase<LoopTiling> {
+struct LoopTiling : public AffineLoopTilingBase<LoopTiling> {
LoopTiling() = default;
explicit LoopTiling(uint64_t cacheSizeBytes, bool avoidMaxMinBounds = true)
: avoidMaxMinBounds(avoidMaxMinBounds) {
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
index cd5e53c184e32..8f7cae507a97d 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopUnroll.cpp
@@ -9,13 +9,11 @@
// This file implements loop unrolling.
//
//===----------------------------------------------------------------------===//
-
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
@@ -23,15 +21,10 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_AFFINELOOPUNROLLPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
+using namespace mlir;
#define DEBUG_TYPE "affine-loop-unroll"
-using namespace mlir;
-
namespace {
// TODO: this is really a test pass and should be moved out of dialect
@@ -41,7 +34,7 @@ namespace {
/// full unroll threshold was specified, in which case, fully unrolls all loops
/// with trip count less than the specified threshold. The latter is for testing
/// purposes, especially for testing outer loop unrolling.
-struct LoopUnroll : public impl::AffineLoopUnrollPassBase<LoopUnroll> {
+struct LoopUnroll : public AffineLoopUnrollBase<LoopUnroll> {
// Callback to obtain unroll factors; if this has a callable target, takes
// precedence over command-line argument or passed argument.
const std::function<unsigned(AffineForOp)> getUnrollFactor;
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
index 85b24cc22872a..42f6487e8eeba 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopUnrollAndJam.cpp
@@ -33,13 +33,12 @@
// op's, bodies of those loops will not be jammed.
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BlockAndValueMapping.h"
@@ -47,20 +46,14 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/CommandLine.h"
-namespace mlir {
-#define GEN_PASS_DEF_AFFINELOOPUNROLLANDJAMPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
+using namespace mlir;
#define DEBUG_TYPE "affine-loop-unroll-jam"
-using namespace mlir;
-
namespace {
/// Loop unroll jam pass. Currently, this just unroll jams the first
/// outer loop in a Function.
-struct LoopUnrollAndJam
- : public impl::AffineLoopUnrollAndJamPassBase<LoopUnrollAndJam> {
+struct LoopUnrollAndJam : public AffineLoopUnrollAndJamBase<LoopUnrollAndJam> {
explicit LoopUnrollAndJam(Optional<unsigned> unrollJamFactor = None) {
if (unrollJamFactor)
this->unrollJamFactor = *unrollJamFactor;
diff --git a/mlir/lib/Dialect/Affine/Transforms/PassDetail.h b/mlir/lib/Dialect/Affine/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..37dccb132f447
--- /dev/null
+++ b/mlir/lib/Dialect/Affine/Transforms/PassDetail.h
@@ -0,0 +1,42 @@
+//===- PassDetail.h - Affine Pass class details -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_AFFINE_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_AFFINE_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/Affine/Passes.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+// Forward declaration from Dialect.h
+template <typename ConcreteDialect>
+void registerDialect(DialectRegistry ®istry);
+
+namespace arith {
+class ArithmeticDialect;
+} // namespace arith
+
+namespace linalg {
+class LinalgDialect;
+} // namespace linalg
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+namespace vector {
+class VectorDialect;
+} // namespace vector
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Affine/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_AFFINE_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
index 93e497d5dd2df..ec30c296cb8b2 100644
--- a/mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
@@ -10,8 +10,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
@@ -19,25 +18,19 @@
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Builders.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_AFFINEPIPELINEDATATRANSFERPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "affine-pipeline-data-transfer"
using namespace mlir;
namespace {
struct PipelineDataTransfer
- : public impl::AffinePipelineDataTransferPassBase<PipelineDataTransfer> {
+ : public AffinePipelineDataTransferBase<PipelineDataTransfer> {
void runOnOperation() override;
void runOnAffineForOp(AffineForOp forOp);
diff --git a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
index c60e7b25007e9..cd05d66ea823d 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp
@@ -10,20 +10,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/Affine/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_SIMPLIFYAFFINESTRUCTURESPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "simplify-affine-structure"
using namespace mlir;
@@ -35,7 +29,7 @@ namespace {
/// all memrefs with non-trivial layout maps are converted to ones with trivial
/// identity layout ones.
struct SimplifyAffineStructures
- : public impl::SimplifyAffineStructuresPassBase<SimplifyAffineStructures> {
+ : public SimplifyAffineStructuresBase<SimplifyAffineStructures> {
void runOnOperation() override;
/// Utility to simplify an affine attribute and update its entry in the parent
diff --git a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
index 6b592f08dab5e..749ac8dccc45a 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
@@ -11,8 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Affine/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/LoopAnalysis.h"
@@ -20,20 +19,13 @@
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/BlockAndValueMapping.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_AFFINEVECTORIZEPASS
-#include "mlir/Dialect/Affine/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace vector;
@@ -615,7 +607,7 @@ namespace {
/// Base state for the vectorize pass.
/// Command line arguments are preempted by non-empty pass arguments.
-struct Vectorize : public impl::AffineVectorizePassBase<Vectorize> {
+struct Vectorize : public AffineVectorizeBase<Vectorize> {
Vectorize() = default;
Vectorize(ArrayRef<int64_t> virtualVectorSize);
void runOnOperation() override;
diff --git a/mlir/lib/Dialect/Arithmetic/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Arithmetic/Transforms/Bufferize.cpp
index f90496f6501b4..60c644e0e8c36 100644
--- a/mlir/lib/Dialect/Arithmetic/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Arithmetic/Transforms/Bufferize.cpp
@@ -6,29 +6,23 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arithmetic/Transforms/BufferizableOpInterfaceImpl.h"
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
-namespace mlir {
-namespace arith {
-#define GEN_PASS_DEF_ARITHMETICBUFFERIZEPASS
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
-} // namespace arith
-} // namespace mlir
-
using namespace mlir;
using namespace bufferization;
namespace {
/// Pass to bufferize Arithmetic ops.
struct ArithmeticBufferizePass
- : public arith::impl::ArithmeticBufferizePassBase<ArithmeticBufferizePass> {
+ : public ArithmeticBufferizeBase<ArithmeticBufferizePass> {
ArithmeticBufferizePass(uint64_t alignment = 0, bool constantOpOnly = false)
: constantOpOnly(constantOpOnly) {
this->alignment = alignment;
diff --git a/mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp b/mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
index 30cfa61d3daed..afe7aab99af30 100644
--- a/mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
+++ b/mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
@@ -6,19 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-namespace arith {
-#define GEN_PASS_DEF_ARITHMETICEXPANDOPSPASS
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
-} // namespace arith
-} // namespace mlir
-
using namespace mlir;
/// Create an integer or index constant.
@@ -196,7 +189,7 @@ struct MaxMinIOpConverter : public OpRewritePattern<OpTy> {
};
struct ArithmeticExpandOpsPass
- : public arith::impl::ArithmeticExpandOpsPassBase<ArithmeticExpandOpsPass> {
+ : public ArithmeticExpandOpsBase<ArithmeticExpandOpsPass> {
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
ConversionTarget target(getContext());
diff --git a/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h b/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..5877ccccd634d
--- /dev/null
+++ b/mlir/lib/Dialect/Arithmetic/Transforms/PassDetail.h
@@ -0,0 +1,34 @@
+//===- PassDetail.h - Arithmetic Pass details -------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_ARITHMETIC_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_ARITHMETIC_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+namespace bufferization {
+class BufferizationDialect;
+} // namespace bufferization
+
+namespace func {
+class FuncDialect;
+} // namespace func
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_ARITHMETIC_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/Arithmetic/Transforms/UnsignedWhenEquivalent.cpp b/mlir/lib/Dialect/Arithmetic/Transforms/UnsignedWhenEquivalent.cpp
index 801abe662666b..82e442851b310 100644
--- a/mlir/lib/Dialect/Arithmetic/Transforms/UnsignedWhenEquivalent.cpp
+++ b/mlir/lib/Dialect/Arithmetic/Transforms/UnsignedWhenEquivalent.cpp
@@ -8,20 +8,13 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
#include "mlir/Analysis/DataFlow/IntegerRangeAnalysis.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
+#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-namespace arith {
-#define GEN_PASS_DEF_ARITHMETICUNSIGNEDWHENEQUIVALENTPASS
-#include "mlir/Dialect/Arithmetic/Transforms/Passes.h.inc"
-} // namespace arith
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::arith;
using namespace mlir::dataflow;
@@ -109,7 +102,7 @@ struct ConvertCmpIToUnsigned : OpConversionPattern<CmpIOp> {
};
struct ArithmeticUnsignedWhenEquivalentPass
- : public arith::impl::ArithmeticUnsignedWhenEquivalentPassBase<
+ : public ArithmeticUnsignedWhenEquivalentBase<
ArithmeticUnsignedWhenEquivalentPass> {
/// Implementation structure: first find all equivalent ops and collect them,
/// then perform all the rewrites in a second pass over the target op. This
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
index 1fbc89a1296b2..c50baf7e6d747 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
@@ -10,11 +10,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Async/Passes.h"
+#include <utility>
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Async/IR/Async.h"
+#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Dialect/Async/Transforms.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
@@ -25,12 +26,6 @@
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/RegionUtils.h"
-#include <utility>
-
-namespace mlir {
-#define GEN_PASS_DEF_ASYNCPARALLELFORPASS
-#include "mlir/Dialect/Async/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
using namespace mlir::async;
@@ -99,7 +94,7 @@ namespace {
// }
//
struct AsyncParallelForPass
- : public impl::AsyncParallelForPassBase<AsyncParallelForPass> {
+ : public AsyncParallelForBase<AsyncParallelForPass> {
AsyncParallelForPass() = default;
AsyncParallelForPass(bool asyncDispatch, int32_t numWorkerThreads,
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
index 0174b7917a172..959d6339495e8 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
@@ -11,10 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Async/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Analysis/Liveness.h"
#include "mlir/Dialect/Async/IR/Async.h"
+#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
@@ -22,17 +22,11 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/SmallSet.h"
-namespace mlir {
-#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGPASS
-#define GEN_PASS_DEF_ASYNCRUNTIMEPOLICYBASEDREFCOUNTINGPASS
-#include "mlir/Dialect/Async/Passes.h.inc"
-} // namespace mlir
-
-#define DEBUG_TYPE "async-runtime-ref-counting"
-
using namespace mlir;
using namespace mlir::async;
+#define DEBUG_TYPE "async-runtime-ref-counting"
+
//===----------------------------------------------------------------------===//
// Utility functions shared by reference counting passes.
//===----------------------------------------------------------------------===//
@@ -109,8 +103,7 @@ static LogicalResult walkReferenceCountedValues(
namespace {
class AsyncRuntimeRefCountingPass
- : public impl::AsyncRuntimeRefCountingPassBase<
- AsyncRuntimeRefCountingPass> {
+ : public AsyncRuntimeRefCountingBase<AsyncRuntimeRefCountingPass> {
public:
AsyncRuntimeRefCountingPass() = default;
void runOnOperation() override;
@@ -469,7 +462,7 @@ void AsyncRuntimeRefCountingPass::runOnOperation() {
namespace {
class AsyncRuntimePolicyBasedRefCountingPass
- : public impl::AsyncRuntimePolicyBasedRefCountingPassBase<
+ : public AsyncRuntimePolicyBasedRefCountingBase<
AsyncRuntimePolicyBasedRefCountingPass> {
public:
AsyncRuntimePolicyBasedRefCountingPass() { initializeDefaultPolicy(); }
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
index ee7bd2f55961e..14fe91a902016 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCountingOpt.cpp
@@ -10,28 +10,22 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Async/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Async/IR/Async.h"
+#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTINGOPTPASS
-#include "mlir/Dialect/Async/Passes.h.inc"
-} // namespace mlir
-
-#define DEBUG_TYPE "async-ref-counting"
-
using namespace mlir;
using namespace mlir::async;
+#define DEBUG_TYPE "async-ref-counting"
+
namespace {
class AsyncRuntimeRefCountingOptPass
- : public impl::AsyncRuntimeRefCountingOptPassBase<
- AsyncRuntimeRefCountingOptPass> {
+ : public AsyncRuntimeRefCountingOptBase<AsyncRuntimeRefCountingOptPass> {
public:
AsyncRuntimeRefCountingOptPass() = default;
void runOnOperation() override;
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index 85da871e953f2..efdae66969b7a 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -11,12 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Async/Passes.h"
-
#include "PassDetail.h"
#include "mlir/Conversion/SCFToControlFlow/SCFToControlFlow.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Async/IR/Async.h"
+#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
@@ -28,11 +27,6 @@
#include "llvm/ADT/SetVector.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_ASYNCTOASYNCRUNTIMEPASS
-#include "mlir/Dialect/Async/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::async;
@@ -43,7 +37,7 @@ static constexpr const char kAsyncFnPrefix[] = "async_execute_fn";
namespace {
class AsyncToAsyncRuntimePass
- : public impl::AsyncToAsyncRuntimePassBase<AsyncToAsyncRuntimePass> {
+ : public AsyncToAsyncRuntimeBase<AsyncToAsyncRuntimePass> {
public:
AsyncToAsyncRuntimePass() = default;
void runOnOperation() override;
diff --git a/mlir/lib/Dialect/Async/Transforms/PassDetail.h b/mlir/lib/Dialect/Async/Transforms/PassDetail.h
index 40e3c58722ecf..d2d71147fd77a 100644
--- a/mlir/lib/Dialect/Async/Transforms/PassDetail.h
+++ b/mlir/lib/Dialect/Async/Transforms/PassDetail.h
@@ -27,6 +27,9 @@ namespace scf {
class SCFDialect;
} // namespace scf
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Async/Passes.h.inc"
+
// -------------------------------------------------------------------------- //
// Utility functions shared by Async Transformations.
// -------------------------------------------------------------------------- //
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/AllocTensorElimination.cpp b/mlir/lib/Dialect/Bufferization/Transforms/AllocTensorElimination.cpp
index 71cabc12baa4e..ff308e62e2742 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/AllocTensorElimination.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/AllocTensorElimination.cpp
@@ -6,23 +6,17 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/AllocTensorElimination.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/Dominance.h"
#include "mlir/Pass/Pass.h"
-namespace mlir {
-namespace bufferization {
-#define GEN_PASS_DEF_ALLOCTENSORELIMINATIONPASS
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-} // namespace bufferization
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::bufferization;
@@ -240,8 +234,7 @@ mlir::bufferization::insertSliceAnchoredAllocTensorEliminationStep(
namespace {
struct AllocTensorElimination
- : public bufferization::impl::AllocTensorEliminationPassBase<
- AllocTensorElimination> {
+ : public AllocTensorEliminationBase<AllocTensorElimination> {
AllocTensorElimination() = default;
void runOnOperation() override;
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
index 88a2919afa216..2f7ede7adc2e2 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
@@ -50,22 +50,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "llvm/ADT/SetOperations.h"
-namespace mlir {
-namespace bufferization {
-#define GEN_PASS_DEF_BUFFERDEALLOCATIONPASS
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-} // namespace bufferization
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::bufferization;
@@ -640,8 +633,7 @@ struct DefaultAllocationInterface
/// The actual buffer deallocation pass that inserts and moves dealloc nodes
/// into the right positions. Furthermore, it inserts additional clones if
/// necessary. It uses the algorithm described at the top of the file.
-struct BufferDeallocationPass
- : bufferization::impl::BufferDeallocationPassBase<BufferDeallocationPass> {
+struct BufferDeallocationPass : BufferDeallocationBase<BufferDeallocationPass> {
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<bufferization::BufferizationDialect>();
registry.insert<memref::MemRefDialect>();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
index 46ab82297e1fc..e79e2829b63a3 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
@@ -11,24 +11,14 @@
// allocations and copies during buffer deallocation. The third pass tries to
// convert heap-based allocations to stack-based allocations, if possible.
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/Transforms/BufferUtils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Operation.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Pass/Pass.h"
-namespace mlir {
-namespace bufferization {
-#define GEN_PASS_DEF_BUFFERHOISTINGPASS
-#define GEN_PASS_DEF_BUFFERLOOPHOISTINGPASS
-#define GEN_PASS_DEF_PROMOTEBUFFERSTOSTACKPASS
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-} // namespace bufferization
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::bufferization;
@@ -371,8 +361,7 @@ class BufferPlacementPromotion : BufferPlacementTransformationBase {
/// The buffer hoisting pass that hoists allocation nodes into dominating
/// blocks.
-struct BufferHoistingPass
- : bufferization::impl::BufferHoistingPassBase<BufferHoistingPass> {
+struct BufferHoistingPass : BufferHoistingBase<BufferHoistingPass> {
void runOnOperation() override {
// Hoist all allocations into dominator blocks.
@@ -383,8 +372,7 @@ struct BufferHoistingPass
};
/// The buffer loop hoisting pass that hoists allocation nodes out of loops.
-struct BufferLoopHoistingPass
- : bufferization::impl::BufferLoopHoistingPassBase<BufferLoopHoistingPass> {
+struct BufferLoopHoistingPass : BufferLoopHoistingBase<BufferLoopHoistingPass> {
void runOnOperation() override {
// Hoist all allocations out of loops.
@@ -397,8 +385,7 @@ struct BufferLoopHoistingPass
/// The promote buffer to stack pass that tries to convert alloc nodes into
/// alloca nodes.
class PromoteBuffersToStackPass
- : public bufferization::impl::PromoteBuffersToStackPassBase<
- PromoteBuffersToStackPass> {
+ : public PromoteBuffersToStackBase<PromoteBuffersToStackPass> {
public:
PromoteBuffersToStackPass(unsigned maxAllocSizeInBytes,
unsigned maxRankOfAllocatedMemRef) {
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
index 7d5e8828261bc..d00da763498a7 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferResultsToOutParams.cpp
@@ -6,20 +6,13 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
-
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Operation.h"
#include "mlir/Pass/Pass.h"
-namespace mlir {
-namespace bufferization {
-#define GEN_PASS_DEF_BUFFERRESULTSTOOUTPARAMSPASS
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-} // namespace bufferization
-} // namespace mlir
-
using namespace mlir;
/// Return `true` if the given MemRef type has a fully dynamic layout.
@@ -186,8 +179,7 @@ mlir::bufferization::promoteBufferResultsToOutParams(ModuleOp module) {
namespace {
struct BufferResultsToOutParamsPass
- : bufferization::impl::BufferResultsToOutParamsPassBase<
- BufferResultsToOutParamsPass> {
+ : BufferResultsToOutParamsBase<BufferResultsToOutParamsPass> {
void runOnOperation() override {
if (failed(bufferization::promoteBufferResultsToOutParams(getOperation())))
return signalPassFailure();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
index 9d19786e53e8c..a233367b38bf1 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp
@@ -6,13 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h"
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Bufferization/Transforms/TensorCopyInsertion.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
@@ -21,15 +22,6 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/Passes.h"
-namespace mlir {
-namespace bufferization {
-#define GEN_PASS_DEF_FINALIZINGBUFFERIZEPASS
-#define GEN_PASS_DEF_BUFFERIZATIONBUFFERIZEPASS
-#define GEN_PASS_DEF_ONESHOTBUFFERIZEPASS
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-} // namespace bufferization
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::bufferization;
@@ -130,9 +122,9 @@ void mlir::bufferization::populateEliminateBufferizeMaterializationsPatterns(
namespace {
struct FinalizingBufferizePass
- : public bufferization::impl::FinalizingBufferizePassBase<
- FinalizingBufferizePass> {
- using FinalizingBufferizePassBase::FinalizingBufferizePassBase;
+ : public FinalizingBufferizeBase<FinalizingBufferizePass> {
+ using FinalizingBufferizeBase<
+ FinalizingBufferizePass>::FinalizingBufferizeBase;
void runOnOperation() override {
auto func = getOperation();
@@ -172,8 +164,7 @@ parseLayoutMapOption(const std::string &s) {
}
struct OneShotBufferizePass
- : public bufferization::impl::OneShotBufferizePassBase<
- OneShotBufferizePass> {
+ : public OneShotBufferizeBase<OneShotBufferizePass> {
OneShotBufferizePass() {}
explicit OneShotBufferizePass(const OneShotBufferizationOptions &options)
@@ -264,8 +255,7 @@ struct OneShotBufferizePass
namespace {
struct BufferizationBufferizePass
- : public bufferization::impl::BufferizationBufferizePassBase<
- BufferizationBufferizePass> {
+ : public BufferizationBufferizeBase<BufferizationBufferizePass> {
void runOnOperation() override {
BufferizationOptions options = getPartialBufferizationOptions();
options.opFilter.allowDialect<BufferizationDialect>();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/DropEquivalentBufferResults.cpp b/mlir/lib/Dialect/Bufferization/Transforms/DropEquivalentBufferResults.cpp
index ef06d1dcf6c17..fdbc9a0426799 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/DropEquivalentBufferResults.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/DropEquivalentBufferResults.cpp
@@ -27,20 +27,13 @@
// function argument, it is also considered equivalent. A cast is inserted at
// the call site in that case.
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
-
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Operation.h"
#include "mlir/Pass/Pass.h"
-namespace mlir {
-namespace bufferization {
-#define GEN_PASS_DEF_DROPEQUIVALENTBUFFERRESULTSPASS
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-} // namespace bufferization
-} // namespace mlir
-
using namespace mlir;
/// Return the unique ReturnOp that terminates `funcOp`.
@@ -144,8 +137,7 @@ mlir::bufferization::dropEquivalentBufferResults(ModuleOp module) {
namespace {
struct DropEquivalentBufferResultsPass
- : bufferization::impl::DropEquivalentBufferResultsPassBase<
- DropEquivalentBufferResultsPass> {
+ : DropEquivalentBufferResultsBase<DropEquivalentBufferResultsPass> {
void runOnOperation() override {
if (failed(bufferization::dropEquivalentBufferResults(getOperation())))
return signalPassFailure();
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h b/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..c63e85c8f5667
--- /dev/null
+++ b/mlir/lib/Dialect/Bufferization/Transforms/PassDetail.h
@@ -0,0 +1,35 @@
+//===- PassDetail.h - Bufferization Pass details ----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_BUFFERIZATION_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_BUFFERIZATION_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+namespace bufferization {
+class BufferizationDialect;
+} // namespace bufferization
+
+namespace func {
+class FuncDialect;
+} // namespace func
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_BUFFERIZATION_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp b/mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp
index 7bdace384b4ab..8e5aa1cbc8072 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp
@@ -6,22 +6,16 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
+#include "mlir/Dialect/Bufferization/Transforms/TensorCopyInsertion.h"
+
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h"
-#include "mlir/Dialect/Bufferization/Transforms/TensorCopyInsertion.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
-
-namespace mlir {
-namespace bufferization {
-#define GEN_PASS_DEF_TENSORCOPYINSERTIONPASS
-#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
-} // namespace bufferization
-} // namespace mlir
+#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
using namespace mlir;
using namespace mlir::bufferization;
@@ -165,8 +159,7 @@ mlir::bufferization::insertTensorCopies(Operation *op,
namespace {
struct TensorCopyInsertionPass
- : bufferization::impl::TensorCopyInsertionPassBase<
- TensorCopyInsertionPass> {
+ : TensorCopyInsertionBase<TensorCopyInsertionPass> {
TensorCopyInsertionPass() : options(llvm::None) {}
TensorCopyInsertionPass(const OneShotBufferizationOptions &options)
: options(options) {}
diff --git a/mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp b/mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp
index e925779edf3de..327f2dfa187e5 100644
--- a/mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp
+++ b/mlir/lib/Dialect/Func/Transforms/FuncBufferize.cpp
@@ -10,28 +10,21 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Func/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
+#include "mlir/Dialect/Func/Transforms/Passes.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_FUNCBUFFERIZEPASS
-#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::func;
namespace {
-struct FuncBufferizePass
- : public impl::FuncBufferizePassBase<FuncBufferizePass> {
- using FuncBufferizePassBase::FuncBufferizePassBase;
-
+struct FuncBufferizePass : public FuncBufferizeBase<FuncBufferizePass> {
+ using FuncBufferizeBase<FuncBufferizePass>::FuncBufferizeBase;
void runOnOperation() override {
auto module = getOperation();
auto *context = &getContext();
diff --git a/mlir/lib/Dialect/Func/Transforms/PassDetail.h b/mlir/lib/Dialect/Func/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..4b8a2cd8994e8
--- /dev/null
+++ b/mlir/lib/Dialect/Func/Transforms/PassDetail.h
@@ -0,0 +1,33 @@
+//===- PassDetail.h - Func Pass class details -------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+class AtomicRMWOp;
+
+namespace bufferization {
+class BufferizationDialect;
+} // namespace bufferization
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Func/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_FUNC_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
index 92d186b3bd410..59758b80357d7 100644
--- a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp
@@ -11,11 +11,10 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/GPU/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Async/IR/Async.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
+#include "mlir/Dialect/GPU/Transforms/Passes.h"
#include "mlir/Dialect/GPU/Transforms/Utils.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
@@ -25,16 +24,9 @@
#include "mlir/Transforms/RegionUtils.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace mlir {
-#define GEN_PASS_DEF_GPUASYNCREGIONPASS
-#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
-
namespace {
-class GpuAsyncRegionPass
- : public impl::GpuAsyncRegionPassBase<GpuAsyncRegionPass> {
+class GpuAsyncRegionPass : public GpuAsyncRegionPassBase<GpuAsyncRegionPass> {
struct ThreadTokenCallback;
struct DeferWaitCallback;
struct SingleTokenUseCallback;
diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index f4c39668ad7d4..df81284edcf88 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -10,14 +10,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/GPU/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/AsmParser/AsmParser.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/DLTI/DLTI.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
+#include "mlir/Dialect/GPU/Transforms/Passes.h"
#include "mlir/Dialect/GPU/Transforms/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/BlockAndValueMapping.h"
@@ -27,12 +27,6 @@
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/RegionUtils.h"
-namespace mlir {
-#define GEN_PASS_DEF_GPULAUNCHSINKINDEXCOMPUTATIONSPASS
-#define GEN_PASS_DEF_GPUKERNELOUTLININGPASS
-#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
template <typename OpTy>
@@ -245,7 +239,7 @@ namespace {
/// Pass that moves ops which are likely an index computation into gpu.launch
/// body.
class GpuLaunchSinkIndexComputationsPass
- : public impl::GpuLaunchSinkIndexComputationsPassBase<
+ : public GpuLaunchSinkIndexComputationsBase<
GpuLaunchSinkIndexComputationsPass> {
public:
void runOnOperation() override {
@@ -272,7 +266,7 @@ class GpuLaunchSinkIndexComputationsPass
/// a separate pass. The external functions can then be annotated with the
/// symbol of the cubin accessor function.
class GpuKernelOutliningPass
- : public impl::GpuKernelOutliningPassBase<GpuKernelOutliningPass> {
+ : public GpuKernelOutliningBase<GpuKernelOutliningPass> {
public:
GpuKernelOutliningPass(StringRef dlStr) {
if (!dlStr.empty() && !dataLayoutStr.hasValue())
@@ -280,8 +274,7 @@ class GpuKernelOutliningPass
}
GpuKernelOutliningPass(const GpuKernelOutliningPass &other)
- : GpuKernelOutliningPassBase(other),
- dataLayoutSpec(other.dataLayoutSpec) {
+ : GpuKernelOutliningBase(other), dataLayoutSpec(other.dataLayoutSpec) {
dataLayoutStr = other.dataLayoutStr.getValue();
}
diff --git a/mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp b/mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp
index 72e0ebc132e86..84f2a907cafbb 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp
@@ -11,19 +11,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/GPU/Transforms/Passes.h"
+#include "mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "PassDetail.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
-#include "mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h"
+#include "mlir/Dialect/GPU/Transforms/Passes.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/AffineMap.h"
-namespace mlir {
-#define GEN_PASS_DEF_GPUMAPPARALLELLOOPSPASS
-#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
-} // namespace mlir
-
namespace mlir {
using scf::ParallelOp;
@@ -134,7 +129,7 @@ static void mapParallelOp(ParallelOp parallelOp,
namespace {
struct GpuMapParallelLoopsPass
- : public impl::GpuMapParallelLoopsPassBase<GpuMapParallelLoopsPass> {
+ : public GpuMapParallelLoopsPassBase<GpuMapParallelLoopsPass> {
void runOnOperation() override {
for (Region ®ion : getOperation()->getRegions()) {
region.walk([](ParallelOp parallelOp) { mapParallelOp(parallelOp); });
diff --git a/mlir/lib/Dialect/GPU/Transforms/PassDetail.h b/mlir/lib/Dialect/GPU/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..2f5c7dc803cac
--- /dev/null
+++ b/mlir/lib/Dialect/GPU/Transforms/PassDetail.h
@@ -0,0 +1,25 @@
+//===- PassDetail.h - GPU Pass class details --------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/Async/IR/Async.h"
+#include "mlir/Dialect/DLTI/DLTI.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/GPU/IR/GPUDialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/GPU/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_GPU_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp b/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
index 9fc80c550345a..08fd412ff92cf 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/LegalizeForExport.cpp
@@ -7,19 +7,11 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/LLVMIR/Transforms/LegalizeForExport.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Block.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-namespace LLVM {
-#define GEN_PASS_DEF_LLVMLEGALIZEFOREXPORTPASS
-#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
-} // namespace LLVM
-} // namespace mlir
using namespace mlir;
@@ -75,11 +67,8 @@ void mlir::LLVM::ensureDistinctSuccessors(Operation *op) {
}
namespace {
-struct LLVMLegalizeForExportPass
- : public LLVM::impl::LLVMLegalizeForExportPassBase<
- LLVMLegalizeForExportPass> {
- using LLVMLegalizeForExportPassBase::LLVMLegalizeForExportPassBase;
-
+struct LegalizeForExportPass
+ : public LLVMLegalizeForExportBase<LegalizeForExportPass> {
void runOnOperation() override {
LLVM::ensureDistinctSuccessors(getOperation());
}
@@ -87,5 +76,5 @@ struct LLVMLegalizeForExportPass
} // namespace
std::unique_ptr<Pass> LLVM::createLegalizeForExportPass() {
- return std::make_unique<LLVMLegalizeForExportPass>();
+ return std::make_unique<LegalizeForExportPass>();
}
diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp b/mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp
index 5bf0d7da690ef..d269aa82ecec5 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp
@@ -7,20 +7,12 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/LLVMIR/Transforms/OptimizeForNVVM.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-namespace NVVM {
-#define GEN_PASS_DEF_NVVMOPTIMIZEFORTARGETPASS
-#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
-} // namespace NVVM
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -39,11 +31,8 @@ struct ExpandDivF16 : public OpRewritePattern<LLVM::FDivOp> {
PatternRewriter &rewriter) const override;
};
-struct NVVMOptimizeForTargetPass
- : public NVVM::impl::NVVMOptimizeForTargetPassBase<
- NVVMOptimizeForTargetPass> {
- using NVVMOptimizeForTargetPassBase::NVVMOptimizeForTargetPassBase;
-
+struct NVVMOptimizeForTarget
+ : public NVVMOptimizeForTargetBase<NVVMOptimizeForTarget> {
void runOnOperation() override;
void getDependentDialects(DialectRegistry ®istry) const override {
@@ -95,7 +84,7 @@ LogicalResult ExpandDivF16::matchAndRewrite(LLVM::FDivOp op,
return success();
}
-void NVVMOptimizeForTargetPass::runOnOperation() {
+void NVVMOptimizeForTarget::runOnOperation() {
MLIRContext *ctx = getOperation()->getContext();
RewritePatternSet patterns(ctx);
patterns.add<ExpandDivF16>(ctx);
@@ -104,5 +93,5 @@ void NVVMOptimizeForTargetPass::runOnOperation() {
}
std::unique_ptr<Pass> NVVM::createOptimizeForTargetPass() {
- return std::make_unique<NVVMOptimizeForTargetPass>();
+ return std::make_unique<NVVMOptimizeForTarget>();
}
diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/PassDetail.h b/mlir/lib/Dialect/LLVMIR/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..deb54ba082a5a
--- /dev/null
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/PassDetail.h
@@ -0,0 +1,24 @@
+//===- PassDetail.h - LLVM Pass class details -------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_LLVMIR_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_LLVMIR_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+namespace func {
+class FuncOp;
+} // namespace func
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_LLVMIR_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/RequestCWrappers.cpp b/mlir/lib/Dialect/LLVMIR/Transforms/RequestCWrappers.cpp
index 17f953644723a..d32f51053e875 100644
--- a/mlir/lib/Dialect/LLVMIR/Transforms/RequestCWrappers.cpp
+++ b/mlir/lib/Dialect/LLVMIR/Transforms/RequestCWrappers.cpp
@@ -7,25 +7,16 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-namespace LLVM {
-#define GEN_PASS_DEF_LLVMREQUESTCWRAPPERSPASS
-#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"
-} // namespace LLVM
-} // namespace mlir
using namespace mlir;
namespace {
-struct LLVMRequestCWrappersPass
- : public LLVM::impl::LLVMRequestCWrappersPassBase<
- LLVMRequestCWrappersPass> {
- using LLVMRequestCWrappersPassBase::LLVMRequestCWrappersPassBase;
-
+class RequestCWrappersPass
+ : public LLVMRequestCWrappersBase<RequestCWrappersPass> {
+public:
void runOnOperation() override {
getOperation()->setAttr(LLVM::LLVMDialect::getEmitCWrapperAttrName(),
UnitAttr::get(&getContext()));
@@ -34,5 +25,5 @@ struct LLVMRequestCWrappersPass
} // namespace
std::unique_ptr<Pass> mlir::LLVM::createRequestCWrappersPass() {
- return std::make_unique<LLVMRequestCWrappersPass>();
+ return std::make_unique<RequestCWrappersPass>();
}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp b/mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp
index c14f91000d898..78dd1ead31728 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp
@@ -12,6 +12,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
index fd3a4247b04ca..63433ef50fe2e 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp
@@ -6,13 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
+#include "PassDetail.h"
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
@@ -20,19 +19,13 @@
#include "mlir/IR/Operation.h"
#include "mlir/Pass/Pass.h"
-namespace mlir {
-#define GEN_PASS_DEF_LINALGBUFFERIZEPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace bufferization;
namespace {
/// Converts Linalg operations that work on tensor-type operands or results to
/// work on buffers.
-struct LinalgBufferizePass
- : public impl::LinalgBufferizePassBase<LinalgBufferizePass> {
+struct LinalgBufferizePass : public LinalgBufferizeBase<LinalgBufferizePass> {
void runOnOperation() override {
BufferizationOptions options = getPartialBufferizationOptions();
options.opFilter.allowDialect<linalg::LinalgDialect>();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
index 72515fd7d6502..b98b486d38ee3 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp
@@ -6,12 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/Transforms/DialectConversion.h"
@@ -20,11 +19,6 @@
#include <memory>
#include <utility>
-namespace mlir {
-#define GEN_PASS_DEF_LINALGDETENSORIZEPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::linalg;
@@ -164,8 +158,7 @@ class DetensorizeTypeConverter : public TypeConverter {
};
/// @see LinalgDetensorize in Linalg/Passes.td for more details.
-struct LinalgDetensorize
- : public impl::LinalgDetensorizePassBase<LinalgDetensorize> {
+struct LinalgDetensorize : public LinalgDetensorizeBase<LinalgDetensorize> {
LinalgDetensorize() = default;
class CostModel {
diff --git a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
index 0ecc07d021a43..df3b8e6af0437 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
@@ -12,11 +12,10 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
-
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
@@ -28,11 +27,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMSPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "linalg-drop-unit-dims"
using namespace mlir;
@@ -548,8 +542,7 @@ void mlir::linalg::populateFoldUnitExtentDimsPatterns(
namespace {
/// Pass that removes unit-extent dims within generic ops.
struct LinalgFoldUnitExtentDimsPass
- : public impl::LinalgFoldUnitExtentDimsPassBase<
- LinalgFoldUnitExtentDimsPass> {
+ : public LinalgFoldUnitExtentDimsBase<LinalgFoldUnitExtentDimsPass> {
void runOnOperation() override {
Operation *op = getOperation();
MLIRContext *context = op->getContext();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
index c8701fc8cf5e8..2644e50c2684e 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
@@ -9,11 +9,12 @@
// This file implements the linalg dialect Fusion on tensors operations pass.
//
//===----------------------------------------------------------------------===//
+#include <utility>
-#include "mlir/Dialect/Linalg/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
@@ -23,13 +24,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-#include <utility>
-
-namespace mlir {
-#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMSPASS
-#define GEN_PASS_DEF_LINALGELEMENTWISEOPFUSIONPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
using namespace mlir::linalg;
@@ -1759,8 +1753,7 @@ namespace {
// favor of test passes that check the functionality of each of the patterns
// added here individually.
struct LinalgElementwiseOpFusionPass
- : public impl::LinalgElementwiseOpFusionPassBase<
- LinalgElementwiseOpFusionPass> {
+ : public LinalgElementwiseOpFusionBase<LinalgElementwiseOpFusionPass> {
void runOnOperation() override {
Operation *op = getOperation();
MLIRContext *context = op->getContext();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
index 2494198f8c029..9b5dad05c6898 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp
@@ -8,17 +8,13 @@
#include "mlir/Dialect/Linalg/Passes.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONVERTELEMENTWISETOLINALGPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
static bool isElementwiseMappableOpOnRankedTensors(Operation *op) {
@@ -125,8 +121,7 @@ void mlir::linalg::populateElementwiseToLinalgConversionPatterns(
namespace {
class ConvertElementwiseToLinalgPass
- : public impl::ConvertElementwiseToLinalgPassBase<
- ConvertElementwiseToLinalgPass> {
+ : public ConvertElementwiseToLinalgBase<ConvertElementwiseToLinalgPass> {
void runOnOperation() final {
auto *func = getOperation();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
index ebef65626fd71..9d38dd6084fe8 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp b/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
index ff28663d479b7..24caab3b58950 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp
index 4512ab59efb67..9c5b3fab22405 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp
@@ -11,10 +11,9 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Attributes.h"
@@ -25,11 +24,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_LINALGGENERALIZATIONPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "linalg-generalization"
using namespace mlir;
@@ -73,7 +67,7 @@ FailureOr<GenericOp> mlir::linalg::generalizeNamedOp(RewriterBase &rewriter,
namespace {
struct LinalgGeneralizationPass
- : public impl::LinalgGeneralizationPassBase<LinalgGeneralizationPass> {
+ : public LinalgGeneralizationBase<LinalgGeneralizationPass> {
void runOnOperation() override;
};
diff --git a/mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp b/mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp
index a34005ca89bc9..978220efbf208 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp
@@ -6,17 +6,13 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_LINALGINITTENSORTOALLOCTENSORPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::bufferization;
using namespace mlir::linalg;
@@ -34,8 +30,7 @@ struct InitTensorLoweringPattern : public OpRewritePattern<InitTensorOp> {
};
struct LinalgInitTensorToAllocTensor
- : public impl::LinalgInitTensorToAllocTensorPassBase<
- LinalgInitTensorToAllocTensor> {
+ : public LinalgInitTensorToAllocTensorBase<LinalgInitTensorToAllocTensor> {
LinalgInitTensorToAllocTensor() = default;
void runOnOperation() override;
diff --git a/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp b/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp
index 5280e965cb8d7..b2ad1b24c6b6e 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp
@@ -12,21 +12,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_LINALGINLINESCALAROPERANDSPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::linalg;
@@ -102,8 +96,7 @@ void mlir::linalg::populateInlineConstantOperandsPatterns(
namespace {
/// Pass that removes unit-extent dims within generic ops.
struct LinalgInlineScalarOperandsPass
- : public impl::LinalgInlineScalarOperandsPassBase<
- LinalgInlineScalarOperandsPass> {
+ : public LinalgInlineScalarOperandsBase<LinalgInlineScalarOperandsPass> {
void runOnOperation() override {
func::FuncOp funcOp = getOperation();
MLIRContext *context = funcOp.getContext();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp b/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
index 6966c94109066..b8a8bbd40a0a3 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp
@@ -11,14 +11,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
+#include <utility>
+#include "PassDetail.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/LoopUtils.h"
#include "mlir/Dialect/Affine/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Hoisting.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
@@ -32,20 +33,6 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
#include "mlir/Transforms/Passes.h"
-#include <utility>
-
-namespace mlir {
-#define GEN_PASS_DEF_LINALGSTRATEGYTILEANDFUSEPASS
-#define GEN_PASS_DEF_LINALGSTRATEGYTILEPASS
-#define GEN_PASS_DEF_LINALGSTRATEGYPADPASS
-#define GEN_PASS_DEF_LINALGSTRATEGYDECOMPOSEPASS
-#define GEN_PASS_DEF_LINALGSTRATEGYPEELPASS
-#define GEN_PASS_DEF_LINALGSTRATEGYVECTORIZEPASS
-#define GEN_PASS_DEF_LINALGSTRATEGYENABLEPASS
-#define GEN_PASS_DEF_LINALGSTRATEGYLOWERVECTORSPASS
-#define GEN_PASS_DEF_LINALGSTRATEGYREMOVEMARKERSPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
using namespace mlir;
using namespace mlir::vector;
@@ -55,8 +42,7 @@ namespace {
/// Configurable pass to apply pattern-based tiling and fusion.
struct LinalgStrategyTileAndFusePass
- : public impl::LinalgStrategyTileAndFusePassBase<
- LinalgStrategyTileAndFusePass> {
+ : public LinalgStrategyTileAndFusePassBase<LinalgStrategyTileAndFusePass> {
LinalgStrategyTileAndFusePass() = default;
@@ -93,7 +79,7 @@ struct LinalgStrategyTileAndFusePass
/// Configurable pass to apply pattern-based linalg tiling.
struct LinalgStrategyTilePass
- : public impl::LinalgStrategyTilePassBase<LinalgStrategyTilePass> {
+ : public LinalgStrategyTilePassBase<LinalgStrategyTilePass> {
LinalgStrategyTilePass() = default;
@@ -126,7 +112,7 @@ struct LinalgStrategyTilePass
/// Configurable pass to apply hoisting and padding.
struct LinalgStrategyPadPass
- : public impl::LinalgStrategyPadPassBase<LinalgStrategyPadPass> {
+ : public LinalgStrategyPadPassBase<LinalgStrategyPadPass> {
LinalgStrategyPadPass() = default;
@@ -156,11 +142,11 @@ struct LinalgStrategyPadPass
LinalgTransformationFilter filter;
};
+
/// Configurable pass to apply lowering of coarser-grained named linalg ops into
/// finer-grained named versions.
struct LinalgStrategyDecomposePass
- : public impl::LinalgStrategyDecomposePassBase<
- LinalgStrategyDecomposePass> {
+ : public LinalgStrategyDecomposePassBase<LinalgStrategyDecomposePass> {
LinalgStrategyDecomposePass() = default;
@@ -183,7 +169,7 @@ struct LinalgStrategyDecomposePass
/// Configurable pass to apply pattern-based linalg peeling.
struct LinalgStrategyPeelPass
- : public impl::LinalgStrategyPeelPassBase<LinalgStrategyPeelPass> {
+ : public LinalgStrategyPeelPassBase<LinalgStrategyPeelPass> {
LinalgStrategyPeelPass() = default;
@@ -217,8 +203,7 @@ struct LinalgStrategyPeelPass
/// Configurable pass to apply pattern-based linalg vectorization.
struct LinalgStrategyVectorizePass
- : public impl::LinalgStrategyVectorizePassBase<
- LinalgStrategyVectorizePass> {
+ : public LinalgStrategyVectorizePassBase<LinalgStrategyVectorizePass> {
LinalgStrategyVectorizePass() = default;
@@ -274,7 +259,7 @@ struct LinalgStrategyVectorizePass
/// Configurable pass to enable the application of other pattern-based linalg
/// passes.
struct LinalgStrategyEnablePass
- : public impl::LinalgStrategyEnablePassBase<LinalgStrategyEnablePass> {
+ : public LinalgStrategyEnablePassBase<LinalgStrategyEnablePass> {
LinalgStrategyEnablePass(LinalgEnablingOptions opt,
LinalgTransformationFilter filt)
@@ -324,7 +309,7 @@ struct LinalgStrategyEnablePass
/// Configurable pass to lower vector operations.
struct LinalgStrategyLowerVectorsPass
- : public impl::LinalgStrategyLowerVectorsPassBase<
+ : public LinalgStrategyLowerVectorsPassBase<
LinalgStrategyLowerVectorsPass> {
LinalgStrategyLowerVectorsPass(LinalgVectorLoweringOptions opt,
@@ -389,7 +374,7 @@ struct LinalgStrategyLowerVectorsPass
/// Configurable pass to lower vector operations.
struct LinalgStrategyRemoveMarkersPass
- : public impl::LinalgStrategyRemoveMarkersPassBase<
+ : public LinalgStrategyRemoveMarkersPassBase<
LinalgStrategyRemoveMarkersPass> {
void runOnOperation() override {
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
index 941e5f04623eb..3656bc2a1a067 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
@@ -6,13 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
-
-#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
@@ -26,13 +24,6 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace mlir {
-#define GEN_PASS_DEF_LINALGLOWERTOAFFINELOOPSPASS
-#define GEN_PASS_DEF_LINALGLOWERTOLOOPSPASS
-#define GEN_PASS_DEF_LINALGLOWERTOPARALLELLOOPSPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::linalg;
@@ -320,7 +311,7 @@ static void lowerLinalgToLoopsImpl(func::FuncOp funcOp) {
}
struct LowerToAffineLoops
- : public impl::LinalgLowerToAffineLoopsPassBase<LowerToAffineLoops> {
+ : public LinalgLowerToAffineLoopsBase<LowerToAffineLoops> {
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect>();
}
@@ -329,7 +320,7 @@ struct LowerToAffineLoops
}
};
-struct LowerToLoops : public impl::LinalgLowerToLoopsPassBase<LowerToLoops> {
+struct LowerToLoops : public LinalgLowerToLoopsBase<LowerToLoops> {
void getDependentDialects(DialectRegistry ®istry) const override {
registry.insert<memref::MemRefDialect, scf::SCFDialect>();
}
@@ -339,7 +330,7 @@ struct LowerToLoops : public impl::LinalgLowerToLoopsPassBase<LowerToLoops> {
};
struct LowerToParallelLoops
- : public impl::LinalgLowerToParallelLoopsPassBase<LowerToParallelLoops> {
+ : public LinalgLowerToParallelLoopsBase<LowerToParallelLoops> {
void runOnOperation() override {
lowerLinalgToLoopsImpl<scf::ParallelOp>(getOperation());
}
diff --git a/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp b/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp
index 83148b3f9f437..1d987ee62c9c9 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp
@@ -10,19 +10,14 @@
// canonicalizations of named ops.
//
//===----------------------------------------------------------------------===//
-
-#include "mlir/Dialect/Linalg/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-#include "llvm/ADT/SmallVector.h"
-namespace mlir {
-#define GEN_PASS_DEF_LINALGNAMEDOPCONVERSIONPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
+#include "llvm/ADT/SmallVector.h"
using namespace mlir;
using namespace mlir::linalg;
@@ -140,8 +135,7 @@ struct SimplifyDepthwiseConvQOp
};
struct LinalgNamedOpConversionPass
- : public impl::LinalgNamedOpConversionPassBase<
- LinalgNamedOpConversionPass> {
+ : public LinalgNamedOpConversionBase<LinalgNamedOpConversionPass> {
LinalgNamedOpConversionPass() = default;
LinalgNamedOpConversionPass(const LinalgNamedOpConversionPass &) = default;
diff --git a/mlir/lib/Dialect/Linalg/Transforms/PassDetail.h b/mlir/lib/Dialect/Linalg/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..63f947524cc71
--- /dev/null
+++ b/mlir/lib/Dialect/Linalg/Transforms/PassDetail.h
@@ -0,0 +1,52 @@
+//===- PassDetail.h - Linalg Pass class details -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_LINALG_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_LINALG_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/Affine/IR/AffineOps.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/IR/Dialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+namespace arith {
+class ArithmeticDialect;
+} // namespace arith
+
+namespace bufferization {
+class BufferizationDialect;
+} // namespace bufferization
+
+namespace linalg {
+class LinalgDialect;
+} // namespace linalg
+
+namespace scf {
+class SCFDialect;
+} // namespace scf
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+namespace tensor {
+class TensorDialect;
+} // namespace tensor
+
+namespace vector {
+class VectorDialect;
+} // namespace vector
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Linalg/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_LINALG_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
index 79ef14e700ac8..4c5fbf98cdf00 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
index 175dbad182dce..55ce5ea66ae3c 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
@@ -10,13 +10,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Linalg/Passes.h"
+#include <utility>
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/Utils/Utils.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
+#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
@@ -27,20 +28,15 @@
#include "mlir/IR/AffineMap.h"
#include "mlir/Transforms/FoldUtils.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-#include "llvm/Support/CommandLine.h"
-#include <utility>
-namespace mlir {
-#define GEN_PASS_DEF_LINALGTILINGPASS
-#include "mlir/Dialect/Linalg/Passes.h.inc"
-} // namespace mlir
-
-#define DEBUG_TYPE "linalg-tiling"
+#include "llvm/Support/CommandLine.h"
using namespace mlir;
using namespace mlir::linalg;
using namespace mlir::scf;
+#define DEBUG_TYPE "linalg-tiling"
+
static bool isZero(OpFoldResult v) {
if (!v)
return false;
@@ -748,7 +744,7 @@ static void applyExtractSliceOfPadTensorSwapPattern(func::FuncOp funcOp) {
}
namespace {
-struct LinalgTilingPass : public impl::LinalgTilingPassBase<LinalgTilingPass> {
+struct LinalgTilingPass : public LinalgTilingBase<LinalgTilingPass> {
LinalgTilingPass() = default;
LinalgTilingPass(ArrayRef<int64_t> tileSizes, LinalgTilingLoopType loopType) {
this->tileSizes = tileSizes;
diff --git a/mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp b/mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
index 73eb6fa749f2d..c4011c55f5a4e 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/ExpandOps.cpp
@@ -12,21 +12,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/MemRef/Transforms/Passes.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Arithmetic/Transforms/Passes.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
+#include "mlir/Dialect/MemRef/Transforms/Passes.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-namespace memref {
-#define GEN_PASS_DEF_EXPANDOPSPASS
-#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
-} // namespace memref
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -125,7 +119,7 @@ struct MemRefReshapeOpConverter : public OpRewritePattern<memref::ReshapeOp> {
}
};
-struct ExpandOpsPass : public memref::impl::ExpandOpsPassBase<ExpandOpsPass> {
+struct ExpandOpsPass : public ExpandOpsBase<ExpandOpsPass> {
void runOnOperation() override {
MLIRContext &ctx = getContext();
diff --git a/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp b/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
index e91c33ea9b5b8..3ce18ec442c04 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
@@ -11,11 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/MemRef/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
+#include "mlir/Dialect/MemRef/Transforms/Passes.h"
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/BuiltinTypes.h"
@@ -23,13 +23,6 @@
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace mlir {
-namespace memref {
-#define GEN_PASS_DEF_FOLDMEMREFALIASOPSPASS
-#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
-} // namespace memref
-} // namespace mlir
-
using namespace mlir;
//===----------------------------------------------------------------------===//
@@ -547,8 +540,11 @@ void memref::populateFoldMemRefAliasOpPatterns(RewritePatternSet &patterns) {
namespace {
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
+
struct FoldMemRefAliasOpsPass final
- : public memref::impl::FoldMemRefAliasOpsPassBase<FoldMemRefAliasOpsPass> {
+ : public FoldMemRefAliasOpsBase<FoldMemRefAliasOpsPass> {
void runOnOperation() override;
};
diff --git a/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp b/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
index a3c2a9d1a2cbd..345c71de7af70 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
@@ -19,13 +20,6 @@
#include "llvm/ADT/SmallSet.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-namespace memref {
-#define GEN_PASS_DEF_NORMALIZEMEMREFSPASS
-#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
-} // namespace memref
-} // namespace mlir
-
#define DEBUG_TYPE "normalize-memrefs"
using namespace mlir;
@@ -38,8 +32,7 @@ namespace {
/// such functions as normalizable. Also, if a normalizable function is known
/// to call a non-normalizable function, we treat that function as
/// non-normalizable as well. We assume external functions to be normalizable.
-struct NormalizeMemRefs
- : public memref::impl::NormalizeMemRefsPassBase<NormalizeMemRefs> {
+struct NormalizeMemRefs : public NormalizeMemRefsBase<NormalizeMemRefs> {
void runOnOperation() override;
void normalizeFuncOpMemRefs(func::FuncOp funcOp, ModuleOp moduleOp);
bool areMemRefsNormalizable(func::FuncOp funcOp);
diff --git a/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h b/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..ba7a87502dcba
--- /dev/null
+++ b/mlir/lib/Dialect/MemRef/Transforms/PassDetail.h
@@ -0,0 +1,49 @@
+//===- PassDetail.h - MemRef Pass class details -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_MEMREF_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_MEMREF_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/IR/DialectRegistry.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+class AffineDialect;
+
+// Forward declaration from Dialect.h
+template <typename ConcreteDialect>
+void registerDialect(DialectRegistry ®istry);
+
+namespace arith {
+class ArithmeticDialect;
+} // namespace arith
+
+namespace func {
+class FuncDialect;
+} // namespace func
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+namespace tensor {
+class TensorDialect;
+} // namespace tensor
+
+namespace vector {
+class VectorDialect;
+} // namespace vector
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_MEMREF_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp b/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
index bf2365869fae2..d90ec22fc0b5a 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp
@@ -11,23 +11,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/MemRef/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
+#include "mlir/Dialect/MemRef/Transforms/Passes.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-namespace memref {
-#define GEN_PASS_DEF_RESOLVERANKEDSHAPETYPERESULTDIMSPASS
-#define GEN_PASS_DEF_RESOLVESHAPEDTYPERESULTDIMSPASS
-#include "mlir/Dialect/MemRef/Transforms/Passes.h.inc"
-} // namespace memref
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -116,14 +108,13 @@ struct DimOfReifyRankedShapedTypeOpInterface : public OpRewritePattern<OpTy> {
namespace {
struct ResolveRankedShapeTypeResultDimsPass final
- : public memref::impl::ResolveRankedShapeTypeResultDimsPassBase<
+ : public ResolveRankedShapeTypeResultDimsBase<
ResolveRankedShapeTypeResultDimsPass> {
void runOnOperation() override;
};
struct ResolveShapedTypeResultDimsPass final
- : public memref::impl::ResolveShapedTypeResultDimsPassBase<
- ResolveShapedTypeResultDimsPass> {
+ : public ResolveShapedTypeResultDimsBase<ResolveShapedTypeResultDimsPass> {
void runOnOperation() override;
};
diff --git a/mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp b/mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
index 4d38319f48f94..d24001c4d28ae 100644
--- a/mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
+++ b/mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
diff --git a/mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp b/mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
index 419617db9432c..da8292b33a80d 100644
--- a/mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
+++ b/mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
@@ -9,13 +9,12 @@
// This file implements transforms to optimize accesses to shared memory.
//
//===----------------------------------------------------------------------===//
-
-#include "mlir/Dialect/NVGPU/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/NVGPU/IR/NVGPUDialect.h"
+#include "mlir/Dialect/NVGPU/Passes.h"
#include "mlir/Dialect/NVGPU/Transforms/Transforms.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
@@ -23,13 +22,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"
-namespace mlir {
-namespace nvgpu {
-#define GEN_PASS_DEF_OPTIMIZESHAREDMEMORYPASS
-#include "mlir/Dialect/NVGPU/Passes.h.inc"
-} // namespace nvgpu
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::nvgpu;
@@ -250,10 +242,9 @@ mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(Operation *parentOp,
namespace {
class OptimizeSharedMemoryPass
- : public nvgpu::impl::OptimizeSharedMemoryPassBase<
- OptimizeSharedMemoryPass> {
+ : public OptimizeSharedMemoryBase<OptimizeSharedMemoryPass> {
public:
- using OptimizeSharedMemoryPassBase::OptimizeSharedMemoryPassBase;
+ OptimizeSharedMemoryPass() = default;
void runOnOperation() override {
Operation *op = getOperation();
diff --git a/mlir/lib/Dialect/NVGPU/Transforms/PassDetail.h b/mlir/lib/Dialect/NVGPU/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..884a103543d77
--- /dev/null
+++ b/mlir/lib/Dialect/NVGPU/Transforms/PassDetail.h
@@ -0,0 +1,33 @@
+//===- PassDetail.h - NVGPU Pass class details -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+#ifndef DIALECT_NVGPU_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_NVGPU_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/IR/Dialect.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+namespace arith {
+class ArithmeticDialect;
+} // namespace arith
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+namespace vector {
+class VectorDialect;
+} // namespace vector
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/NVGPU/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_NVGPU_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp b/mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
index f81e8f919668a..961e11a62052a 100644
--- a/mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/Bufferize.cpp
@@ -6,27 +6,20 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-
-#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
+#include "PassDetail.h"
+#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_SCFBUFFERIZEPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::scf;
namespace {
-struct SCFBufferizePass : public impl::SCFBufferizePassBase<SCFBufferizePass> {
- using SCFBufferizePassBase::SCFBufferizePassBase;
-
+struct SCFBufferizePass : public SCFBufferizeBase<SCFBufferizePass> {
void runOnOperation() override {
auto func = getOperation();
auto *context = &getContext();
@@ -43,3 +36,7 @@ struct SCFBufferizePass : public impl::SCFBufferizePassBase<SCFBufferizePass> {
};
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createSCFBufferizePass() {
+ return std::make_unique<SCFBufferizePass>();
+}
diff --git a/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp b/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp
index 49eca8188e6d0..14eb075d8c897 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp
@@ -10,19 +10,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_SCFFORTOWHILELOOPPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace llvm;
using namespace mlir;
using scf::ForOp;
@@ -103,10 +98,7 @@ struct ForLoopLoweringPattern : public OpRewritePattern<ForOp> {
}
};
-struct SCFForToWhileLoopPass
- : public impl::SCFForToWhileLoopPassBase<SCFForToWhileLoopPass> {
- using SCFForToWhileLoopPassBase::SCFForToWhileLoopPassBase;
-
+struct ForToWhileLoop : public SCFForToWhileLoopBase<ForToWhileLoop> {
void runOnOperation() override {
auto *parentOp = getOperation();
MLIRContext *ctx = parentOp->getContext();
@@ -116,3 +108,7 @@ struct SCFForToWhileLoopPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createForToWhileLoopPass() {
+ return std::make_unique<ForToWhileLoop>();
+}
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp
index 7324be31a34c3..0797dc20fc0f5 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp
@@ -11,11 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
@@ -23,11 +23,6 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/TypeSwitch.h"
-namespace mlir {
-#define GEN_PASS_DEF_SCFFORLOOPCANONICALIZATIONPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::scf;
@@ -197,11 +192,8 @@ struct AffineOpSCFCanonicalizationPattern : public OpRewritePattern<OpTy> {
}
};
-struct SCFForLoopCanonicalizationPass
- : public impl::SCFForLoopCanonicalizationPassBase<
- SCFForLoopCanonicalizationPass> {
- using SCFForLoopCanonicalizationPassBase::SCFForLoopCanonicalizationPassBase;
-
+struct SCFForLoopCanonicalization
+ : public SCFForLoopCanonicalizationBase<SCFForLoopCanonicalization> {
void runOnOperation() override {
auto *parentOp = getOperation();
MLIRContext *ctx = parentOp->getContext();
@@ -223,3 +215,7 @@ void mlir::scf::populateSCFForLoopCanonicalizationPatterns(
DimOfLoopResultFolder<tensor::DimOp>,
DimOfLoopResultFolder<memref::DimOp>>(ctx);
}
+
+std::unique_ptr<Pass> mlir::createSCFForLoopCanonicalizationPass() {
+ return std::make_unique<SCFForLoopCanonicalization>();
+}
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
index 7a162dce81935..c1d04afa920d5 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SCF/Transforms/Patterns.h"
@@ -18,7 +19,6 @@
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Support/MathExtras.h"
-#include "llvm/ADT/MapVector.h"
using namespace mlir;
using namespace mlir::scf;
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp
index 7c3b03d54e533..c5aabe9bb2983 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopRangeFolding.cpp
@@ -10,32 +10,25 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
#include "mlir/IR/BlockAndValueMapping.h"
-namespace mlir {
-#define GEN_PASS_DEF_SCFFORLOOPRANGEFOLDINGPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::scf;
namespace {
-struct SCFForLoopRangeFoldingPass
- : public impl::SCFForLoopRangeFoldingPassBase<SCFForLoopRangeFoldingPass> {
- using SCFForLoopRangeFoldingPassBase::SCFForLoopRangeFoldingPassBase;
-
+struct ForLoopRangeFolding
+ : public SCFForLoopRangeFoldingBase<ForLoopRangeFolding> {
void runOnOperation() override;
};
} // namespace
-void SCFForLoopRangeFoldingPass::runOnOperation() {
+void ForLoopRangeFolding::runOnOperation() {
getOperation()->walk([&](ForOp op) {
Value indVar = op.getInductionVar();
@@ -87,3 +80,7 @@ void SCFForLoopRangeFoldingPass::runOnOperation() {
}
});
}
+
+std::unique_ptr<Pass> mlir::createForLoopRangeFoldingPass() {
+ return std::make_unique<ForLoopRangeFolding>();
+}
diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
index 97d222cd2f7da..3778bb9a04edc 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
@@ -11,12 +11,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
@@ -26,13 +26,6 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/DenseMap.h"
-namespace mlir {
-#define GEN_PASS_DEF_SCFFORLOOPPEELINGPASS
-#define GEN_PASS_DEF_SCFFORLOOPSPECIALIZATIONPASS
-#define GEN_PASS_DEF_SCFPARALLELLOOPSPECIALIZATIONPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using scf::ForOp;
using scf::ParallelOp;
@@ -241,32 +234,22 @@ struct ForLoopPeelingPattern : public OpRewritePattern<ForOp> {
} // namespace
namespace {
-struct SCFParallelLoopSpecializationPass
- : public impl::SCFParallelLoopSpecializationPassBase<
- SCFParallelLoopSpecializationPass> {
- using SCFParallelLoopSpecializationPassBase::
- SCFParallelLoopSpecializationPassBase;
-
+struct ParallelLoopSpecialization
+ : public SCFParallelLoopSpecializationBase<ParallelLoopSpecialization> {
void runOnOperation() override {
getOperation()->walk(
[](ParallelOp op) { specializeParallelLoopForUnrolling(op); });
}
};
-struct SCFForLoopSpecializationPass
- : public impl::SCFForLoopSpecializationPassBase<
- SCFForLoopSpecializationPass> {
- using SCFForLoopSpecializationPassBase::SCFForLoopSpecializationPassBase;
-
+struct ForLoopSpecialization
+ : public SCFForLoopSpecializationBase<ForLoopSpecialization> {
void runOnOperation() override {
getOperation()->walk([](ForOp op) { specializeForLoopForUnrolling(op); });
}
};
-struct SCFForLoopPeelingPass
- : public impl::SCFForLoopPeelingPassBase<SCFForLoopPeelingPass> {
- using SCFForLoopPeelingPassBase::SCFForLoopPeelingPassBase;
-
+struct ForLoopPeeling : public SCFForLoopPeelingBase<ForLoopPeeling> {
void runOnOperation() override {
auto *parentOp = getOperation();
MLIRContext *ctx = parentOp->getContext();
@@ -282,3 +265,15 @@ struct SCFForLoopPeelingPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createParallelLoopSpecializationPass() {
+ return std::make_unique<ParallelLoopSpecialization>();
+}
+
+std::unique_ptr<Pass> mlir::createForLoopSpecializationPass() {
+ return std::make_unique<ForLoopSpecialization>();
+}
+
+std::unique_ptr<Pass> mlir::createForLoopPeelingPass() {
+ return std::make_unique<ForLoopPeeling>();
+}
diff --git a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopCollapsing.cpp b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopCollapsing.cpp
index 9804b1ec362eb..3403cd55ae4f2 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopCollapsing.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopCollapsing.cpp
@@ -6,29 +6,21 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
#include "mlir/Transforms/RegionUtils.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_SCFPARALLELLOOPCOLLAPSINGPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "parallel-loop-collapsing"
using namespace mlir;
namespace {
-struct SCFParallelLoopCollapsingPass
- : public impl::SCFParallelLoopCollapsingPassBase<
- SCFParallelLoopCollapsingPass> {
- using SCFParallelLoopCollapsingPassBase::SCFParallelLoopCollapsingPassBase;
-
+struct ParallelLoopCollapsing
+ : public SCFParallelLoopCollapsingBase<ParallelLoopCollapsing> {
void runOnOperation() override {
Operation *module = getOperation();
@@ -47,3 +39,7 @@ struct SCFParallelLoopCollapsingPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createParallelLoopCollapsingPass() {
+ return std::make_unique<ParallelLoopCollapsing>();
+}
diff --git a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
index 035dc81197e6f..cab8b765661cf 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
@@ -10,20 +10,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/OpDefinition.h"
-namespace mlir {
-#define GEN_PASS_DEF_SCFPARALLELLOOPFUSIONPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::scf;
@@ -166,10 +161,8 @@ void mlir::scf::naivelyFuseParallelOps(Region ®ion) {
}
namespace {
-struct SCFParallelLoopFusionPass
- : public impl::SCFParallelLoopFusionPassBase<SCFParallelLoopFusionPass> {
- using SCFParallelLoopFusionPassBase::SCFParallelLoopFusionPassBase;
-
+struct ParallelLoopFusion
+ : public SCFParallelLoopFusionBase<ParallelLoopFusion> {
void runOnOperation() override {
getOperation()->walk([&](Operation *child) {
for (Region ®ion : child->getRegions())
@@ -178,3 +171,7 @@ struct SCFParallelLoopFusionPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createParallelLoopFusionPass() {
+ return std::make_unique<ParallelLoopFusion>();
+}
diff --git a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
index e30e6fc96d79b..942430588b771 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
@@ -10,19 +10,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SCF/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
+#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
-namespace mlir {
-#define GEN_PASS_DEF_SCFPARALLELLOOPTILINGPASS
-#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::scf;
@@ -185,9 +180,14 @@ mlir::scf::tileParallelLoop(ParallelOp op, ArrayRef<int64_t> tileSizes,
}
namespace {
-struct SCFParallelLoopTilingPass
- : public impl::SCFParallelLoopTilingPassBase<SCFParallelLoopTilingPass> {
- using SCFParallelLoopTilingPassBase::SCFParallelLoopTilingPassBase;
+struct ParallelLoopTiling
+ : public SCFParallelLoopTilingBase<ParallelLoopTiling> {
+ ParallelLoopTiling() = default;
+ explicit ParallelLoopTiling(ArrayRef<int64_t> tileSizes,
+ bool noMinMaxBounds = false) {
+ this->tileSizes = tileSizes;
+ this->noMinMaxBounds = noMinMaxBounds;
+ }
void runOnOperation() override {
auto *parentOp = getOperation();
@@ -201,3 +201,9 @@ struct SCFParallelLoopTilingPass
}
};
} // namespace
+
+std::unique_ptr<Pass>
+mlir::createParallelLoopTilingPass(ArrayRef<int64_t> tileSizes,
+ bool noMinMaxBounds) {
+ return std::make_unique<ParallelLoopTiling>(tileSizes, noMinMaxBounds);
+}
diff --git a/mlir/lib/Dialect/SCF/Transforms/PassDetail.h b/mlir/lib/Dialect/SCF/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..98109f7ff4cbc
--- /dev/null
+++ b/mlir/lib/Dialect/SCF/Transforms/PassDetail.h
@@ -0,0 +1,43 @@
+//===- PassDetail.h - Loop Pass class details -------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_SCF_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_SCF_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+// Forward declaration from Dialect.h
+template <typename ConcreteDialect>
+void registerDialect(DialectRegistry ®istry);
+
+class AffineDialect;
+
+namespace arith {
+class ArithmeticDialect;
+} // namespace arith
+
+namespace bufferization {
+class BufferizationDialect;
+} // namespace bufferization
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+namespace tensor {
+class TensorDialect;
+} // namespace tensor
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/SCF/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_SCF_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp b/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
index fb15fcb3579e2..e7408d9a8596b 100644
--- a/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "PassDetail.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SCF/Transforms/Passes.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp
index 57e393abe5cdb..7277e8491fb51 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp
@@ -6,28 +6,19 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVGLCanonicalization.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-namespace spirv {
-#define GEN_PASS_DEF_SPIRVCANONICALIZEGLPASS
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
-} // namespace spirv
-} // namespace mlir
-
using namespace mlir;
namespace {
-class SPIRVCanonicalizeGLPass final
- : public spirv::impl::SPIRVCanonicalizeGLPassBase<SPIRVCanonicalizeGLPass> {
+class CanonicalizeGLPass final
+ : public SPIRVCanonicalizeGLBase<CanonicalizeGLPass> {
public:
- using SPIRVCanonicalizeGLPassBase::SPIRVCanonicalizeGLPassBase;
-
void runOnOperation() override {
RewritePatternSet patterns(&getContext());
spirv::populateSPIRVGLCanonicalizationPatterns(patterns);
@@ -39,5 +30,5 @@ class SPIRVCanonicalizeGLPass final
} // namespace
std::unique_ptr<OperationPass<>> spirv::createCanonicalizeGLPass() {
- return std::make_unique<SPIRVCanonicalizeGLPass>();
+ return std::make_unique<CanonicalizeGLPass>();
}
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/DecorateCompositeTypeLayoutPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/DecorateCompositeTypeLayoutPass.cpp
index 863361f65b35d..dd958e522a262 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/DecorateCompositeTypeLayoutPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/DecorateCompositeTypeLayoutPass.cpp
@@ -13,23 +13,16 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
-namespace mlir {
-namespace spirv {
-#define GEN_PASS_DEF_SPIRVDECORATECOMPOSITETYPELAYOUTPASS
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
-} // namespace spirv
-} // namespace mlir
-
namespace {
class SPIRVGlobalVariableOpLayoutInfoDecoration
: public OpRewritePattern<spirv::GlobalVariableOp> {
@@ -105,17 +98,14 @@ static void populateSPIRVLayoutInfoPatterns(RewritePatternSet &patterns) {
}
namespace {
-class SPIRVDecorateCompositeTypeLayoutPass
- : public spirv::impl::SPIRVDecorateCompositeTypeLayoutPassBase<
- SPIRVDecorateCompositeTypeLayoutPass> {
- using SPIRVDecorateCompositeTypeLayoutPassBase::
- SPIRVDecorateCompositeTypeLayoutPassBase;
-
+class DecorateSPIRVCompositeTypeLayoutPass
+ : public SPIRVCompositeTypeLayoutBase<
+ DecorateSPIRVCompositeTypeLayoutPass> {
void runOnOperation() override;
};
} // namespace
-void SPIRVDecorateCompositeTypeLayoutPass::runOnOperation() {
+void DecorateSPIRVCompositeTypeLayoutPass::runOnOperation() {
auto module = getOperation();
RewritePatternSet patterns(module.getContext());
populateSPIRVLayoutInfoPatterns(patterns);
@@ -151,5 +141,5 @@ void SPIRVDecorateCompositeTypeLayoutPass::runOnOperation() {
std::unique_ptr<OperationPass<ModuleOp>>
mlir::spirv::createDecorateSPIRVCompositeTypeLayoutPass() {
- return std::make_unique<SPIRVDecorateCompositeTypeLayoutPass>();
+ return std::make_unique<DecorateSPIRVCompositeTypeLayoutPass>();
}
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
index ec9ae0b862a02..263f00ef1d863 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
@@ -11,22 +11,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/SetVector.h"
-namespace mlir {
-namespace spirv {
-#define GEN_PASS_DEF_SPIRVLOWERABIATTRIBUTESPASS
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
-} // namespace spirv
-} // namespace mlir
-
using namespace mlir;
/// Creates a global variable for an argument based on the ABI info.
@@ -171,11 +164,8 @@ class ProcessInterfaceVarABI final : public OpConversionPattern<spirv::FuncOp> {
};
/// Pass to implement the ABI information specified as attributes.
-class SPIRVLowerABIAttributesPass final
- : public spirv::impl::SPIRVLowerABIAttributesPassBase<
- SPIRVLowerABIAttributesPass> {
- using SPIRVLowerABIAttributesPassBase::SPIRVLowerABIAttributesPassBase;
-
+class LowerABIAttributesPass final
+ : public SPIRVLowerABIAttributesBase<LowerABIAttributesPass> {
void runOnOperation() override;
};
} // namespace
@@ -243,7 +233,7 @@ LogicalResult ProcessInterfaceVarABI::matchAndRewrite(
return success();
}
-void SPIRVLowerABIAttributesPass::runOnOperation() {
+void LowerABIAttributesPass::runOnOperation() {
// Uses the signature conversion methodology of the dialect conversion
// framework to implement the conversion.
spirv::ModuleOp module = getOperation();
@@ -301,5 +291,5 @@ void SPIRVLowerABIAttributesPass::runOnOperation() {
std::unique_ptr<OperationPass<spirv::ModuleOp>>
mlir::spirv::createLowerABIAttributesPass() {
- return std::make_unique<SPIRVLowerABIAttributesPass>();
+ return std::make_unique<LowerABIAttributesPass>();
}
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/PassDetail.h b/mlir/lib/Dialect/SPIRV/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..15f5c54d38f17
--- /dev/null
+++ b/mlir/lib/Dialect/SPIRV/Transforms/PassDetail.h
@@ -0,0 +1,26 @@
+//===- PassDetail.h - SPIRV Pass class details ------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_SPIRV_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_SPIRV_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/IR/BuiltinOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+namespace spirv {
+class ModuleOp;
+} // namespace spirv
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_SPIRV_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
index 2d6ba8b9524c3..c381ee545121e 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
@@ -12,30 +12,21 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
-namespace mlir {
-namespace spirv {
-#define GEN_PASS_DEF_SPIRVREWRITEINSERTSPASS
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
-} // namespace spirv
-} // namespace mlir
-
using namespace mlir;
namespace {
/// Replaces sequential chains of `spirv::CompositeInsertOp` operation into
/// `spirv::CompositeConstructOp` operation if possible.
-class SPIRVRewriteInsertsPass
- : public spirv::impl::SPIRVRewriteInsertsPassBase<SPIRVRewriteInsertsPass> {
+class RewriteInsertsPass
+ : public SPIRVRewriteInsertsPassBase<RewriteInsertsPass> {
public:
- using SPIRVRewriteInsertsPassBase::SPIRVRewriteInsertsPassBase;
-
void runOnOperation() override;
private:
@@ -49,7 +40,7 @@ class SPIRVRewriteInsertsPass
} // namespace
-void SPIRVRewriteInsertsPass::runOnOperation() {
+void RewriteInsertsPass::runOnOperation() {
SmallVector<SmallVector<spirv::CompositeInsertOp, 4>, 4> workList;
getOperation().walk([this, &workList](spirv::CompositeInsertOp op) {
SmallVector<spirv::CompositeInsertOp, 4> insertions;
@@ -83,7 +74,7 @@ void SPIRVRewriteInsertsPass::runOnOperation() {
}
}
-LogicalResult SPIRVRewriteInsertsPass::collectInsertionChain(
+LogicalResult RewriteInsertsPass::collectInsertionChain(
spirv::CompositeInsertOp op,
SmallVectorImpl<spirv::CompositeInsertOp> &insertions) {
auto indicesArrayAttr = op.indices().cast<ArrayAttr>();
@@ -120,5 +111,5 @@ LogicalResult SPIRVRewriteInsertsPass::collectInsertionChain(
std::unique_ptr<mlir::OperationPass<spirv::ModuleOp>>
mlir::spirv::createRewriteInsertsPass() {
- return std::make_unique<SPIRVRewriteInsertsPass>();
+ return std::make_unique<RewriteInsertsPass>();
}
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
index 194258d084059..8299fd05cda96 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/UnifyAliasedResourcePass.cpp
@@ -11,11 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
@@ -27,13 +27,6 @@
#include <algorithm>
#include <iterator>
-namespace mlir {
-namespace spirv {
-#define GEN_PASS_DEF_SPIRVUNIFYALIASEDRESOURCEPASS
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
-} // namespace spirv
-} // namespace mlir
-
#define DEBUG_TYPE "spirv-unify-aliased-resource"
using namespace mlir;
@@ -527,17 +520,14 @@ struct ConvertStore : public ConvertAliasResource<spirv::StoreOp> {
//===----------------------------------------------------------------------===//
namespace {
-class SPIRVUnifyAliasedResourcePass final
- : public spirv::impl::SPIRVUnifyAliasedResourcePassBase<
- SPIRVUnifyAliasedResourcePass> {
+class UnifyAliasedResourcePass final
+ : public SPIRVUnifyAliasedResourcePassBase<UnifyAliasedResourcePass> {
public:
- using SPIRVUnifyAliasedResourcePassBase::SPIRVUnifyAliasedResourcePassBase;
-
void runOnOperation() override;
};
} // namespace
-void SPIRVUnifyAliasedResourcePass::runOnOperation() {
+void UnifyAliasedResourcePass::runOnOperation() {
spirv::ModuleOp moduleOp = getOperation();
MLIRContext *context = &getContext();
@@ -572,5 +562,5 @@ void SPIRVUnifyAliasedResourcePass::runOnOperation() {
std::unique_ptr<mlir::OperationPass<spirv::ModuleOp>>
spirv::createUnifyAliasedResourcePass() {
- return std::make_unique<SPIRVUnifyAliasedResourcePass>();
+ return std::make_unique<UnifyAliasedResourcePass>();
}
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
index 3bab93e1ce84e..3232c984b290a 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/UpdateVCEPass.cpp
@@ -11,34 +11,24 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/IR/TargetAndABI.h"
+#include "mlir/Dialect/SPIRV/Transforms/Passes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/Visitors.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
-namespace mlir {
-namespace spirv {
-#define GEN_PASS_DEF_SPIRVUPDATEVCEPASS
-#include "mlir/Dialect/SPIRV/Transforms/Passes.h.inc"
-} // namespace spirv
-} // namespace mlir
-
using namespace mlir;
namespace {
/// Pass to deduce minimal version/extension/capability requirements for a
/// spirv::ModuleOp.
-class SPIRVUpdateVCEPass final
- : public spirv::impl::SPIRVUpdateVCEPassBase<SPIRVUpdateVCEPass> {
- using SPIRVUpdateVCEPassBase::SPIRVUpdateVCEPassBase;
-
+class UpdateVCEPass final : public SPIRVUpdateVCEBase<UpdateVCEPass> {
void runOnOperation() override;
};
} // namespace
@@ -99,7 +89,7 @@ static LogicalResult checkAndUpdateCapabilityRequirements(
return success();
}
-void SPIRVUpdateVCEPass::runOnOperation() {
+void UpdateVCEPass::runOnOperation() {
spirv::ModuleOp module = getOperation();
spirv::TargetEnvAttr targetAttr = spirv::lookupTargetEnv(module);
@@ -189,5 +179,5 @@ void SPIRVUpdateVCEPass::runOnOperation() {
std::unique_ptr<OperationPass<spirv::ModuleOp>>
mlir::spirv::createUpdateVersionCapabilityExtensionPass() {
- return std::make_unique<SPIRVUpdateVCEPass>();
+ return std::make_unique<UpdateVCEPass>();
}
diff --git a/mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
index 11ea8d2abaafd..373552801673c 100644
--- a/mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Shape/Transforms/Bufferize.cpp
@@ -6,28 +6,21 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Shape/Transforms/Passes.h"
-
+#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
-#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
#include "mlir/Dialect/Shape/Transforms/BufferizableOpInterfaceImpl.h"
+#include "mlir/Dialect/Shape/Transforms/Passes.h"
#include "mlir/Pass/Pass.h"
-namespace mlir {
-#define GEN_PASS_DEF_SHAPEBUFFERIZEPASS
-#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace bufferization;
namespace {
-struct ShapeBufferizePass
- : public impl::ShapeBufferizePassBase<ShapeBufferizePass> {
+struct ShapeBufferizePass : public ShapeBufferizeBase<ShapeBufferizePass> {
void runOnOperation() override {
BufferizationOptions options = getPartialBufferizationOptions();
options.opFilter.allowDialect<shape::ShapeDialect>();
diff --git a/mlir/lib/Dialect/Shape/Transforms/PassDetail.h b/mlir/lib/Dialect/Shape/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..2856871f8b5e3
--- /dev/null
+++ b/mlir/lib/Dialect/Shape/Transforms/PassDetail.h
@@ -0,0 +1,30 @@
+//===- PassDetail.h - Shape Pass class details ------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_SHAPE_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_SHAPE_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+namespace bufferization {
+class BufferizationDialect;
+} // namespace bufferization
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_SHAPE_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp b/mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp
index 042543da1871f..9375be93f6d87 100644
--- a/mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp
+++ b/mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp
@@ -6,18 +6,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Shape/Transforms/Passes.h"
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
+#include "mlir/Dialect/Shape/Transforms/Passes.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_REMOVESHAPECONSTRAINTSPASS
-#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -46,9 +40,8 @@ class RemoveCstrEqOp : public OpRewritePattern<shape::CstrEqOp> {
};
/// Removal pass.
-struct RemoveShapeConstraintsPass
- : public impl::RemoveShapeConstraintsPassBase<RemoveShapeConstraintsPass> {
- using RemoveShapeConstraintsPassBase::RemoveShapeConstraintsPassBase;
+class RemoveShapeConstraintsPass
+ : public RemoveShapeConstraintsBase<RemoveShapeConstraintsPass> {
void runOnOperation() override {
MLIRContext &ctx = getContext();
diff --git a/mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp b/mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp
index ca3f7c591daf9..4179e604b2202 100644
--- a/mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp
+++ b/mlir/lib/Dialect/Shape/Transforms/ShapeToShapeLowering.cpp
@@ -6,21 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Shape/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Shape/IR/Shape.h"
+#include "mlir/Dialect/Shape/Transforms/Passes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-#define GEN_PASS_DEF_SHAPETOSHAPELOWERINGPASS
-#include "mlir/Dialect/Shape/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::shape;
@@ -58,15 +52,13 @@ NumElementsOpConverter::matchAndRewrite(NumElementsOp op,
}
namespace {
-struct ShapeToShapeLoweringPass
- : public impl::ShapeToShapeLoweringPassBase<ShapeToShapeLoweringPass> {
- using ShapeToShapeLoweringPassBase::ShapeToShapeLoweringPassBase;
-
+struct ShapeToShapeLowering
+ : public ShapeToShapeLoweringBase<ShapeToShapeLowering> {
void runOnOperation() override;
};
} // namespace
-void ShapeToShapeLoweringPass::runOnOperation() {
+void ShapeToShapeLowering::runOnOperation() {
MLIRContext &ctx = getContext();
RewritePatternSet patterns(&ctx);
@@ -85,5 +77,5 @@ void mlir::populateShapeRewritePatterns(RewritePatternSet &patterns) {
}
std::unique_ptr<Pass> mlir::createShapeToShapeLowering() {
- return std::make_unique<ShapeToShapeLoweringPass>();
+ return std::make_unique<ShapeToShapeLowering>();
}
diff --git a/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp b/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
index 3362c7b133608..f9abd72aeb83d 100644
--- a/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp
@@ -68,10 +68,10 @@ void mlir::sparse_tensor::buildSparseCompiler(
// it to this pipeline.
pm.addNestedPass<func::FuncOp>(createConvertLinalgToLoopsPass());
pm.addNestedPass<func::FuncOp>(createConvertVectorToSCFPass());
- pm.addNestedPass<func::FuncOp>(createConvertSCFToControlFlowPass());
- pm.addPass(createConvertAffineToStandardPass());
+ pm.addNestedPass<func::FuncOp>(createConvertSCFToCFPass());
+ pm.addPass(createLowerAffinePass());
pm.addPass(createConvertVectorToLLVMPass(options.lowerVectorToLLVMOptions()));
- pm.addPass(createConvertMemRefToLLVMPass());
+ pm.addPass(createMemRefToLLVMPass());
pm.addNestedPass<func::FuncOp>(createConvertComplexToStandardPass());
pm.addNestedPass<mlir::func::FuncOp>(
mlir::arith::createArithmeticExpandOpsPass());
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
index 6df546269157c..643cff9844492 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp
@@ -20,24 +20,23 @@
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-#define GEN_PASS_DEF_SPARSIFICATIONPASS
-#define GEN_PASS_DEF_SPARSETENSORCONVERSIONPASS
-#define GEN_PASS_DEF_SPARSETENSORCODEGENPASS
-#include "mlir/Dialect/SparseTensor/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::sparse_tensor;
namespace {
+//===----------------------------------------------------------------------===//
+// Passes declaration.
+//===----------------------------------------------------------------------===//
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/SparseTensor/Transforms/Passes.h.inc"
+
//===----------------------------------------------------------------------===//
// Passes implementation.
//===----------------------------------------------------------------------===//
-struct SparsificationPass
- : public mlir::impl::SparsificationPassBase<SparsificationPass> {
+struct SparsificationPass : public SparsificationBase<SparsificationPass> {
SparsificationPass() = default;
SparsificationPass(const SparsificationPass &pass) = default;
@@ -69,8 +68,7 @@ struct SparsificationPass
};
struct SparseTensorConversionPass
- : public mlir::impl::SparseTensorConversionPassBase<
- SparseTensorConversionPass> {
+ : public SparseTensorConversionBase<SparseTensorConversionPass> {
SparseTensorConversionPass() = default;
SparseTensorConversionPass(const SparseTensorConversionPass &pass) = default;
@@ -147,7 +145,7 @@ struct SparseTensorConversionPass
};
struct SparseTensorCodegenPass
- : public mlir::impl::SparseTensorCodegenPassBase<SparseTensorCodegenPass> {
+ : public SparseTensorCodegenBase<SparseTensorCodegenPass> {
SparseTensorCodegenPass() = default;
SparseTensorCodegenPass(const SparseTensorCodegenPass &pass) = default;
diff --git a/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
index bab753fd493c9..caf3f0f42e4a4 100644
--- a/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Tensor/Transforms/Bufferize.cpp
@@ -11,10 +11,10 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
+#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
@@ -23,21 +23,11 @@
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/Transforms/DialectConversion.h"
-namespace mlir {
-namespace tensor {
-#define GEN_PASS_DEF_TENSORBUFFERIZEPASS
-#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
-} // namespace tensor
-} // namespace mlir
-
using namespace mlir;
using namespace bufferization;
namespace {
-struct TensorBufferizePass
- : public tensor::impl::TensorBufferizePassBase<TensorBufferizePass> {
- using TensorBufferizePassBase::TensorBufferizePassBase;
-
+struct TensorBufferizePass : public TensorBufferizeBase<TensorBufferizePass> {
void runOnOperation() override {
BufferizationOptions options = getPartialBufferizationOptions();
options.opFilter.allowDialect<tensor::TensorDialect>();
@@ -54,3 +44,7 @@ struct TensorBufferizePass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::createTensorBufferizePass() {
+ return std::make_unique<TensorBufferizePass>();
+}
diff --git a/mlir/lib/Dialect/Tensor/Transforms/PassDetail.h b/mlir/lib/Dialect/Tensor/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..033372b0533bc
--- /dev/null
+++ b/mlir/lib/Dialect/Tensor/Transforms/PassDetail.h
@@ -0,0 +1,34 @@
+//===- PassDetail.h - GPU Pass class details --------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_TENSOR_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_TENSOR_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+namespace bufferization {
+class BufferizationDialect;
+} // namespace bufferization
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+namespace scf {
+class SCFDialect;
+} // namespace scf
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Tensor/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_TENSOR_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
index 4b975a244d08f..b3238904e793f 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp
@@ -11,11 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Tosa/Transforms/Passes.h"
-
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
+#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/Dialect/Tosa/Utils/ShapeUtils.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/IR/Builders.h"
@@ -26,13 +26,6 @@
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/Support/FormatVariadic.h"
-namespace mlir {
-namespace tosa {
-#define GEN_PASS_DEF_TOSAINFERSHAPESPASS
-#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
-} // namespace tosa
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::tosa;
@@ -282,11 +275,8 @@ void propagateShapesInRegion(Region ®ion) {
/// Pass that performs shape propagation across TOSA operations. This includes
/// migrating to within the regions of if/while operations.
-struct TosaInferShapesPass
- : public tosa::impl::TosaInferShapesPassBase<TosaInferShapesPass> {
+struct TosaInferShapes : public TosaInferShapesBase<TosaInferShapes> {
public:
- using TosaInferShapesPassBase::TosaInferShapesPassBase;
-
void runOnOperation() override {
func::FuncOp func = getOperation();
@@ -330,3 +320,7 @@ struct TosaInferShapesPass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::tosa::createTosaInferShapesPass() {
+ return std::make_unique<TosaInferShapes>();
+}
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
index 593c21bf4e236..aed8ff5302e51 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
@@ -10,20 +10,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Tosa/Transforms/Passes.h"
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
+#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-namespace tosa {
-#define GEN_PASS_DEF_TOSALAYERWISECONSTANTFOLDPASS
-#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
-} // namespace tosa
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::tosa;
@@ -43,10 +35,7 @@ void populateTosaOpsCanonicalizationPatterns(MLIRContext *ctx,
}
struct TosaLayerwiseConstantFoldPass
- : public tosa::impl::TosaLayerwiseConstantFoldPassBase<
- TosaLayerwiseConstantFoldPass> {
- using TosaLayerwiseConstantFoldPassBase::TosaLayerwiseConstantFoldPassBase;
-
+ : public TosaLayerwiseConstantFoldPassBase<TosaLayerwiseConstantFoldPass> {
void runOnOperation() override {
auto *ctx = &getContext();
RewritePatternSet patterns(ctx);
@@ -61,3 +50,7 @@ struct TosaLayerwiseConstantFoldPass
};
} // namespace
+
+std::unique_ptr<Pass> mlir::tosa::createTosaLayerwiseConstantFoldPass() {
+ return std::make_unique<TosaLayerwiseConstantFoldPass>();
+}
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
index 54e587ba3ffed..61f601456f0f1 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
@@ -10,21 +10,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
-#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/IR//TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-namespace tosa {
-#define GEN_PASS_DEF_TOSAMAKEBROADCASTABLEPASS
-#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
-} // namespace tosa
-} // namespace mlir
-
using namespace mlir;
using namespace mlir::tosa;
@@ -238,12 +231,9 @@ struct ConvertTosaOp<tosa::ArithmeticRightShiftOp>
namespace {
/// Pass that enables broadcast by making all input arrays have the same
/// number of dimensions. Insert RESHAPE operations to lower rank operand
-struct TosaMakeBroadcastablePass
- : public tosa::impl::TosaMakeBroadcastablePassBase<
- TosaMakeBroadcastablePass> {
+struct TosaMakeBroadcastable
+ : public TosaMakeBroadcastableBase<TosaMakeBroadcastable> {
public:
- using TosaMakeBroadcastablePassBase::TosaMakeBroadcastablePassBase;
-
void runOnOperation() override {
auto func = getOperation();
RewritePatternSet patterns(func.getContext());
@@ -272,3 +262,7 @@ struct TosaMakeBroadcastablePass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::tosa::createTosaMakeBroadcastablePass() {
+ return std::make_unique<TosaMakeBroadcastable>();
+}
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp
index b6c5b4ff5d3f0..78b8cb3084afd 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp
@@ -12,29 +12,18 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Tosa/Transforms/Passes.h"
-
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
+#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-namespace mlir {
-namespace tosa {
-#define GEN_PASS_DEF_TOSAOPTIONALDECOMPOSITIONSPASS
-#include "mlir/Dialect/Tosa/Transforms/Passes.h.inc"
-} // namespace tosa
-} // namespace mlir
-
using namespace mlir;
namespace {
-struct TosaOptionalDecompositionsPass
- : public tosa::impl::TosaOptionalDecompositionsPassBase<
- TosaOptionalDecompositionsPass> {
- using TosaOptionalDecompositionsPassBase::TosaOptionalDecompositionsPassBase;
-
+struct TosaOptionalDecompositions
+ : public TosaOptionalDecompositionsBase<TosaOptionalDecompositions> {
void runOnOperation() override {
auto *ctx = &getContext();
RewritePatternSet patterns(ctx);
@@ -50,3 +39,7 @@ struct TosaOptionalDecompositionsPass
};
} // namespace
+
+std::unique_ptr<Pass> mlir::tosa::createTosaOptionalDecompositions() {
+ return std::make_unique<TosaOptionalDecompositions>();
+}
diff --git a/mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp b/mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp
index b49b9638201ab..f70e2b6475aab 100644
--- a/mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp
+++ b/mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp
@@ -11,20 +11,12 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Transform/Transforms/Passes.h"
-
#include "mlir/Dialect/Transform/IR/TransformInterfaces.h"
+#include "mlir/Dialect/Transform/Transforms/Passes.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/SetOperations.h"
-namespace mlir {
-namespace transform {
-#define GEN_PASS_DEF_CHECKUSESPASS
-#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
-} // namespace transform
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -369,12 +361,13 @@ class TransformOpMemFreeAnalysis {
DenseMap<Block *, llvm::SmallPtrSet<Block *, 4>> reachableFromCache;
};
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
+
//// A simple pass that warns about any use of a value by a transform operation
// that may be using the value after it has been freed.
-class CheckUsesPass : public transform::impl::CheckUsesPassBase<CheckUsesPass> {
+class CheckUsesPass : public CheckUsesBase<CheckUsesPass> {
public:
- using CheckUsesPassBase::CheckUsesPassBase;
-
void runOnOperation() override {
auto &analysis = getAnalysis<TransformOpMemFreeAnalysis>();
@@ -398,3 +391,11 @@ class CheckUsesPass : public transform::impl::CheckUsesPassBase<CheckUsesPass> {
};
} // namespace
+
+namespace mlir {
+namespace transform {
+std::unique_ptr<Pass> createCheckUsesPass() {
+ return std::make_unique<CheckUsesPass>();
+}
+} // namespace transform
+} // namespace mlir
diff --git a/mlir/lib/Dialect/Vector/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Vector/Transforms/Bufferize.cpp
index 3de6e75a7669a..f98eeda1bde53 100644
--- a/mlir/lib/Dialect/Vector/Transforms/Bufferize.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/Bufferize.cpp
@@ -11,31 +11,20 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
-
+#include "PassDetail.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.h"
#include "mlir/Dialect/Vector/Transforms/Passes.h"
-namespace mlir {
-namespace vector {
-#define GEN_PASS_DEF_VECTORBUFFERIZEPASS
-#include "mlir/Dialect/Vector/Transforms/Passes.h.inc"
-} // namespace vector
-} // namespace mlir
-
using namespace mlir;
using namespace bufferization;
namespace {
-struct VectorBufferizePass
- : public vector::impl::VectorBufferizePassBase<VectorBufferizePass> {
- using VectorBufferizePassBase::VectorBufferizePassBase;
-
+struct VectorBufferizePass : public VectorBufferizeBase<VectorBufferizePass> {
void runOnOperation() override {
BufferizationOptions options = getPartialBufferizationOptions();
options.opFilter.allowDialect<vector::VectorDialect>();
@@ -51,3 +40,7 @@ struct VectorBufferizePass
}
};
} // namespace
+
+std::unique_ptr<Pass> mlir::vector::createVectorBufferizePass() {
+ return std::make_unique<VectorBufferizePass>();
+}
diff --git a/mlir/lib/Dialect/Vector/Transforms/PassDetail.h b/mlir/lib/Dialect/Vector/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..305aae47e5bb4
--- /dev/null
+++ b/mlir/lib/Dialect/Vector/Transforms/PassDetail.h
@@ -0,0 +1,30 @@
+//===- PassDetail.h - Vector Pass class details -----------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef DIALECT_VECTOR_TRANSFORMS_PASSDETAIL_H_
+#define DIALECT_VECTOR_TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Pass/Pass.h"
+
+namespace mlir {
+
+namespace bufferization {
+class BufferizationDialect;
+} // namespace bufferization
+
+namespace memref {
+class MemRefDialect;
+} // namespace memref
+
+#define GEN_PASS_CLASSES
+#include "mlir/Dialect/Vector/Transforms/Passes.h.inc"
+
+} // namespace mlir
+
+#endif // DIALECT_VECTOR_TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Reducer/OptReductionPass.cpp b/mlir/lib/Reducer/OptReductionPass.cpp
index 21fb19ddd1481..a7f09b4c923f6 100644
--- a/mlir/lib/Reducer/OptReductionPass.cpp
+++ b/mlir/lib/Reducer/OptReductionPass.cpp
@@ -14,23 +14,18 @@
#include "mlir/Pass/PassManager.h"
#include "mlir/Pass/PassRegistry.h"
+#include "mlir/Reducer/PassDetail.h"
#include "mlir/Reducer/Passes.h"
#include "mlir/Reducer/Tester.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_OPTREDUCTIONPASS
-#include "mlir/Reducer/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "mlir-reduce"
using namespace mlir;
namespace {
-class OptReductionPass
- : public mlir::impl::OptReductionPassBase<OptReductionPass> {
+class OptReductionPass : public OptReductionBase<OptReductionPass> {
public:
/// Runs the pass instance in the pass pipeline.
void runOnOperation() override;
diff --git a/mlir/lib/Reducer/ReductionTreePass.cpp b/mlir/lib/Reducer/ReductionTreePass.cpp
index f542317871094..05f0f749166ed 100644
--- a/mlir/lib/Reducer/ReductionTreePass.cpp
+++ b/mlir/lib/Reducer/ReductionTreePass.cpp
@@ -16,6 +16,7 @@
#include "mlir/IR/DialectInterface.h"
#include "mlir/IR/OpDefinition.h"
+#include "mlir/Reducer/PassDetail.h"
#include "mlir/Reducer/Passes.h"
#include "mlir/Reducer/ReductionNode.h"
#include "mlir/Reducer/ReductionPatternInterface.h"
@@ -28,11 +29,6 @@
#include "llvm/Support/Allocator.h"
#include "llvm/Support/ManagedStatic.h"
-namespace mlir {
-#define GEN_PASS_DEF_REDUCTIONTREEPASS
-#include "mlir/Reducer/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
/// We implicitly number each operation in the region and if an operation's
@@ -187,8 +183,7 @@ class ReductionPatternInterfaceCollection
/// This class defines the Reduction Tree Pass. It provides a framework to
/// to implement a reduction pass using a tree structure to keep track of the
/// generated reduced variants.
-class ReductionTreePass
- : public mlir::impl::ReductionTreePassBase<ReductionTreePass> {
+class ReductionTreePass : public ReductionTreeBase<ReductionTreePass> {
public:
ReductionTreePass() = default;
ReductionTreePass(const ReductionTreePass &pass) = default;
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp
index 6f6c308614e0d..783a2260275d1 100644
--- a/mlir/lib/Transforms/CSE.cpp
+++ b/mlir/lib/Transforms/CSE.cpp
@@ -11,11 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/IR/Dominance.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/Pass.h"
+#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/ScopedHashTable.h"
@@ -23,11 +23,6 @@
#include "llvm/Support/RecyclingAllocator.h"
#include <deque>
-namespace mlir {
-#define GEN_PASS_DEF_CSEPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
@@ -58,9 +53,7 @@ struct SimpleOperationInfo : public llvm::DenseMapInfo<Operation *> {
namespace {
/// Simple common sub-expression elimination.
-struct CSEPass : public impl::CSEPassBase<CSEPass> {
- using CSEPassBase::CSEPassBase;
-
+struct CSE : public CSEBase<CSE> {
/// Shared implementation of operation elimination and scoped map definitions.
using AllocatorTy = llvm::RecyclingAllocator<
llvm::BumpPtrAllocator,
@@ -115,8 +108,8 @@ struct CSEPass : public impl::CSEPassBase<CSEPass> {
};
} // namespace
-void CSEPass::replaceUsesAndDelete(ScopedMapTy &knownValues, Operation *op,
- Operation *existing, bool hasSSADominance) {
+void CSE::replaceUsesAndDelete(ScopedMapTy &knownValues, Operation *op,
+ Operation *existing, bool hasSSADominance) {
// If we find one then replace all uses of the current operation with the
// existing one and mark it for deletion. We can only replace an operand in
// an operation if it has not been visited yet.
@@ -149,8 +142,7 @@ void CSEPass::replaceUsesAndDelete(ScopedMapTy &knownValues, Operation *op,
++numCSE;
}
-bool CSEPass::hasOtherSideEffectingOpInBetween(Operation *fromOp,
- Operation *toOp) {
+bool CSE::hasOtherSideEffectingOpInBetween(Operation *fromOp, Operation *toOp) {
assert(fromOp->getBlock() == toOp->getBlock());
assert(
isa<MemoryEffectOpInterface>(fromOp) &&
@@ -191,8 +183,8 @@ bool CSEPass::hasOtherSideEffectingOpInBetween(Operation *fromOp,
}
/// Attempt to eliminate a redundant operation.
-LogicalResult CSEPass::simplifyOperation(ScopedMapTy &knownValues,
- Operation *op, bool hasSSADominance) {
+LogicalResult CSE::simplifyOperation(ScopedMapTy &knownValues, Operation *op,
+ bool hasSSADominance) {
// Don't simplify terminator operations.
if (op->hasTrait<OpTrait::IsTerminator>())
return failure();
@@ -247,8 +239,8 @@ LogicalResult CSEPass::simplifyOperation(ScopedMapTy &knownValues,
return failure();
}
-void CSEPass::simplifyBlock(ScopedMapTy &knownValues, Block *bb,
- bool hasSSADominance) {
+void CSE::simplifyBlock(ScopedMapTy &knownValues, Block *bb,
+ bool hasSSADominance) {
for (auto &op : *bb) {
// If the operation is simplified, we don't process any held regions.
if (succeeded(simplifyOperation(knownValues, &op, hasSSADominance)))
@@ -276,7 +268,7 @@ void CSEPass::simplifyBlock(ScopedMapTy &knownValues, Block *bb,
memEffectsCache.clear();
}
-void CSEPass::simplifyRegion(ScopedMapTy &knownValues, Region ®ion) {
+void CSE::simplifyRegion(ScopedMapTy &knownValues, Region ®ion) {
// If the region is empty there is nothing to do.
if (region.empty())
return;
@@ -331,7 +323,7 @@ void CSEPass::simplifyRegion(ScopedMapTy &knownValues, Region ®ion) {
}
}
-void CSEPass::runOnOperation() {
+void CSE::runOnOperation() {
/// A scoped hash table of defining operations within a region.
ScopedMapTy knownValues;
@@ -355,3 +347,5 @@ void CSEPass::runOnOperation() {
markAnalysesPreserved<DominanceInfo, PostDominanceInfo>();
domInfo = nullptr;
}
+
+std::unique_ptr<Pass> mlir::createCSEPass() { return std::make_unique<CSE>(); }
diff --git a/mlir/lib/Transforms/Canonicalizer.cpp b/mlir/lib/Transforms/Canonicalizer.cpp
index 40000a22cbbcb..3f6dbe933b2cb 100644
--- a/mlir/lib/Transforms/Canonicalizer.cpp
+++ b/mlir/lib/Transforms/Canonicalizer.cpp
@@ -11,26 +11,20 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_CANONICALIZERPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
+#include "mlir/Transforms/Passes.h"
using namespace mlir;
namespace {
/// Canonicalize operations in nested regions.
-struct CanonicalizerPass
- : public impl::CanonicalizerPassBase<CanonicalizerPass> {
- CanonicalizerPass() = default;
- CanonicalizerPass(const GreedyRewriteConfig &config,
- ArrayRef<std::string> disabledPatterns,
- ArrayRef<std::string> enabledPatterns) {
+struct Canonicalizer : public CanonicalizerBase<Canonicalizer> {
+ Canonicalizer() = default;
+ Canonicalizer(const GreedyRewriteConfig &config,
+ ArrayRef<std::string> disabledPatterns,
+ ArrayRef<std::string> enabledPatterns) {
this->topDownProcessingEnabled = config.useTopDownTraversal;
this->enableRegionSimplification = config.enableRegionSimplification;
this->maxIterations = config.maxIterations;
@@ -65,7 +59,7 @@ struct CanonicalizerPass
/// Create a Canonicalizer pass.
std::unique_ptr<Pass> mlir::createCanonicalizerPass() {
- return std::make_unique<CanonicalizerPass>();
+ return std::make_unique<Canonicalizer>();
}
/// Creates an instance of the Canonicalizer pass with the specified config.
@@ -73,6 +67,6 @@ std::unique_ptr<Pass>
mlir::createCanonicalizerPass(const GreedyRewriteConfig &config,
ArrayRef<std::string> disabledPatterns,
ArrayRef<std::string> enabledPatterns) {
- return std::make_unique<CanonicalizerPass>(config, disabledPatterns,
- enabledPatterns);
+ return std::make_unique<Canonicalizer>(config, disabledPatterns,
+ enabledPatterns);
}
diff --git a/mlir/lib/Transforms/ControlFlowSink.cpp b/mlir/lib/Transforms/ControlFlowSink.cpp
index 960a0352ac159..5b0cfc269511a 100644
--- a/mlir/lib/Transforms/ControlFlowSink.cpp
+++ b/mlir/lib/Transforms/ControlFlowSink.cpp
@@ -13,32 +13,24 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/IR/Dominance.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Transforms/ControlFlowSinkUtils.h"
+#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/SideEffectUtils.h"
-namespace mlir {
-#define GEN_PASS_DEF_CONTROLFLOWSINKPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// A control-flow sink pass.
-struct ControlFlowSinkPass
- : public impl::ControlFlowSinkPassBase<ControlFlowSinkPass> {
- using ControlFlowSinkPassBase::ControlFlowSinkPassBase;
-
+struct ControlFlowSink : public ControlFlowSinkBase<ControlFlowSink> {
void runOnOperation() override;
};
} // end anonymous namespace
-void ControlFlowSinkPass::runOnOperation() {
+void ControlFlowSink::runOnOperation() {
auto &domInfo = getAnalysis<DominanceInfo>();
getOperation()->walk([&](RegionBranchOpInterface branch) {
SmallVector<Region *> regionsToSink;
@@ -56,3 +48,7 @@ void ControlFlowSinkPass::runOnOperation() {
});
});
}
+
+std::unique_ptr<Pass> mlir::createControlFlowSinkPass() {
+ return std::make_unique<ControlFlowSink>();
+}
diff --git a/mlir/lib/Transforms/Inliner.cpp b/mlir/lib/Transforms/Inliner.cpp
index c4633c06384f6..5ce32b14185ed 100644
--- a/mlir/lib/Transforms/Inliner.cpp
+++ b/mlir/lib/Transforms/Inliner.cpp
@@ -13,8 +13,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Analysis/CallGraph.h"
#include "mlir/IR/Threading.h"
#include "mlir/Interfaces/CallInterfaces.h"
@@ -22,14 +21,10 @@
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/DebugStringHelper.h"
#include "mlir/Transforms/InliningUtils.h"
+#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/Support/Debug.h"
-namespace mlir {
-#define GEN_PASS_DEF_INLINERPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
#define DEBUG_TYPE "inlining"
using namespace mlir;
@@ -587,7 +582,7 @@ static LogicalResult inlineCallsInSCC(Inliner &inliner, CGUseList &useList,
//===----------------------------------------------------------------------===//
namespace {
-class InlinerPass : public impl::InlinerPassBase<InlinerPass> {
+class InlinerPass : public InlinerBase<InlinerPass> {
public:
InlinerPass();
InlinerPass(const InlinerPass &) = default;
diff --git a/mlir/lib/Transforms/LocationSnapshot.cpp b/mlir/lib/Transforms/LocationSnapshot.cpp
index c0d23cc985d24..a042d07335bbc 100644
--- a/mlir/lib/Transforms/LocationSnapshot.cpp
+++ b/mlir/lib/Transforms/LocationSnapshot.cpp
@@ -7,19 +7,13 @@
//===----------------------------------------------------------------------===//
#include "mlir/Transforms/LocationSnapshot.h"
-
+#include "PassDetail.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Builders.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/FileUtilities.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ToolOutputFile.h"
-namespace mlir {
-#define GEN_PASS_DEF_LOCATIONSNAPSHOTPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
/// This function generates new locations from the given IR by snapshotting the
@@ -129,7 +123,7 @@ LogicalResult mlir::generateLocationsFromIR(StringRef fileName, StringRef tag,
namespace {
struct LocationSnapshotPass
- : public impl::LocationSnapshotPassBase<LocationSnapshotPass> {
+ : public LocationSnapshotBase<LocationSnapshotPass> {
LocationSnapshotPass() = default;
LocationSnapshotPass(OpPrintingFlags flags, StringRef fileName, StringRef tag)
: flags(flags) {
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
index a0f738b12efbb..35e0f48b2958f 100644
--- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
+++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
@@ -10,34 +10,30 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
+#include "mlir/Transforms/Passes.h"
#include "mlir/Transforms/SideEffectUtils.h"
-namespace mlir {
-#define GEN_PASS_DEF_LOOPINVARIANTCODEMOTIONPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
/// Loop invariant code motion (LICM) pass.
-struct LoopInvariantCodeMotionPass
- : public impl::LoopInvariantCodeMotionPassBase<
- LoopInvariantCodeMotionPass> {
- using LoopInvariantCodeMotionPassBase::LoopInvariantCodeMotionPassBase;
-
+struct LoopInvariantCodeMotion
+ : public LoopInvariantCodeMotionBase<LoopInvariantCodeMotion> {
void runOnOperation() override;
};
} // namespace
-void LoopInvariantCodeMotionPass::runOnOperation() {
+void LoopInvariantCodeMotion::runOnOperation() {
// Walk through all loops in a function in innermost-loop-first order. This
// way, we first LICM from the inner loop, and place the ops in
// the outer loop, which in turn can be further LICM'ed.
getOperation()->walk(
[&](LoopLikeOpInterface loopLike) { moveLoopInvariantCode(loopLike); });
}
+
+std::unique_ptr<Pass> mlir::createLoopInvariantCodeMotionPass() {
+ return std::make_unique<LoopInvariantCodeMotion>();
+}
diff --git a/mlir/lib/Transforms/OpStats.cpp b/mlir/lib/Transforms/OpStats.cpp
index ac5fec1371655..d02cb8a3c8952 100644
--- a/mlir/lib/Transforms/OpStats.cpp
+++ b/mlir/lib/Transforms/OpStats.cpp
@@ -6,24 +6,19 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/OperationSupport.h"
+#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
-namespace mlir {
-#define GEN_PASS_DEF_PRINTOPSTATSPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
-struct PrintOpStatsPass : public impl::PrintOpStatsPassBase<PrintOpStatsPass> {
+struct PrintOpStatsPass : public PrintOpStatsBase<PrintOpStatsPass> {
explicit PrintOpStatsPass(raw_ostream &os) : os(os) {}
explicit PrintOpStatsPass(raw_ostream &os, bool printAsJSON) : os(os) {
diff --git a/mlir/lib/Transforms/PassDetail.h b/mlir/lib/Transforms/PassDetail.h
new file mode 100644
index 0000000000000..7c1f53929fe45
--- /dev/null
+++ b/mlir/lib/Transforms/PassDetail.h
@@ -0,0 +1,21 @@
+//===- PassDetail.h - Transforms Pass class details -------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TRANSFORMS_PASSDETAIL_H_
+#define TRANSFORMS_PASSDETAIL_H_
+
+#include "mlir/Pass/Pass.h"
+#include "mlir/Pass/PassManager.h"
+#include "mlir/Transforms/Passes.h"
+
+namespace mlir {
+#define GEN_PASS_CLASSES
+#include "mlir/Transforms/Passes.h.inc"
+} // namespace mlir
+
+#endif // TRANSFORMS_PASSDETAIL_H_
diff --git a/mlir/lib/Transforms/SCCP.cpp b/mlir/lib/Transforms/SCCP.cpp
index 37de046e6c6ff..a0a06352a0e80 100644
--- a/mlir/lib/Transforms/SCCP.cpp
+++ b/mlir/lib/Transforms/SCCP.cpp
@@ -14,8 +14,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h"
#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
#include "mlir/IR/Builders.h"
@@ -23,11 +22,7 @@
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/FoldUtils.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_SCCPPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
+#include "mlir/Transforms/Passes.h"
using namespace mlir;
using namespace mlir::dataflow;
@@ -114,14 +109,12 @@ static void rewrite(DataFlowSolver &solver, MLIRContext *context,
//===----------------------------------------------------------------------===//
namespace {
-struct SCCPPass : public impl::SCCPPassBase<SCCPPass> {
- using SCCPPassBase::SCCPPassBase;
-
+struct SCCP : public SCCPBase<SCCP> {
void runOnOperation() override;
};
} // namespace
-void SCCPPass::runOnOperation() {
+void SCCP::runOnOperation() {
Operation *op = getOperation();
DataFlowSolver solver;
@@ -131,3 +124,7 @@ void SCCPPass::runOnOperation() {
return signalPassFailure();
rewrite(solver, op->getContext(), op->getRegions());
}
+
+std::unique_ptr<Pass> mlir::createSCCPPass() {
+ return std::make_unique<SCCP>();
+}
diff --git a/mlir/lib/Transforms/StripDebugInfo.cpp b/mlir/lib/Transforms/StripDebugInfo.cpp
index 63cfaf9e81530..99e11517b7e09 100644
--- a/mlir/lib/Transforms/StripDebugInfo.cpp
+++ b/mlir/lib/Transforms/StripDebugInfo.cpp
@@ -6,29 +6,21 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Operation.h"
#include "mlir/Pass/Pass.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_STRIPDEBUGINFOPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
+#include "mlir/Transforms/Passes.h"
using namespace mlir;
namespace {
-struct StripDebugInfoPass
- : public impl::StripDebugInfoPassBase<StripDebugInfoPass> {
- using StripDebugInfoPassBase::StripDebugInfoPassBase;
-
+struct StripDebugInfo : public StripDebugInfoBase<StripDebugInfo> {
void runOnOperation() override;
};
} // namespace
-void StripDebugInfoPass::runOnOperation() {
+void StripDebugInfo::runOnOperation() {
auto unknownLoc = UnknownLoc::get(&getContext());
// Strip the debug info from all operations.
@@ -44,3 +36,8 @@ void StripDebugInfoPass::runOnOperation() {
}
});
}
+
+/// Creates a pass to strip debug information from a function.
+std::unique_ptr<Pass> mlir::createStripDebugInfoPass() {
+ return std::make_unique<StripDebugInfo>();
+}
diff --git a/mlir/lib/Transforms/SymbolDCE.cpp b/mlir/lib/Transforms/SymbolDCE.cpp
index a96aa12afb6b3..c197f5025c46e 100644
--- a/mlir/lib/Transforms/SymbolDCE.cpp
+++ b/mlir/lib/Transforms/SymbolDCE.cpp
@@ -11,21 +11,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/IR/SymbolTable.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_SYMBOLDCEPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
+#include "mlir/Transforms/Passes.h"
using namespace mlir;
namespace {
-struct SymbolDCEPass : public impl::SymbolDCEPassBase<SymbolDCEPass> {
- using SymbolDCEPassBase::SymbolDCEPassBase;
-
+struct SymbolDCE : public SymbolDCEBase<SymbolDCE> {
void runOnOperation() override;
/// Compute the liveness of the symbols within the given symbol table.
@@ -38,7 +31,7 @@ struct SymbolDCEPass : public impl::SymbolDCEPassBase<SymbolDCEPass> {
};
} // namespace
-void SymbolDCEPass::runOnOperation() {
+void SymbolDCE::runOnOperation() {
Operation *symbolTableOp = getOperation();
// SymbolDCE should only be run on operations that define a symbol table.
@@ -82,9 +75,10 @@ void SymbolDCEPass::runOnOperation() {
/// Compute the liveness of the symbols within the given symbol table.
/// `symbolTableIsHidden` is true if this symbol table is known to be
/// unaccessible from operations in its parent regions.
-LogicalResult SymbolDCEPass::computeLiveness(
- Operation *symbolTableOp, SymbolTableCollection &symbolTable,
- bool symbolTableIsHidden, DenseSet<Operation *> &liveSymbols) {
+LogicalResult SymbolDCE::computeLiveness(Operation *symbolTableOp,
+ SymbolTableCollection &symbolTable,
+ bool symbolTableIsHidden,
+ DenseSet<Operation *> &liveSymbols) {
// A worklist of live operations to propagate uses from.
SmallVector<Operation *, 16> worklist;
@@ -146,3 +140,7 @@ LogicalResult SymbolDCEPass::computeLiveness(
return success();
}
+
+std::unique_ptr<Pass> mlir::createSymbolDCEPass() {
+ return std::make_unique<SymbolDCE>();
+}
diff --git a/mlir/lib/Transforms/SymbolPrivatize.cpp b/mlir/lib/Transforms/SymbolPrivatize.cpp
index 28342a3cfef32..4aa7897da0ade 100644
--- a/mlir/lib/Transforms/SymbolPrivatize.cpp
+++ b/mlir/lib/Transforms/SymbolPrivatize.cpp
@@ -11,21 +11,15 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/IR/SymbolTable.h"
-
-namespace mlir {
-#define GEN_PASS_DEF_SYMBOLPRIVATIZEPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
+#include "mlir/Transforms/Passes.h"
using namespace mlir;
namespace {
-struct SymbolPrivatizePass
- : public impl::SymbolPrivatizePassBase<SymbolPrivatizePass> {
- explicit SymbolPrivatizePass(ArrayRef<std::string> excludeSymbols);
+struct SymbolPrivatize : public SymbolPrivatizeBase<SymbolPrivatize> {
+ explicit SymbolPrivatize(ArrayRef<std::string> excludeSymbols);
LogicalResult initialize(MLIRContext *context) override;
void runOnOperation() override;
@@ -34,18 +28,17 @@ struct SymbolPrivatizePass
};
} // namespace
-SymbolPrivatizePass::SymbolPrivatizePass(
- llvm::ArrayRef<std::string> excludeSymbols) {
+SymbolPrivatize::SymbolPrivatize(llvm::ArrayRef<std::string> excludeSymbols) {
exclude = excludeSymbols;
}
-LogicalResult SymbolPrivatizePass::initialize(MLIRContext *context) {
+LogicalResult SymbolPrivatize::initialize(MLIRContext *context) {
for (const std::string &symbol : exclude)
excludedSymbols.insert(StringAttr::get(context, symbol));
return success();
}
-void SymbolPrivatizePass::runOnOperation() {
+void SymbolPrivatize::runOnOperation() {
for (Region ®ion : getOperation()->getRegions()) {
for (Block &block : region) {
for (Operation &op : block) {
@@ -61,5 +54,5 @@ void SymbolPrivatizePass::runOnOperation() {
std::unique_ptr<Pass>
mlir::createSymbolPrivatizePass(ArrayRef<std::string> exclude) {
- return std::make_unique<SymbolPrivatizePass>(exclude);
+ return std::make_unique<SymbolPrivatize>(exclude);
}
diff --git a/mlir/lib/Transforms/TopologicalSort.cpp b/mlir/lib/Transforms/TopologicalSort.cpp
index 69e81b8f4397c..afa0b78fbf255 100644
--- a/mlir/lib/Transforms/TopologicalSort.cpp
+++ b/mlir/lib/Transforms/TopologicalSort.cpp
@@ -6,23 +6,14 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Transforms/Passes.h"
-
+#include "PassDetail.h"
#include "mlir/IR/RegionKindInterface.h"
#include "mlir/Transforms/TopologicalSortUtils.h"
-namespace mlir {
-#define GEN_PASS_DEF_TOPOLOGICALSORTPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
namespace {
-struct TopologicalSortPass
- : public impl::TopologicalSortPassBase<TopologicalSortPass> {
- using TopologicalSortPassBase::TopologicalSortPassBase;
-
+struct TopologicalSortPass : public TopologicalSortBase<TopologicalSortPass> {
void runOnOperation() override {
// Topologically sort the regions of the operation without SSA dominance.
getOperation()->walk([](RegionKindInterface op) {
@@ -36,3 +27,7 @@ struct TopologicalSortPass
}
};
} // end anonymous namespace
+
+std::unique_ptr<Pass> mlir::createTopologicalSortPass() {
+ return std::make_unique<TopologicalSortPass>();
+}
diff --git a/mlir/lib/Transforms/ViewOpGraph.cpp b/mlir/lib/Transforms/ViewOpGraph.cpp
index 7a0ed4bdc91a1..1cd0164f6dd39 100644
--- a/mlir/lib/Transforms/ViewOpGraph.cpp
+++ b/mlir/lib/Transforms/ViewOpGraph.cpp
@@ -7,22 +7,15 @@
//===----------------------------------------------------------------------===//
#include "mlir/Transforms/ViewOpGraph.h"
-
+#include "PassDetail.h"
#include "mlir/IR/Block.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Operation.h"
-#include "mlir/Pass/Pass.h"
#include "mlir/Support/IndentedOstream.h"
-#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/GraphWriter.h"
#include <utility>
-namespace mlir {
-#define GEN_PASS_DEF_VIEWOPGRAPHPASS
-#include "mlir/Transforms/Passes.h.inc"
-} // namespace mlir
-
using namespace mlir;
static const StringRef kLineStyleControlFlow = "dashed";
@@ -79,11 +72,10 @@ struct Node {
/// This pass generates a Graphviz dataflow visualization of an MLIR operation.
/// Note: See https://www.graphviz.org/doc/info/lang.html for more information
/// about the Graphviz DOT language.
-class ViewOpGraphPass : public impl::ViewOpGraphPassBase<ViewOpGraphPass> {
+class PrintOpPass : public ViewOpGraphBase<PrintOpPass> {
public:
- ViewOpGraphPass(raw_ostream &os) : os(os) {}
- ViewOpGraphPass(const ViewOpGraphPass &o)
- : ViewOpGraphPass(o.os.getOStream()) {}
+ PrintOpPass(raw_ostream &os) : os(os) {}
+ PrintOpPass(const PrintOpPass &o) : PrintOpPass(o.os.getOStream()) {}
void runOnOperation() override {
emitGraph([&]() {
@@ -322,8 +314,8 @@ class ViewOpGraphPass : public impl::ViewOpGraphPassBase<ViewOpGraphPass> {
} // namespace
-std::unique_ptr<Pass> mlir::createViewOpGraphPass(raw_ostream &os) {
- return std::make_unique<ViewOpGraphPass>(os);
+std::unique_ptr<Pass> mlir::createPrintOpGraphPass(raw_ostream &os) {
+ return std::make_unique<PrintOpPass>(os);
}
/// Generate a CFG for a region and show it in a window.
@@ -336,7 +328,7 @@ static void llvmViewGraph(Region ®ion, const Twine &name) {
llvm::errs() << "error opening file '" << filename << "' for writing\n";
return;
}
- ViewOpGraphPass pass(os);
+ PrintOpPass pass(os);
pass.emitRegionCFG(region);
}
llvm::DisplayGraph(filename, /*wait=*/false, llvm::GraphProgram::DOT);
diff --git a/mlir/test/CAPI/execution_engine.c b/mlir/test/CAPI/execution_engine.c
index a9eb97c4ad646..60171db018fac 100644
--- a/mlir/test/CAPI/execution_engine.c
+++ b/mlir/test/CAPI/execution_engine.c
@@ -34,9 +34,9 @@ void lowerModuleToLLVM(MlirContext ctx, MlirModule module) {
MlirPassManager pm = mlirPassManagerCreate(ctx);
MlirOpPassManager opm = mlirPassManagerGetNestedUnder(
pm, mlirStringRefCreateFromCString("func.func"));
- mlirPassManagerAddOwnedPass(pm, mlirCreateConversionConvertFuncToLLVMPass());
- mlirOpPassManagerAddOwnedPass(
- opm, mlirCreateConversionConvertArithmeticToLLVMPass());
+ mlirPassManagerAddOwnedPass(pm, mlirCreateConversionConvertFuncToLLVM());
+ mlirOpPassManagerAddOwnedPass(opm,
+ mlirCreateConversionConvertArithmeticToLLVM());
MlirLogicalResult status = mlirPassManagerRun(pm, module);
if (mlirLogicalResultIsFailure(status)) {
fprintf(stderr, "Unexpected failure running pass pipeline\n");
diff --git a/mlir/test/CAPI/pass.c b/mlir/test/CAPI/pass.c
index cdbf98222cdb0..e48045ac15720 100644
--- a/mlir/test/CAPI/pass.c
+++ b/mlir/test/CAPI/pass.c
@@ -54,7 +54,7 @@ void testRunPassOnModule() {
// CHECK: func.return , 1
{
MlirPassManager pm = mlirPassManagerCreate(ctx);
- MlirPass printOpStatPass = mlirCreateTransformsPrintOpStatsPass();
+ MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
mlirPassManagerAddOwnedPass(pm, printOpStatPass);
MlirLogicalResult success = mlirPassManagerRun(pm, module);
if (mlirLogicalResultIsFailure(success)) {
@@ -98,7 +98,7 @@ void testRunPassOnNestedModule() {
MlirPassManager pm = mlirPassManagerCreate(ctx);
MlirOpPassManager nestedFuncPm = mlirPassManagerGetNestedUnder(
pm, mlirStringRefCreateFromCString("func.func"));
- MlirPass printOpStatPass = mlirCreateTransformsPrintOpStatsPass();
+ MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass);
MlirLogicalResult success = mlirPassManagerRun(pm, module);
if (mlirLogicalResultIsFailure(success))
@@ -116,7 +116,7 @@ void testRunPassOnNestedModule() {
pm, mlirStringRefCreateFromCString("builtin.module"));
MlirOpPassManager nestedFuncPm = mlirOpPassManagerGetNestedUnder(
nestedModulePm, mlirStringRefCreateFromCString("func.func"));
- MlirPass printOpStatPass = mlirCreateTransformsPrintOpStatsPass();
+ MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass);
MlirLogicalResult success = mlirPassManagerRun(pm, module);
if (mlirLogicalResultIsFailure(success))
@@ -141,7 +141,7 @@ void testPrintPassPipeline() {
pm, mlirStringRefCreateFromCString("builtin.module"));
MlirOpPassManager nestedFuncPm = mlirOpPassManagerGetNestedUnder(
nestedModulePm, mlirStringRefCreateFromCString("func.func"));
- MlirPass printOpStatPass = mlirCreateTransformsPrintOpStatsPass();
+ MlirPass printOpStatPass = mlirCreateTransformsPrintOpStats();
mlirOpPassManagerAddOwnedPass(nestedFuncPm, printOpStatPass);
// Print the top level pass manager
@@ -184,7 +184,7 @@ void testParsePassPipeline() {
exit(EXIT_FAILURE);
}
// Try again after registrating the pass.
- mlirRegisterTransformsPrintOpStatsPass();
+ mlirRegisterTransformsPrintOpStats();
status = mlirParsePassPipeline(
mlirPassManagerGetAsOpPassManager(pm),
mlirStringRefCreateFromCString(
diff --git a/mlir/test/Pass/ir-printing.mlir b/mlir/test/Pass/ir-printing.mlir
index 874fe568c04ae..bd506c2c7ebda 100644
--- a/mlir/test/Pass/ir-printing.mlir
+++ b/mlir/test/Pass/ir-printing.mlir
@@ -15,53 +15,53 @@ func.func @bar() {
return
}
-// BEFORE: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
+// BEFORE: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
// BEFORE-NEXT: func @foo()
-// BEFORE: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
+// BEFORE: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
// BEFORE-NEXT: func @bar()
-// BEFORE-NOT: // -----// IR Dump Before{{.*}}CanonicalizerPass (canonicalize) //----- //
+// BEFORE-NOT: // -----// IR Dump Before{{.*}}Canonicalizer (canonicalize) //----- //
// BEFORE-NOT: // -----// IR Dump After
-// BEFORE_ALL: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
+// BEFORE_ALL: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
// BEFORE_ALL-NEXT: func @foo()
-// BEFORE_ALL: // -----// IR Dump Before{{.*}}CanonicalizerPass (canonicalize) //----- //
+// BEFORE_ALL: // -----// IR Dump Before{{.*}}Canonicalizer (canonicalize) //----- //
// BEFORE_ALL-NEXT: func @foo()
-// BEFORE_ALL: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
+// BEFORE_ALL: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
// BEFORE_ALL-NEXT: func @bar()
-// BEFORE_ALL: // -----// IR Dump Before{{.*}}CanonicalizerPass (canonicalize) //----- //
+// BEFORE_ALL: // -----// IR Dump Before{{.*}}Canonicalizer (canonicalize) //----- //
// BEFORE_ALL-NEXT: func @bar()
// BEFORE_ALL-NOT: // -----// IR Dump After
// AFTER-NOT: // -----// IR Dump Before
-// AFTER: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
+// AFTER: // -----// IR Dump After{{.*}}CSE (cse) //----- //
// AFTER-NEXT: func @foo()
-// AFTER: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
+// AFTER: // -----// IR Dump After{{.*}}CSE (cse) //----- //
// AFTER-NEXT: func @bar()
-// AFTER-NOT: // -----// IR Dump After{{.*}}CanonicalizerPass (canonicalize) //----- //
+// AFTER-NOT: // -----// IR Dump After{{.*}}Canonicalizer (canonicalize) //----- //
// AFTER_ALL-NOT: // -----// IR Dump Before
-// AFTER_ALL: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
+// AFTER_ALL: // -----// IR Dump After{{.*}}CSE (cse) //----- //
// AFTER_ALL-NEXT: func @foo()
-// AFTER_ALL: // -----// IR Dump After{{.*}}CanonicalizerPass (canonicalize) //----- //
+// AFTER_ALL: // -----// IR Dump After{{.*}}Canonicalizer (canonicalize) //----- //
// AFTER_ALL-NEXT: func @foo()
-// AFTER_ALL: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
+// AFTER_ALL: // -----// IR Dump After{{.*}}CSE (cse) //----- //
// AFTER_ALL-NEXT: func @bar()
-// AFTER_ALL: // -----// IR Dump After{{.*}}CanonicalizerPass (canonicalize) //----- //
+// AFTER_ALL: // -----// IR Dump After{{.*}}Canonicalizer (canonicalize) //----- //
// AFTER_ALL-NEXT: func @bar()
-// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSEPass (cse) ('func.func' operation: @foo) //----- //
+// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSE (cse) ('func.func' operation: @foo) //----- //
// BEFORE_MODULE: func @foo()
// BEFORE_MODULE: func @bar()
-// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSEPass (cse) ('func.func' operation: @bar) //----- //
+// BEFORE_MODULE: // -----// IR Dump Before{{.*}}CSE (cse) ('func.func' operation: @bar) //----- //
// BEFORE_MODULE: func @foo()
// BEFORE_MODULE: func @bar()
-// AFTER_ALL_CHANGE: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
+// AFTER_ALL_CHANGE: // -----// IR Dump After{{.*}}CSE (cse) //----- //
// AFTER_ALL_CHANGE-NEXT: func @foo()
-// AFTER_ALL_CHANGE-NOT: // -----// IR Dump After{{.*}}CSEPass (cse) //----- //
+// AFTER_ALL_CHANGE-NOT: // -----// IR Dump After{{.*}}CSE (cse) //----- //
// We expect that only 'foo' changed during CSE, and the second run of CSE did
// nothing.
-// AFTER_FAILURE-NOT: // -----// IR Dump After{{.*}}CSEPass
+// AFTER_FAILURE-NOT: // -----// IR Dump After{{.*}}CSE
// AFTER_FAILURE: // -----// IR Dump After{{.*}}TestFailurePass Failed (test-pass-failure) //----- //
// AFTER_FAILURE: func @foo()
diff --git a/mlir/test/Pass/run-reproducer.mlir b/mlir/test/Pass/run-reproducer.mlir
index 31eb043376b5c..6627033d8be7d 100644
--- a/mlir/test/Pass/run-reproducer.mlir
+++ b/mlir/test/Pass/run-reproducer.mlir
@@ -18,9 +18,9 @@ func.func @bar() {
}
#-}
-// BEFORE: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
+// BEFORE: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
// BEFORE-NEXT: func @foo()
-// BEFORE: // -----// IR Dump Before{{.*}}CSEPass (cse) //----- //
+// BEFORE: // -----// IR Dump Before{{.*}}CSE (cse) //----- //
// BEFORE-NEXT: func @bar()
-// BEFORE-NOT: // -----// IR Dump Before{{.*}}CanonicalizerPass (canonicalize) //----- //
+// BEFORE-NOT: // -----// IR Dump Before{{.*}}Canonicalizer (canonicalize) //----- //
// BEFORE-NOT: // -----// IR Dump After
diff --git a/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp b/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
index beab4b18cecb6..ec103b75fa082 100644
--- a/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
+++ b/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp
@@ -10,9 +10,9 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
+#include "mlir/Dialect/Tosa/Transforms/PassDetail.h"
#include "mlir/Dialect/Tosa/Transforms/Passes.h"
#include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
#include "mlir/IR/BuiltinTypes.h"
diff --git a/mlir/tools/mlir-tblgen/PassCAPIGen.cpp b/mlir/tools/mlir-tblgen/PassCAPIGen.cpp
index 72275e756d4d1..34368635c171f 100644
--- a/mlir/tools/mlir-tblgen/PassCAPIGen.cpp
+++ b/mlir/tools/mlir-tblgen/PassCAPIGen.cpp
@@ -74,7 +74,7 @@ MlirPass mlirCreate{0}{1}() {
return wrap({2}.release());
}
void mlirRegister{0}{1}() {
- register{1}();
+ register{1}Pass();
}
)";
@@ -103,7 +103,7 @@ static bool emitCAPIImpl(const llvm::RecordKeeper &records, raw_ostream &os) {
constructorCall = constructor.str();
else
constructorCall =
- llvm::formatv("create{0}()", pass.getDef()->getName()).str();
+ llvm::formatv("create{0}Pass()", pass.getDef()->getName()).str();
os << llvm::formatv(passCreateDef, groupName, defName, constructorCall);
}
diff --git a/mlir/tools/mlir-tblgen/PassGen.cpp b/mlir/tools/mlir-tblgen/PassGen.cpp
index aaecaf0057c91..801db200fe7b1 100644
--- a/mlir/tools/mlir-tblgen/PassGen.cpp
+++ b/mlir/tools/mlir-tblgen/PassGen.cpp
@@ -27,6 +27,8 @@ static llvm::cl::opt<std::string>
groupName("name", llvm::cl::desc("The name of this group of passes"),
llvm::cl::cat(passGenCat));
+static void emitOldPassDecl(const Pass &pass, raw_ostream &os);
+
/// Extract the list of passes from the TableGen records.
static std::vector<Pass> getPasses(const llvm::RecordKeeper &recordKeeper) {
std::vector<Pass> passes;
@@ -354,6 +356,73 @@ static void emitPassDefs(const Pass &pass, raw_ostream &os) {
os << "#endif // " << enableVarName << "\n";
}
+// TODO drop old pass declarations
+// The old pass base class is being kept until all the passes have switched to
+// the new decls/defs design.
+const char *const oldPassDeclBegin = R"(
+template <typename DerivedT>
+class {0}Base : public {1} {
+public:
+ using Base = {0}Base;
+
+ {0}Base() : {1}(::mlir::TypeID::get<DerivedT>()) {{}
+ {0}Base(const {0}Base &other) : {1}(other) {{}
+
+ /// Returns the command-line argument attached to this pass.
+ static constexpr ::llvm::StringLiteral getArgumentName() {
+ return ::llvm::StringLiteral("{2}");
+ }
+ ::llvm::StringRef getArgument() const override { return "{2}"; }
+
+ ::llvm::StringRef getDescription() const override { return "{3}"; }
+
+ /// Returns the derived pass name.
+ static constexpr ::llvm::StringLiteral getPassName() {
+ return ::llvm::StringLiteral("{0}");
+ }
+ ::llvm::StringRef getName() const override { return "{0}"; }
+
+ /// Support isa/dyn_cast functionality for the derived pass class.
+ static bool classof(const ::mlir::Pass *pass) {{
+ return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
+ }
+
+ /// A clone method to create a copy of this pass.
+ std::unique_ptr<::mlir::Pass> clonePass() const override {{
+ return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
+ }
+
+ /// Return the dialect that must be loaded in the context before this pass.
+ void getDependentDialects(::mlir::DialectRegistry ®istry) const override {
+ {4}
+ }
+
+ /// Explicitly declare the TypeID for this class. We declare an explicit private
+ /// instantiation because Pass classes should only be visible by the current
+ /// library.
+ MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID({0}Base<DerivedT>)
+
+protected:
+)";
+
+/// Emit a backward-compatible declaration of the pass base class.
+static void emitOldPassDecl(const Pass &pass, raw_ostream &os) {
+ StringRef defName = pass.getDef()->getName();
+ std::string dependentDialectRegistrations;
+ {
+ llvm::raw_string_ostream dialectsOs(dependentDialectRegistrations);
+ for (StringRef dependentDialect : pass.getDependentDialects())
+ dialectsOs << llvm::formatv(dialectRegistrationTemplate,
+ dependentDialect);
+ }
+ os << llvm::formatv(oldPassDeclBegin, defName, pass.getBaseClass(),
+ pass.getArgument(), pass.getSummary(),
+ dependentDialectRegistrations);
+ emitPassOptionDecls(pass, os);
+ emitPassStatisticDecls(pass, os);
+ os << "};\n";
+}
+
static void emitPass(const Pass &pass, raw_ostream &os) {
StringRef passName = pass.getDef()->getName();
os << llvm::formatv(passHeader, passName);
@@ -371,6 +440,14 @@ static void emitPasses(const llvm::RecordKeeper &recordKeeper,
emitPass(pass, os);
emitRegistrations(passes, os);
+
+ // TODO: Drop old pass declarations.
+ // Emit the old code until all the passes have switched to the new design.
+ os << "#ifdef GEN_PASS_CLASSES\n";
+ for (const Pass &pass : passes)
+ emitOldPassDecl(pass, os);
+ os << "#undef GEN_PASS_CLASSES\n";
+ os << "#endif // GEN_PASS_CLASSES\n";
}
static mlir::GenRegistration
diff --git a/mlir/unittests/ExecutionEngine/Invoke.cpp b/mlir/unittests/ExecutionEngine/Invoke.cpp
index ff41a8bc6f689..60b5be6198ee6 100644
--- a/mlir/unittests/ExecutionEngine/Invoke.cpp
+++ b/mlir/unittests/ExecutionEngine/Invoke.cpp
@@ -53,8 +53,9 @@ static struct LLVMInitializer {
/// dialects lowering to LLVM Dialect.
static LogicalResult lowerToLLVMDialect(ModuleOp module) {
PassManager pm(module.getContext());
- pm.addPass(mlir::createConvertMemRefToLLVMPass());
- pm.addNestedPass<func::FuncOp>(mlir::createConvertArithmeticToLLVMPass());
+ pm.addPass(mlir::createMemRefToLLVMPass());
+ pm.addNestedPass<func::FuncOp>(
+ mlir::arith::createConvertArithmeticToLLVMPass());
pm.addPass(mlir::createConvertFuncToLLVMPass());
pm.addPass(mlir::createReconcileUnrealizedCastsPass());
return pm.run(module);
More information about the flang-commits
mailing list