diff options
69 files changed, 119 insertions, 133 deletions
diff --git a/mlir/examples/Linalg/Linalg1/include/linalg1/Passes.h b/mlir/examples/Linalg/Linalg1/include/linalg1/Passes.h index 0347e182a50..8be517db917 100644 --- a/mlir/examples/Linalg/Linalg1/include/linalg1/Passes.h +++ b/mlir/examples/Linalg/Linalg1/include/linalg1/Passes.h @@ -29,12 +29,11 @@ namespace mlir { class ModuleOp; template <typename T> class OpPassBase; -using ModulePassBase = OpPassBase<ModuleOp>; } // namespace mlir namespace linalg { -mlir::ModulePassBase *createLowerLinalgToLLVMPass(); +mlir::OpPassBase<mlir::ModuleOp> *createLowerLinalgToLLVMPass(); } // namespace linalg diff --git a/mlir/examples/Linalg/Linalg1/lib/ConvertToLLVMDialect.cpp b/mlir/examples/Linalg/Linalg1/lib/ConvertToLLVMDialect.cpp index 9073169b260..abbd9c95ac9 100644 --- a/mlir/examples/Linalg/Linalg1/lib/ConvertToLLVMDialect.cpp +++ b/mlir/examples/Linalg/Linalg1/lib/ConvertToLLVMDialect.cpp @@ -440,7 +440,7 @@ struct LowerLinalgToLLVMPass : public ModulePass<LowerLinalgToLLVMPass> { }; } // namespace -ModulePassBase *linalg::createLowerLinalgToLLVMPass() { +OpPassBase<ModuleOp> *linalg::createLowerLinalgToLLVMPass() { return new LowerLinalgToLLVMPass(); } diff --git a/mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h b/mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h index 849d65a6b6f..5381734721c 100644 --- a/mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h +++ b/mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h @@ -31,7 +31,6 @@ class Operation; class Value; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; } // namespace mlir namespace linalg { @@ -75,7 +74,8 @@ void lowerToLoops(mlir::FuncOp f); /// Creates a pass that rewrites linalg.load and linalg.store to affine.load and /// affine.store operations. -std::unique_ptr<mlir::FunctionPassBase> createLowerLinalgLoadStorePass(); +std::unique_ptr<mlir::OpPassBase<mlir::FuncOp>> +createLowerLinalgLoadStorePass(); } // namespace linalg diff --git a/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp b/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp index ce2656520fa..184f1da528f 100644 --- a/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp +++ b/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp @@ -300,6 +300,6 @@ Rewriter<linalg::StoreOp>::matchAndRewrite(linalg::StoreOp store, } } // namespace -std::unique_ptr<FunctionPassBase> linalg::createLowerLinalgLoadStorePass() { +std::unique_ptr<OpPassBase<FuncOp>> linalg::createLowerLinalgLoadStorePass() { return std::make_unique<LowerLinalgLoadStorePass>(); } diff --git a/mlir/include/mlir/Analysis/Passes.h b/mlir/include/mlir/Analysis/Passes.h index 8c947e6c222..b233ab5f209 100644 --- a/mlir/include/mlir/Analysis/Passes.h +++ b/mlir/include/mlir/Analysis/Passes.h @@ -24,21 +24,21 @@ #define MLIR_ANALYSIS_PASSES_H #include "mlir/Support/LLVM.h" +#include <memory> namespace mlir { class FuncOp; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; /// Creates a pass to check memref accesses in a Function. -FunctionPassBase *createMemRefBoundCheckPass(); +std::unique_ptr<OpPassBase<FuncOp>> createMemRefBoundCheckPass(); /// Creates a pass to check memref access dependences in a Function. -FunctionPassBase *createTestMemRefDependenceCheckPass(); +std::unique_ptr<OpPassBase<FuncOp>> createTestMemRefDependenceCheckPass(); /// Creates a pass to test parallelism detection; emits note for parallel loops. -FunctionPassBase *createParallelismDetectionTestPass(); +std::unique_ptr<OpPassBase<FuncOp>> createParallelismDetectionTestPass(); } // end namespace mlir diff --git a/mlir/include/mlir/Conversion/ControlFlowToCFG/ConvertControlFlowToCFG.h b/mlir/include/mlir/Conversion/ControlFlowToCFG/ConvertControlFlowToCFG.h index 56b0ed1d290..b6a29da3900 100644 --- a/mlir/include/mlir/Conversion/ControlFlowToCFG/ConvertControlFlowToCFG.h +++ b/mlir/include/mlir/Conversion/ControlFlowToCFG/ConvertControlFlowToCFG.h @@ -26,7 +26,6 @@ class FuncOp; struct LogicalResult; class MLIRContext; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; class RewritePattern; // Owning list of rewriting patterns. @@ -39,7 +38,7 @@ void populateLoopToStdConversionPatterns(OwningRewritePatternList &patterns, MLIRContext *ctx); /// Creates a pass to convert loop.for, loop.if and loop.terminator ops to CFG. -std::unique_ptr<FunctionPassBase> createLowerToCFGPass(); +std::unique_ptr<OpPassBase<FuncOp>> createLowerToCFGPass(); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h b/mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h index 8d5c5013599..161f68701d6 100644 --- a/mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h +++ b/mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h @@ -36,7 +36,6 @@ class LLVMDialect; } template <typename T> class OpPassBase; -using ModulePassBase = OpPassBase<ModuleOp>; using OwnedCubin = std::unique_ptr<std::vector<char>>; using CubinGenerator = std::function<OwnedCubin(const std::string &, FuncOp &)>; @@ -50,7 +49,7 @@ using CubinGenerator = std::function<OwnedCubin(const std::string &, FuncOp &)>; /// attached as a string attribute named 'nvvm.cubin' to the kernel function. /// After the transformation, the body of the kernel function is removed (i.e., /// it is turned into a declaration). -std::unique_ptr<ModulePassBase> +std::unique_ptr<OpPassBase<ModuleOp>> createConvertGPUKernelToCubinPass(CubinGenerator cubinGenerator); /// Creates a pass to convert a gpu.launch_func operation into a sequence of @@ -59,11 +58,12 @@ createConvertGPUKernelToCubinPass(CubinGenerator cubinGenerator); /// This pass does not generate code to call CUDA directly but instead uses a /// small wrapper library that exports a stable and conveniently typed ABI /// ontop of CUDA. -std::unique_ptr<ModulePassBase> createConvertGpuLaunchFuncToCudaCallsPass(); +std::unique_ptr<OpPassBase<ModuleOp>> +createConvertGpuLaunchFuncToCudaCallsPass(); /// Creates a pass to augment a module with getter functions for all contained /// cubins as encoded via the 'nvvm.cubin' attribute. -std::unique_ptr<ModulePassBase> createGenerateCubinAccessorPass(); +std::unique_ptr<OpPassBase<ModuleOp>> createGenerateCubinAccessorPass(); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h index 01e50baa592..9a15b41f7de 100644 --- a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h +++ b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h @@ -25,14 +25,13 @@ class OwningRewritePatternList; class ModuleOp; template <typename OpT> class OpPassBase; -using ModulePassBase = OpPassBase<ModuleOp>; /// Collect a set of patterns to convert from the GPU dialect to NVVM. void populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter, OwningRewritePatternList &patterns); /// Creates a pass that lowers GPU dialect operations to NVVM counterparts. -std::unique_ptr<ModulePassBase> createLowerGpuOpsToNVVMOpsPass(); +std::unique_ptr<OpPassBase<ModuleOp>> createLowerGpuOpsToNVVMOpsPass(); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h b/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h index 9ef21ea97b6..960a93dd566 100644 --- a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h +++ b/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h @@ -22,7 +22,6 @@ namespace mlir { class FuncOp; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; /// Create a pass that converts loop nests into GPU kernels. It considers /// top-level affine.for and linalg.for operations as roots of loop nests and @@ -32,7 +31,7 @@ using FunctionPassBase = OpPassBase<FuncOp>; /// parallelization is performed, it is under the responsibility of the caller /// to strip-mine the loops and to perform the dependence analysis before /// calling the conversion. -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> createSimpleLoopsToGPUPass(unsigned numBlockDims, unsigned numThreadDims); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h index 589571d0a46..98e105aa2b5 100644 --- a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h +++ b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h @@ -34,7 +34,6 @@ struct LogicalResult; class MLIRContext; class ModuleOp; template <typename T> class OpPassBase; -using ModulePassBase = OpPassBase<ModuleOp>; class RewritePattern; class Type; @@ -58,12 +57,12 @@ void populateStdToLLVMConversionPatterns(LLVMTypeConverter &converter, OwningRewritePatternList &patterns); /// Creates a pass to convert the Standard dialect into the LLVMIR dialect. -std::unique_ptr<ModulePassBase> createLowerToLLVMPass(); +std::unique_ptr<OpPassBase<ModuleOp>> createLowerToLLVMPass(); /// Creates a pass to convert operations to the LLVMIR dialect. The conversion /// is defined by a list of patterns and a type converter that will be obtained /// during the pass using the provided callbacks. -std::unique_ptr<ModulePassBase> +std::unique_ptr<OpPassBase<ModuleOp>> createLowerToLLVMPass(LLVMPatternListFiller patternListFiller, LLVMTypeConverterMaker typeConverterMaker); @@ -72,7 +71,7 @@ createLowerToLLVMPass(LLVMPatternListFiller patternListFiller, /// callback and an optional type conversion class, an instance is created /// during the pass. template <typename TypeConverter = LLVMTypeConverter> -std::unique_ptr<ModulePassBase> +std::unique_ptr<OpPassBase<ModuleOp>> createLowerToLLVMPass(LLVMPatternListFiller patternListFiller) { return createLowerToLLVMPass(patternListFiller, [](MLIRContext *context) { return std::make_unique<TypeConverter>(context); diff --git a/mlir/include/mlir/Conversion/VectorToLLVM/VectorToLLVM.h b/mlir/include/mlir/Conversion/VectorToLLVM/VectorToLLVM.h index c781858a672..34d783ae131 100644 --- a/mlir/include/mlir/Conversion/VectorToLLVM/VectorToLLVM.h +++ b/mlir/include/mlir/Conversion/VectorToLLVM/VectorToLLVM.h @@ -23,14 +23,13 @@ class ModuleOp; class OwningRewritePatternList; template <typename T> class OpPassBase; -using ModulePassBase = OpPassBase<ModuleOp>; /// Collect a set of patterns to convert from the Vector dialect to LLVM. void populateVectorToLLVMConversionPatterns(LLVMTypeConverter &converter, OwningRewritePatternList &patterns); /// Create a pass to convert vector operations to the LLVMIR dialect. -ModulePassBase *createLowerVectorToLLVMPass(); +OpPassBase<ModuleOp> *createLowerVectorToLLVMPass(); } // namespace mlir #endif // MLIR_CONVERSION_VECTORTOLLVM_VECTORTOLLVM_H_ diff --git a/mlir/include/mlir/Dialect/FxpMathOps/Passes.h b/mlir/include/mlir/Dialect/FxpMathOps/Passes.h index f4099ab7754..415b1c0b253 100644 --- a/mlir/include/mlir/Dialect/FxpMathOps/Passes.h +++ b/mlir/include/mlir/Dialect/FxpMathOps/Passes.h @@ -25,7 +25,6 @@ namespace mlir { class FuncOp; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; namespace fxpmath { @@ -33,11 +32,11 @@ namespace fxpmath { /// arithmetic. This will leave unrecognized real math ops as-is and is /// typically followed by a pass that lowers any unrecognized ops to a pure /// floating point form. -FunctionPassBase *createLowerUniformRealMathPass(); +OpPassBase<FuncOp> *createLowerUniformRealMathPass(); /// Creates a pass that lowers uniform-quantized qcast/dcast ops to equivalent /// operations that perform quantize/dequantize. -FunctionPassBase *createLowerUniformCastsPass(); +OpPassBase<FuncOp> *createLowerUniformCastsPass(); } // namespace fxpmath } // namespace mlir diff --git a/mlir/include/mlir/Dialect/GPU/Passes.h b/mlir/include/mlir/Dialect/GPU/Passes.h index 14a9f013c99..7c8ce02db90 100644 --- a/mlir/include/mlir/Dialect/GPU/Passes.h +++ b/mlir/include/mlir/Dialect/GPU/Passes.h @@ -28,9 +28,8 @@ namespace mlir { class ModuleOp; template <typename T> class OpPassBase; -using ModulePassBase = OpPassBase<ModuleOp>; -std::unique_ptr<ModulePassBase> createGpuKernelOutliningPass(); +std::unique_ptr<OpPassBase<ModuleOp>> createGpuKernelOutliningPass(); } // namespace mlir diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.h b/mlir/include/mlir/Dialect/Linalg/Passes.h index 118e278ef60..2b58df71a48 100644 --- a/mlir/include/mlir/Dialect/Linalg/Passes.h +++ b/mlir/include/mlir/Dialect/Linalg/Passes.h @@ -29,20 +29,18 @@ namespace mlir { class FuncOp; class ModuleOp; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; -using ModulePassBase = OpPassBase<ModuleOp>; namespace linalg { -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> createLinalgFusionPass(ArrayRef<int64_t> tileSizes = {}); -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> createLinalgTilingPass(ArrayRef<int64_t> tileSizes = {}, bool promoteViews = false); -std::unique_ptr<FunctionPassBase> createLowerLinalgToLoopsPass(); +std::unique_ptr<OpPassBase<FuncOp>> createLowerLinalgToLoopsPass(); -std::unique_ptr<ModulePassBase> createLowerLinalgToLLVMPass(); +std::unique_ptr<OpPassBase<ModuleOp>> createLowerLinalgToLLVMPass(); } // namespace linalg } // namespace mlir diff --git a/mlir/include/mlir/Dialect/QuantOps/Passes.h b/mlir/include/mlir/Dialect/QuantOps/Passes.h index 5e5fd700f92..c57d7bf41fe 100644 --- a/mlir/include/mlir/Dialect/QuantOps/Passes.h +++ b/mlir/include/mlir/Dialect/QuantOps/Passes.h @@ -30,20 +30,19 @@ namespace mlir { class FuncOp; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; namespace quant { /// Creates a pass that converts quantization simulation operations (i.e. /// FakeQuant and those like it) to casts into/out of supported QuantizedTypes. -std::unique_ptr<FunctionPassBase> createConvertSimulatedQuantPass(); +std::unique_ptr<OpPassBase<FuncOp>> createConvertSimulatedQuantPass(); /// Creates a pass that converts constants followed by a qbarrier to a /// constant whose value is quantized. This is typically one of the last /// passes done when lowering to express actual quantized arithmetic in a /// low level representation. Because it modifies the constant, it is /// destructive and cannot be undone. -std::unique_ptr<FunctionPassBase> createConvertConstPass(); +std::unique_ptr<OpPassBase<FuncOp>> createConvertConstPass(); } // namespace quant } // namespace mlir diff --git a/mlir/include/mlir/Dialect/SPIRV/Passes.h b/mlir/include/mlir/Dialect/SPIRV/Passes.h index 85f4f79ed59..ce4c19bf059 100644 --- a/mlir/include/mlir/Dialect/SPIRV/Passes.h +++ b/mlir/include/mlir/Dialect/SPIRV/Passes.h @@ -27,7 +27,7 @@ namespace mlir { namespace spirv { -std::unique_ptr<ModulePassBase> createConvertStandardToSPIRVPass(); +std::unique_ptr<OpPassBase<mlir::ModuleOp>> createConvertStandardToSPIRVPass(); } // namespace spirv } // namespace mlir diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h index fc440d5cb2e..441fd29bdd1 100644 --- a/mlir/include/mlir/Pass/Pass.h +++ b/mlir/include/mlir/Pass/Pass.h @@ -298,11 +298,6 @@ template <typename T> struct ModulePass : public OpPass<ModuleOp, T> { /// Return the current module being transformed. ModuleOp getModule() { return this->getOperation(); } }; - -/// Using directives defining legacy base classes. -// TODO(riverriddle) These should be removed in favor of OpPassBase<T>. -using FunctionPassBase = OpPassBase<FuncOp>; -using ModulePassBase = OpPassBase<ModuleOp>; } // end namespace mlir #endif // MLIR_PASS_PASS_H diff --git a/mlir/include/mlir/Quantizer/Transforms/Passes.h b/mlir/include/mlir/Quantizer/Transforms/Passes.h index f894ea801e0..4fdea58daf4 100644 --- a/mlir/include/mlir/Quantizer/Transforms/Passes.h +++ b/mlir/include/mlir/Quantizer/Transforms/Passes.h @@ -33,17 +33,17 @@ class TargetConfiguration; /// Creates a pass that infers quantized types based on metadata discovered /// in the computation. -std::unique_ptr<ModulePassBase> +std::unique_ptr<OpPassBase<ModuleOp>> createInferQuantizedTypesPass(SolverContext &solverContext, const TargetConfiguration &config); /// Creates a pass which removes any instrumentation and hint ops which have /// no effect on final runtime. -std::unique_ptr<FunctionPassBase> createRemoveInstrumentationPass(); +std::unique_ptr<OpPassBase<FuncOp>> createRemoveInstrumentationPass(); /// Adds default (dummy) statistics to ops that can benefit from runtime stats. /// Meant for testing. -std::unique_ptr<FunctionPassBase> createAddDefaultStatsPass(); +std::unique_ptr<OpPassBase<FuncOp>> createAddDefaultStatsPass(); } // namespace quantizer } // namespace mlir diff --git a/mlir/include/mlir/Transforms/Passes.h b/mlir/include/mlir/Transforms/Passes.h index 0c777ec6035..2656a777d23 100644 --- a/mlir/include/mlir/Transforms/Passes.h +++ b/mlir/include/mlir/Transforms/Passes.h @@ -33,32 +33,30 @@ class AffineForOp; class FuncOp; class ModuleOp; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; -using ModulePassBase = OpPassBase<ModuleOp>; /// Creates a constant folding pass. Note that this pass solely provides simple /// top-down constant folding functionality; it is intended to be used for /// testing purpose. Use Canonicalizer pass, which exploits more simplification /// opportunties exposed by constant folding, for the general cases. -std::unique_ptr<FunctionPassBase> createTestConstantFoldPass(); +std::unique_ptr<OpPassBase<FuncOp>> createTestConstantFoldPass(); /// Creates an instance of the Canonicalizer pass. -std::unique_ptr<FunctionPassBase> createCanonicalizerPass(); +std::unique_ptr<OpPassBase<FuncOp>> createCanonicalizerPass(); /// Creates a pass to perform common sub expression elimination. -std::unique_ptr<FunctionPassBase> createCSEPass(); +std::unique_ptr<OpPassBase<FuncOp>> createCSEPass(); /// Creates a pass to vectorize loops, operations and data types using a /// target-independent, n-D super-vector abstraction. -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> createVectorizePass(llvm::ArrayRef<int64_t> virtualVectorSize); /// Creates a pass to allow independent testing of vectorizer functionality with /// FileCheck. -std::unique_ptr<FunctionPassBase> createVectorizerTestPass(); +std::unique_ptr<OpPassBase<FuncOp>> createVectorizerTestPass(); /// Creates a pass to lower super-vectors to target-dependent HW vectors. -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> createMaterializeVectorsPass(llvm::ArrayRef<int64_t> vectorSize); /// Creates a loop unrolling pass with the provided parameters. @@ -67,75 +65,76 @@ createMaterializeVectorsPass(llvm::ArrayRef<int64_t> vectorSize); /// factors supplied through other means. If -1 is passed as the unrollFactor /// and no callback is provided, anything passed from the command-line (if at /// all) or the default unroll factor is used (LoopUnroll:kDefaultUnrollFactor). -std::unique_ptr<FunctionPassBase> createLoopUnrollPass( +std::unique_ptr<OpPassBase<FuncOp>> createLoopUnrollPass( int unrollFactor = -1, int unrollFull = -1, const std::function<unsigned(AffineForOp)> &getUnrollFactor = nullptr); /// Creates a loop unroll jam pass to unroll jam by the specified factor. A /// factor of -1 lets the pass use the default factor or the one on the command /// line if provided. -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> createLoopUnrollAndJamPass(int unrollJamFactor = -1); /// Creates a simplification pass for affine structures (maps and sets). In /// addition, this pass also normalizes memrefs to have the trivial (identity) /// layout map. -std::unique_ptr<FunctionPassBase> createSimplifyAffineStructuresPass(); +std::unique_ptr<OpPassBase<FuncOp>> createSimplifyAffineStructuresPass(); /// Creates a loop fusion pass which fuses loops. Buffers of size less than or /// equal to `localBufSizeThreshold` are promoted to memory space /// `fastMemorySpace'. -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> createLoopFusionPass(unsigned fastMemorySpace = 0, uint64_t localBufSizeThreshold = 0, bool maximalFusion = false); /// Creates a loop invariant code motion pass that hoists loop invariant /// instructions out of the loop. -std::unique_ptr<FunctionPassBase> createLoopInvariantCodeMotionPass(); +std::unique_ptr<OpPassBase<FuncOp>> createLoopInvariantCodeMotionPass(); /// Creates a pass to pipeline explicit movement of data across levels of the /// memory hierarchy. -std::unique_ptr<FunctionPassBase> createPipelineDataTransferPass(); +std::unique_ptr<OpPassBase<FuncOp>> createPipelineDataTransferPass(); /// Lowers affine control flow operations (ForStmt, IfStmt and AffineApplyOp) /// to equivalent lower-level constructs (flow of basic blocks and arithmetic /// primitives). -std::unique_ptr<FunctionPassBase> createLowerAffinePass(); +std::unique_ptr<OpPassBase<FuncOp>> createLowerAffinePass(); /// Creates a pass to perform tiling on loop nests. -std::unique_ptr<FunctionPassBase> createLoopTilingPass(uint64_t cacheSizeBytes); +std::unique_ptr<OpPassBase<FuncOp>> +createLoopTilingPass(uint64_t cacheSizeBytes); /// Creates a pass that performs parametric tiling so that the outermost loops /// have the given fixed number of iterations. Assumes outermost loop nests /// are permutable. -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> createSimpleParametricTilingPass(ArrayRef<int64_t> outerLoopSizes); /// Creates a pass that transforms perfectly nested loops with independent /// bounds into a single loop. -std::unique_ptr<FunctionPassBase> createLoopCoalescingPass(); +std::unique_ptr<OpPassBase<FuncOp>> createLoopCoalescingPass(); /// Performs packing (or explicit copying) of accessed memref regions into /// buffers in the specified faster memory space through either pointwise copies /// or DMA operations. -std::unique_ptr<FunctionPassBase> createAffineDataCopyGenerationPass( +std::unique_ptr<OpPassBase<FuncOp>> createAffineDataCopyGenerationPass( unsigned slowMemorySpace, unsigned fastMemorySpace, unsigned tagMemorySpace = 0, int minDmaTransferSize = 1024, uint64_t fastMemCapacityBytes = std::numeric_limits<uint64_t>::max()); /// Creates a pass to lower VectorTransferReadOp and VectorTransferWriteOp. -std::unique_ptr<FunctionPassBase> createLowerVectorTransfersPass(); +std::unique_ptr<OpPassBase<FuncOp>> createLowerVectorTransfersPass(); /// Creates a pass to perform optimizations relying on memref dataflow such as /// store to load forwarding, elimination of dead stores, and dead allocs. -std::unique_ptr<FunctionPassBase> createMemRefDataFlowOptPass(); +std::unique_ptr<OpPassBase<FuncOp>> createMemRefDataFlowOptPass(); /// Creates a pass to strip debug information from a function. -std::unique_ptr<FunctionPassBase> createStripDebugInfoPass(); +std::unique_ptr<OpPassBase<FuncOp>> createStripDebugInfoPass(); /// Creates a pass which tests loop fusion utilities. -std::unique_ptr<FunctionPassBase> createTestLoopFusionPass(); +std::unique_ptr<OpPassBase<FuncOp>> createTestLoopFusionPass(); } // end namespace mlir diff --git a/mlir/include/mlir/Transforms/ViewOpGraph.h b/mlir/include/mlir/Transforms/ViewOpGraph.h index 9ba85c242ea..4f9856e9f93 100644 --- a/mlir/include/mlir/Transforms/ViewOpGraph.h +++ b/mlir/include/mlir/Transforms/ViewOpGraph.h @@ -30,7 +30,6 @@ namespace mlir { class Block; class ModuleOp; template <typename T> class OpPassBase; -using ModulePassBase = OpPassBase<ModuleOp>; /// Displays the graph in a window. This is for use from the debugger and /// depends on Graphviz to generate the graph. @@ -42,7 +41,7 @@ llvm::raw_ostream &writeGraph(llvm::raw_ostream &os, Block &block, bool shortNames = false, const Twine &title = ""); /// Creates a pass to print op graphs. -std::unique_ptr<ModulePassBase> +std::unique_ptr<OpPassBase<ModuleOp>> createPrintOpGraphPass(llvm::raw_ostream &os = llvm::errs(), bool shortNames = false, const llvm::Twine &title = ""); diff --git a/mlir/include/mlir/Transforms/ViewRegionGraph.h b/mlir/include/mlir/Transforms/ViewRegionGraph.h index f54d35643eb..626afc31284 100644 --- a/mlir/include/mlir/Transforms/ViewRegionGraph.h +++ b/mlir/include/mlir/Transforms/ViewRegionGraph.h @@ -29,7 +29,6 @@ namespace mlir { class FuncOp; template <typename T> class OpPassBase; -using FunctionPassBase = OpPassBase<FuncOp>; class Region; /// Displays the CFG in a window. This is for use from the debugger and @@ -42,9 +41,9 @@ llvm::raw_ostream &writeGraph(llvm::raw_ostream &os, Region ®ion, bool shortNames = false, const Twine &title = ""); /// Creates a pass to print CFG graphs. -FunctionPassBase *createPrintCFGGraphPass(llvm::raw_ostream &os = llvm::errs(), - bool shortNames = false, - const llvm::Twine &title = ""); +OpPassBase<FuncOp> * +createPrintCFGGraphPass(llvm::raw_ostream &os = llvm::errs(), + bool shortNames = false, const llvm::Twine &title = ""); } // end namespace mlir diff --git a/mlir/lib/Analysis/MemRefBoundCheck.cpp b/mlir/lib/Analysis/MemRefBoundCheck.cpp index 849407520da..1d115b13082 100644 --- a/mlir/lib/Analysis/MemRefBoundCheck.cpp +++ b/mlir/lib/Analysis/MemRefBoundCheck.cpp @@ -43,8 +43,8 @@ struct MemRefBoundCheck : public FunctionPass<MemRefBoundCheck> { } // end anonymous namespace -FunctionPassBase *mlir::createMemRefBoundCheckPass() { - return new MemRefBoundCheck(); +std::unique_ptr<OpPassBase<FuncOp>> mlir::createMemRefBoundCheckPass() { + return std::make_unique<MemRefBoundCheck>(); } void MemRefBoundCheck::runOnFunction() { diff --git a/mlir/lib/Analysis/TestMemRefDependenceCheck.cpp b/mlir/lib/Analysis/TestMemRefDependenceCheck.cpp index 477121fcc24..c73bf72f127 100644 --- a/mlir/lib/Analysis/TestMemRefDependenceCheck.cpp +++ b/mlir/lib/Analysis/TestMemRefDependenceCheck.cpp @@ -45,8 +45,9 @@ struct TestMemRefDependenceCheck } // end anonymous namespace -FunctionPassBase *mlir::createTestMemRefDependenceCheckPass() { - return new TestMemRefDependenceCheck(); +std::unique_ptr<OpPassBase<FuncOp>> +mlir::createTestMemRefDependenceCheckPass() { + return std::make_unique<TestMemRefDependenceCheck>(); } // Returns a result string which represents the direction vector (if there was diff --git a/mlir/lib/Analysis/TestParallelismDetection.cpp b/mlir/lib/Analysis/TestParallelismDetection.cpp index 75982a8e0c5..a9f9ea94a45 100644 --- a/mlir/lib/Analysis/TestParallelismDetection.cpp +++ b/mlir/lib/Analysis/TestParallelismDetection.cpp @@ -36,8 +36,8 @@ struct TestParallelismDetection } // end anonymous namespace -FunctionPassBase *mlir::createParallelismDetectionTestPass() { - return new TestParallelismDetection(); +std::unique_ptr<OpPassBase<FuncOp>> mlir::createParallelismDetectionTestPass() { + return std::make_unique<TestParallelismDetection>(); } // Walks the function and emits a note for all 'affine.for' ops detected as diff --git a/mlir/lib/Conversion/ControlFlowToCFG/ConvertControlFlowToCFG.cpp b/mlir/lib/Conversion/ControlFlowToCFG/ConvertControlFlowToCFG.cpp index 81426aaa243..cbff101e15d 100644 --- a/mlir/lib/Conversion/ControlFlowToCFG/ConvertControlFlowToCFG.cpp +++ b/mlir/lib/Conversion/ControlFlowToCFG/ConvertControlFlowToCFG.cpp @@ -270,7 +270,7 @@ void ControlFlowToCFGPass::runOnFunction() { signalPassFailure(); } -std::unique_ptr<FunctionPassBase> mlir::createLowerToCFGPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLowerToCFGPass() { return std::make_unique<ControlFlowToCFGPass>(); } diff --git a/mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp b/mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp index 29771fe7ea5..2cefa787ae8 100644 --- a/mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp +++ b/mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp @@ -163,7 +163,7 @@ GpuKernelToCubinPass::translateGpuKernelToCubinAnnotation(FuncOp &function) { return success(); } -std::unique_ptr<ModulePassBase> +std::unique_ptr<OpPassBase<ModuleOp>> mlir::createConvertGPUKernelToCubinPass(CubinGenerator cubinGenerator) { return std::make_unique<GpuKernelToCubinPass>(cubinGenerator); } diff --git a/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp b/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp index ba0bc475168..5a435a5cc88 100644 --- a/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp +++ b/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp @@ -369,7 +369,7 @@ void GpuLaunchFuncToCudaCallsPass::translateGpuLaunchCalls( launchOp.erase(); } -std::unique_ptr<mlir::ModulePassBase> +std::unique_ptr<mlir::OpPassBase<mlir::ModuleOp>> mlir::createConvertGpuLaunchFuncToCudaCallsPass() { return std::make_unique<GpuLaunchFuncToCudaCallsPass>(); } diff --git a/mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp b/mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp index c4daf8af956..f8c6f5d15ff 100644 --- a/mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp +++ b/mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp @@ -110,7 +110,7 @@ private: } // anonymous namespace -std::unique_ptr<ModulePassBase> createGenerateCubinAccessorPass() { +std::unique_ptr<OpPassBase<ModuleOp>> createGenerateCubinAccessorPass() { return std::make_unique<GpuGenerateCubinAccessorsPass>(); } diff --git a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp index ed7ebfbced1..1ae83ae9ae2 100644 --- a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp +++ b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp @@ -162,7 +162,7 @@ void mlir::populateGpuToNVVMConversionPatterns( converter); } -std::unique_ptr<ModulePassBase> mlir::createLowerGpuOpsToNVVMOpsPass() { +std::unique_ptr<OpPassBase<ModuleOp>> mlir::createLowerGpuOpsToNVVMOpsPass() { return std::make_unique<LowerGpuOpsToNVVMOpsPass>(); } diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp index 6746594ce87..544232e9860 100644 --- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp @@ -166,7 +166,7 @@ void GPUToSPIRVPass::runOnModule() { } } -ModulePassBase *createGPUToSPIRVPass() { return new GPUToSPIRVPass(); } +OpPassBase<ModuleOp> *createGPUToSPIRVPass() { return new GPUToSPIRVPass(); } static PassRegistration<GPUToSPIRVPass> pass("convert-gpu-to-spirv", "Convert GPU dialect to SPIR-V dialect"); diff --git a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp index 9dd9fdbbb87..6d4cb9d8256 100644 --- a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp +++ b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp @@ -66,7 +66,7 @@ struct ForLoopMapper : public FunctionPass<ForLoopMapper> { }; } // namespace -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::createSimpleLoopsToGPUPass(unsigned numBlockDims, unsigned numThreadDims) { return std::make_unique<ForLoopMapper>(numBlockDims, numThreadDims); diff --git a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp index 8d0dc6bb6b2..ce844e9dfc8 100644 --- a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp +++ b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp @@ -1222,11 +1222,11 @@ struct LLVMLoweringPass : public ModulePass<LLVMLoweringPass> { }; } // end namespace -std::unique_ptr<ModulePassBase> mlir::createLowerToLLVMPass() { +std::unique_ptr<OpPassBase<ModuleOp>> mlir::createLowerToLLVMPass() { return std::make_unique<LLVMLoweringPass>(); } -std::unique_ptr<ModulePassBase> +std::unique_ptr<OpPassBase<ModuleOp>> mlir::createLowerToLLVMPass(LLVMPatternListFiller patternListFiller, LLVMTypeConverterMaker typeConverterMaker) { return std::make_unique<LLVMLoweringPass>(patternListFiller, diff --git a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp index 174a4477560..dcecb84453f 100644 --- a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp @@ -48,7 +48,7 @@ void ConvertStandardToSPIRVPass::runOnModule() { } } -std::unique_ptr<ModulePassBase> +std::unique_ptr<OpPassBase<ModuleOp>> mlir::spirv::createConvertStandardToSPIRVPass() { return std::make_unique<ConvertStandardToSPIRVPass>(); } diff --git a/mlir/lib/Conversion/VectorToLLVM/VectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/VectorToLLVM.cpp index 174e3d6910c..2b15637ae14 100644 --- a/mlir/lib/Conversion/VectorToLLVM/VectorToLLVM.cpp +++ b/mlir/lib/Conversion/VectorToLLVM/VectorToLLVM.cpp @@ -194,7 +194,7 @@ void LowerVectorToLLVMPass::runOnModule() { } } -ModulePassBase *mlir::createLowerVectorToLLVMPass() { +OpPassBase<ModuleOp> *mlir::createLowerVectorToLLVMPass() { return new LowerVectorToLLVMPass(); } diff --git a/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp b/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp index 83307da957b..a4fd98bb89e 100644 --- a/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp +++ b/mlir/lib/Dialect/FxpMathOps/Transforms/LowerUniformRealMath.cpp @@ -372,7 +372,7 @@ void LowerUniformRealMathPass::runOnFunction() { applyPatternsGreedily(fn, patterns); } -FunctionPassBase *mlir::fxpmath::createLowerUniformRealMathPass() { +OpPassBase<FuncOp> *mlir::fxpmath::createLowerUniformRealMathPass() { return new LowerUniformRealMathPass(); } @@ -392,7 +392,7 @@ void LowerUniformCastsPass::runOnFunction() { applyPatternsGreedily(fn, patterns); } -FunctionPassBase *mlir::fxpmath::createLowerUniformCastsPass() { +OpPassBase<FuncOp> *mlir::fxpmath::createLowerUniformCastsPass() { return new LowerUniformCastsPass(); } diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp index 26449f6e6f1..4328fb39c29 100644 --- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp @@ -147,7 +147,7 @@ public: } // namespace -std::unique_ptr<ModulePassBase> mlir::createGpuKernelOutliningPass() { +std::unique_ptr<OpPassBase<ModuleOp>> mlir::createGpuKernelOutliningPass() { return std::make_unique<GpuKernelOutliningPass>(); } diff --git a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp index 0ce6c82679b..bfad37dffaf 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp @@ -349,7 +349,7 @@ LinalgFusionPass::LinalgFusionPass(ArrayRef<int64_t> sizes) this->tileSizes.assign(sizes.begin(), sizes.end()); } -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::linalg::createLinalgFusionPass(ArrayRef<int64_t> tileSizes) { return std::make_unique<LinalgFusionPass>(tileSizes); } diff --git a/mlir/lib/Dialect/Linalg/Transforms/LowerToLLVMDialect.cpp b/mlir/lib/Dialect/Linalg/Transforms/LowerToLLVMDialect.cpp index 59d78d2e870..48b4eda8697 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/LowerToLLVMDialect.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/LowerToLLVMDialect.cpp @@ -907,7 +907,8 @@ void LowerLinalgToLLVMPass::runOnModule() { } } -std::unique_ptr<ModulePassBase> mlir::linalg::createLowerLinalgToLLVMPass() { +std::unique_ptr<OpPassBase<ModuleOp>> +mlir::linalg::createLowerLinalgToLLVMPass() { return std::make_unique<LowerLinalgToLLVMPass>(); } diff --git a/mlir/lib/Dialect/Linalg/Transforms/LowerToLoops.cpp b/mlir/lib/Dialect/Linalg/Transforms/LowerToLoops.cpp index 54c0350504e..64773903f87 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/LowerToLoops.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/LowerToLoops.cpp @@ -390,7 +390,8 @@ void LowerLinalgToLoopsPass::runOnFunction() { } } -std::unique_ptr<FunctionPassBase> mlir::linalg::createLowerLinalgToLoopsPass() { +std::unique_ptr<OpPassBase<FuncOp>> +mlir::linalg::createLowerLinalgToLoopsPass() { return std::make_unique<LowerLinalgToLoopsPass>(); } diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp index cacec86dc35..f13ce6485bd 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp @@ -527,7 +527,7 @@ LinalgTilingPass::LinalgTilingPass(ArrayRef<int64_t> sizes, bool promoteViews) { this->promoteViews = promoteViews; } -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::linalg::createLinalgTilingPass(ArrayRef<int64_t> tileSizes, bool promoteViews) { return std::make_unique<LinalgTilingPass>(tileSizes, promoteViews); diff --git a/mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp b/mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp index e3a17b057d4..61636dcdd8b 100644 --- a/mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp +++ b/mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp @@ -112,7 +112,7 @@ void ConvertConstPass::runOnFunction() { applyPatternsGreedily(func, patterns); } -std::unique_ptr<FunctionPassBase> mlir::quant::createConvertConstPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::quant::createConvertConstPass() { return std::make_unique<ConvertConstPass>(); } diff --git a/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp b/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp index 1000b1fabbf..e65f30d035b 100644 --- a/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp +++ b/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp @@ -147,7 +147,7 @@ void ConvertSimulatedQuantPass::runOnFunction() { signalPassFailure(); } -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::quant::createConvertSimulatedQuantPass() { return std::make_unique<ConvertSimulatedQuantPass>(); } diff --git a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp index a2d38ce211d..696c1e2db3a 100644 --- a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp +++ b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp @@ -118,7 +118,8 @@ void AddDefaultStatsPass::runWithConfig(SolverContext &solverContext, }); } -std::unique_ptr<FunctionPassBase> mlir::quantizer::createAddDefaultStatsPass() { +std::unique_ptr<OpPassBase<FuncOp>> +mlir::quantizer::createAddDefaultStatsPass() { return std::make_unique<AddDefaultStatsPass>(); } diff --git a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp index ff293fc93aa..7c449e32c4c 100644 --- a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp +++ b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp @@ -286,7 +286,8 @@ void InferQuantizedTypesPass::transformResultType(CAGResultAnchor *anchor, } } -std::unique_ptr<ModulePassBase> mlir::quantizer::createInferQuantizedTypesPass( +std::unique_ptr<OpPassBase<ModuleOp>> +mlir::quantizer::createInferQuantizedTypesPass( SolverContext &solverContext, const TargetConfiguration &config) { return std::make_unique<InferQuantizedTypesPass>(solverContext, config); } diff --git a/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp b/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp index b9fbf27d24f..0266520bec3 100644 --- a/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp +++ b/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp @@ -66,7 +66,7 @@ void RemoveInstrumentationPass::runOnFunction() { applyPatternsGreedily(func, patterns); } -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::quantizer::createRemoveInstrumentationPass() { return std::make_unique<RemoveInstrumentationPass>(); } diff --git a/mlir/lib/Transforms/AffineDataCopyGeneration.cpp b/mlir/lib/Transforms/AffineDataCopyGeneration.cpp index fa483008d15..5b2a3185469 100644 --- a/mlir/lib/Transforms/AffineDataCopyGeneration.cpp +++ b/mlir/lib/Transforms/AffineDataCopyGeneration.cpp @@ -165,7 +165,7 @@ struct AffineDataCopyGeneration /// buffers in 'fastMemorySpace', and replaces memory operations to the former /// by the latter. Only load op's handled for now. /// TODO(bondhugula): extend this to store op's. -std::unique_ptr<FunctionPassBase> mlir::createAffineDataCopyGenerationPass( +std::unique_ptr<OpPassBase<FuncOp>> mlir::createAffineDataCopyGenerationPass( unsigned slowMemorySpace, unsigned fastMemorySpace, unsigned tagMemorySpace, int minDmaTransferSize, uint64_t fastMemCapacityBytes) { return std::make_unique<AffineDataCopyGeneration>( diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp index bb89aef7fef..0e6dae6c549 100644 --- a/mlir/lib/Transforms/CSE.cpp +++ b/mlir/lib/Transforms/CSE.cpp @@ -258,7 +258,7 @@ void CSE::runOnFunction() { markAnalysesPreserved<DominanceInfo, PostDominanceInfo>(); } -std::unique_ptr<FunctionPassBase> mlir::createCSEPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createCSEPass() { return std::make_unique<CSE>(); } diff --git a/mlir/lib/Transforms/Canonicalizer.cpp b/mlir/lib/Transforms/Canonicalizer.cpp index db6c8ee26e6..7e08d363648 100644 --- a/mlir/lib/Transforms/Canonicalizer.cpp +++ b/mlir/lib/Transforms/Canonicalizer.cpp @@ -53,7 +53,7 @@ void Canonicalizer::runOnFunction() { } /// Create a Canonicalizer pass. -std::unique_ptr<FunctionPassBase> mlir::createCanonicalizerPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createCanonicalizerPass() { return std::make_unique<Canonicalizer>(); } diff --git a/mlir/lib/Transforms/LoopCoalescing.cpp b/mlir/lib/Transforms/LoopCoalescing.cpp index 8e220607f06..c1eec56526e 100644 --- a/mlir/lib/Transforms/LoopCoalescing.cpp +++ b/mlir/lib/Transforms/LoopCoalescing.cpp @@ -96,7 +96,7 @@ public: } // namespace -std::unique_ptr<FunctionPassBase> mlir::createLoopCoalescingPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopCoalescingPass() { return std::make_unique<LoopCoalescingPass>(); } diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp index a17481f89c9..8257bf05f5d 100644 --- a/mlir/lib/Transforms/LoopFusion.cpp +++ b/mlir/lib/Transforms/LoopFusion.cpp @@ -111,7 +111,7 @@ struct LoopFusion : public FunctionPass<LoopFusion> { } // end anonymous namespace -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopFusionPass(unsigned fastMemorySpace, uint64_t localBufSizeThreshold, bool maximalFusion) { return std::make_unique<LoopFusion>(fastMemorySpace, localBufSizeThreshold, diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp index 6150996a3d4..ed0adbf21a0 100644 --- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp +++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp @@ -76,7 +76,7 @@ static bool isMemRefDereferencingOp(Operation &op) { return false; } -std::unique_ptr<FunctionPassBase> mlir::createLoopInvariantCodeMotionPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopInvariantCodeMotionPass() { return std::make_unique<LoopInvariantCodeMotion>(); } diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Transforms/LoopTiling.cpp index 02787b12e3d..d90e727b0ac 100644 --- a/mlir/lib/Transforms/LoopTiling.cpp +++ b/mlir/lib/Transforms/LoopTiling.cpp @@ -81,7 +81,7 @@ struct LoopTiling : public FunctionPass<LoopTiling> { /// Creates a pass to perform loop tiling on all suitable loop nests of a /// Function. -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopTilingPass(uint64_t cacheSizeBytes) { return std::make_unique<LoopTiling>(cacheSizeBytes); } diff --git a/mlir/lib/Transforms/LoopUnroll.cpp b/mlir/lib/Transforms/LoopUnroll.cpp index 5e132794149..40f48ada4d7 100644 --- a/mlir/lib/Transforms/LoopUnroll.cpp +++ b/mlir/lib/Transforms/LoopUnroll.cpp @@ -180,7 +180,7 @@ LogicalResult LoopUnroll::runOnAffineForOp(AffineForOp forOp) { return loopUnrollByFactor(forOp, kDefaultUnrollFactor); } -std::unique_ptr<FunctionPassBase> mlir::createLoopUnrollPass( +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopUnrollPass( int unrollFactor, int unrollFull, const std::function<unsigned(AffineForOp)> &getUnrollFactor) { return std::make_unique<LoopUnroll>( diff --git a/mlir/lib/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Transforms/LoopUnrollAndJam.cpp index b6b2f3d4ad7..559f94bedf0 100644 --- a/mlir/lib/Transforms/LoopUnrollAndJam.cpp +++ b/mlir/lib/Transforms/LoopUnrollAndJam.cpp @@ -82,7 +82,7 @@ struct LoopUnrollAndJam : public FunctionPass<LoopUnrollAndJam> { }; } // end anonymous namespace -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLoopUnrollAndJamPass(int unrollJamFactor) { return std::make_unique<LoopUnrollAndJam>( unrollJamFactor == -1 ? None : Optional<unsigned>(unrollJamFactor)); diff --git a/mlir/lib/Transforms/LowerAffine.cpp b/mlir/lib/Transforms/LowerAffine.cpp index e8a8284d392..2ed01a7cc32 100644 --- a/mlir/lib/Transforms/LowerAffine.cpp +++ b/mlir/lib/Transforms/LowerAffine.cpp @@ -529,7 +529,7 @@ class LowerAffinePass : public FunctionPass<LowerAffinePass> { /// Lowers If and For operations within a function into their lower level CFG /// equivalent blocks. -std::unique_ptr<FunctionPassBase> mlir::createLowerAffinePass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLowerAffinePass() { return std::make_unique<LowerAffinePass>(); } diff --git a/mlir/lib/Transforms/LowerVectorTransfers.cpp b/mlir/lib/Transforms/LowerVectorTransfers.cpp index 86ab2484e2a..126a29edffb 100644 --- a/mlir/lib/Transforms/LowerVectorTransfers.cpp +++ b/mlir/lib/Transforms/LowerVectorTransfers.cpp @@ -373,7 +373,7 @@ struct LowerVectorTransfersPass } // end anonymous namespace -std::unique_ptr<FunctionPassBase> mlir::createLowerVectorTransfersPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createLowerVectorTransfersPass() { return std::make_unique<LowerVectorTransfersPass>(); } diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp index bfdd5bf05f2..737af704992 100644 --- a/mlir/lib/Transforms/MaterializeVectors.cpp +++ b/mlir/lib/Transforms/MaterializeVectors.cpp @@ -766,7 +766,7 @@ void MaterializeVectorsPass::runOnFunction() { signalPassFailure(); } -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::createMaterializeVectorsPass(llvm::ArrayRef<int64_t> vectorSize) { return std::make_unique<MaterializeVectorsPass>(vectorSize); } diff --git a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp index f922d508c69..58703394479 100644 --- a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp +++ b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp @@ -88,7 +88,7 @@ struct MemRefDataFlowOpt : public FunctionPass<MemRefDataFlowOpt> { /// Creates a pass to perform optimizations relying on memref dataflow such as /// store to load forwarding, elimination of dead stores, and dead allocs. -std::unique_ptr<FunctionPassBase> mlir::createMemRefDataFlowOptPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createMemRefDataFlowOptPass() { return std::make_unique<MemRefDataFlowOpt>(); } diff --git a/mlir/lib/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Transforms/PipelineDataTransfer.cpp index fe201572ca3..d8d8dba9620 100644 --- a/mlir/lib/Transforms/PipelineDataTransfer.cpp +++ b/mlir/lib/Transforms/PipelineDataTransfer.cpp @@ -49,7 +49,7 @@ struct PipelineDataTransfer : public FunctionPass<PipelineDataTransfer> { /// Creates a pass to pipeline explicit movement of data across levels of the /// memory hierarchy. -std::unique_ptr<FunctionPassBase> mlir::createPipelineDataTransferPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createPipelineDataTransferPass() { return std::make_unique<PipelineDataTransfer>(); } diff --git a/mlir/lib/Transforms/SimplifyAffineStructures.cpp b/mlir/lib/Transforms/SimplifyAffineStructures.cpp index 5eaf8f3460a..e243c1bec54 100644 --- a/mlir/lib/Transforms/SimplifyAffineStructures.cpp +++ b/mlir/lib/Transforms/SimplifyAffineStructures.cpp @@ -86,7 +86,7 @@ struct SimplifyAffineStructures } // end anonymous namespace -std::unique_ptr<FunctionPassBase> mlir::createSimplifyAffineStructuresPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createSimplifyAffineStructuresPass() { return std::make_unique<SimplifyAffineStructures>(); } diff --git a/mlir/lib/Transforms/StripDebugInfo.cpp b/mlir/lib/Transforms/StripDebugInfo.cpp index 15db8b58e88..772df3da3c7 100644 --- a/mlir/lib/Transforms/StripDebugInfo.cpp +++ b/mlir/lib/Transforms/StripDebugInfo.cpp @@ -38,7 +38,7 @@ void StripDebugInfo::runOnFunction() { } /// Creates a pass to strip debug information from a function. -std::unique_ptr<FunctionPassBase> mlir::createStripDebugInfoPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createStripDebugInfoPass() { return std::make_unique<StripDebugInfo>(); } diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Transforms/Vectorize.cpp index 89e3da7477d..606cdb77a42 100644 --- a/mlir/lib/Transforms/Vectorize.cpp +++ b/mlir/lib/Transforms/Vectorize.cpp @@ -1276,7 +1276,7 @@ void Vectorize::runOnFunction() { LLVM_DEBUG(dbgs() << "\n"); } -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::createVectorizePass(llvm::ArrayRef<int64_t> virtualVectorSize) { return std::make_unique<Vectorize>(virtualVectorSize); } diff --git a/mlir/lib/Transforms/ViewOpGraph.cpp b/mlir/lib/Transforms/ViewOpGraph.cpp index afb65c7d148..7f65a143a96 100644 --- a/mlir/lib/Transforms/ViewOpGraph.cpp +++ b/mlir/lib/Transforms/ViewOpGraph.cpp @@ -153,7 +153,7 @@ llvm::raw_ostream &mlir::writeGraph(llvm::raw_ostream &os, mlir::Block &block, return llvm::WriteGraph(os, &block, shortNames, title); } -std::unique_ptr<mlir::ModulePassBase> +std::unique_ptr<mlir::OpPassBase<mlir::ModuleOp>> mlir::createPrintOpGraphPass(llvm::raw_ostream &os, bool shortNames, const llvm::Twine &title) { return std::make_unique<PrintOpPass>(os, shortNames, title); diff --git a/mlir/lib/Transforms/ViewRegionGraph.cpp b/mlir/lib/Transforms/ViewRegionGraph.cpp index 5a0e8e5ea99..91ac397200a 100644 --- a/mlir/lib/Transforms/ViewRegionGraph.cpp +++ b/mlir/lib/Transforms/ViewRegionGraph.cpp @@ -85,9 +85,9 @@ private: }; } // namespace -FunctionPassBase *mlir::createPrintCFGGraphPass(llvm::raw_ostream &os, - bool shortNames, - const llvm::Twine &title) { +OpPassBase<FuncOp> *mlir::createPrintCFGGraphPass(llvm::raw_ostream &os, + bool shortNames, + const llvm::Twine &title) { return new PrintCFGPass(os, shortNames, title); } diff --git a/mlir/test/lib/Transforms/TestConstantFold.cpp b/mlir/test/lib/Transforms/TestConstantFold.cpp index b1c895257c3..15ecaabb149 100644 --- a/mlir/test/lib/Transforms/TestConstantFold.cpp +++ b/mlir/test/lib/Transforms/TestConstantFold.cpp @@ -74,7 +74,7 @@ void TestConstantFold::runOnFunction() { } /// Creates a constant folding pass. -std::unique_ptr<FunctionPassBase> mlir::createTestConstantFoldPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createTestConstantFoldPass() { return std::make_unique<TestConstantFold>(); } diff --git a/mlir/test/lib/Transforms/TestLoopFusion.cpp b/mlir/test/lib/Transforms/TestLoopFusion.cpp index 604b42817e2..026a897fa8d 100644 --- a/mlir/test/lib/Transforms/TestLoopFusion.cpp +++ b/mlir/test/lib/Transforms/TestLoopFusion.cpp @@ -58,7 +58,7 @@ struct TestLoopFusion : public FunctionPass<TestLoopFusion> { } // end anonymous namespace -std::unique_ptr<FunctionPassBase> mlir::createTestLoopFusionPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createTestLoopFusionPass() { return std::make_unique<TestLoopFusion>(); } diff --git a/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp b/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp index 6dc0bfde371..bce1e08402d 100644 --- a/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp +++ b/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp @@ -55,7 +55,7 @@ public: }; } // end namespace -std::unique_ptr<FunctionPassBase> +std::unique_ptr<OpPassBase<FuncOp>> mlir::createSimpleParametricTilingPass(ArrayRef<int64_t> outerLoopSizes) { return std::make_unique<SimpleParametricLoopTilingPass>(outerLoopSizes); } diff --git a/mlir/test/lib/Transforms/TestVectorizationUtils.cpp b/mlir/test/lib/Transforms/TestVectorizationUtils.cpp index 3f00eb01e11..4fdb66071bf 100644 --- a/mlir/test/lib/Transforms/TestVectorizationUtils.cpp +++ b/mlir/test/lib/Transforms/TestVectorizationUtils.cpp @@ -290,7 +290,7 @@ void VectorizerTestPass::runOnFunction() { } } -std::unique_ptr<FunctionPassBase> mlir::createVectorizerTestPass() { +std::unique_ptr<OpPassBase<FuncOp>> mlir::createVectorizerTestPass() { return std::make_unique<VectorizerTestPass>(); } diff --git a/mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp b/mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp index df69407fa9e..deddc63eb10 100644 --- a/mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp +++ b/mlir/tools/mlir-cuda-runner/mlir-cuda-runner.cpp @@ -140,7 +140,7 @@ static LogicalResult runMLIRPasses(ModuleOp m) { PassManager pm(m.getContext()); pm.addPass(createGpuKernelOutliningPass()); - pm.addPass(static_cast<std::unique_ptr<ModulePassBase>>( + pm.addPass(static_cast<std::unique_ptr<OpPassBase<ModuleOp>>>( std::make_unique<LowerStandardAndGpuToLLVMAndNVVM>())); pm.addPass(createConvertGPUKernelToCubinPass(&compilePtxToCubin)); pm.addPass(createGenerateCubinAccessorPass()); |