diff options
author | Michele Scuttari <michele.scuttari@outlook.com> | 2022-08-31 10:16:29 +0200 |
---|---|---|
committer | Michele Scuttari <michele.scuttari@outlook.com> | 2022-08-31 12:28:45 +0200 |
commit | 67d0d7ac0acb0665d6a09f61278fbcf51f0114c2 (patch) | |
tree | a07b13c6569a3629ec7df57dfaa945f7d92aecf6 /mlir/lib/Dialect/Linalg/Transforms | |
parent | 9e842dd4bd551c42951d1a56bb9d9eef1fa6c385 (diff) | |
download | llvm-67d0d7ac0acb0665d6a09f61278fbcf51f0114c2.tar.gz |
[MLIR] Update pass declarations to new autogenerated files
The patch introduces the required changes to update the pass declarations and definitions to use the new autogenerated files and allow dropping the old infrastructure.
Reviewed By: mehdi_amini, rriddle
Differential Review: https://reviews.llvm.org/D132838
Diffstat (limited to 'mlir/lib/Dialect/Linalg/Transforms')
17 files changed, 137 insertions, 109 deletions
diff --git a/mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp b/mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp index 78dd1ead3172..c14f91000d89 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp @@ -12,7 +12,6 @@ // //===----------------------------------------------------------------------===// -#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 63433ef50fe2..ca74a17f6cd0 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Bufferize.cpp @@ -6,12 +6,13 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Dialect/Linalg/Passes.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" @@ -19,13 +20,19 @@ #include "mlir/IR/Operation.h" #include "mlir/Pass/Pass.h" +namespace mlir { +#define GEN_PASS_DEF_LINALGBUFFERIZE +#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 LinalgBufferizeBase<LinalgBufferizePass> { +struct LinalgBufferizePass + : public impl::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 b98b486d38ee..2e975693151f 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp @@ -6,11 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Dialect/Linalg/Passes.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" @@ -19,6 +20,11 @@ #include <memory> #include <utility> +namespace mlir { +#define GEN_PASS_DEF_LINALGDETENSORIZE +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir + using namespace mlir; using namespace mlir::linalg; @@ -158,7 +164,8 @@ public: }; /// @see LinalgDetensorize in Linalg/Passes.td for more details. -struct LinalgDetensorize : public LinalgDetensorizeBase<LinalgDetensorize> { +struct LinalgDetensorize + : public impl::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 df3b8e6af043..0d7e41062541 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @@ -12,10 +12,11 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Dialect/Linalg/Passes.h" + +#include "mlir/Dialect/Affine/IR/AffineOps.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" @@ -27,6 +28,11 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +namespace mlir { +#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMS +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir + #define DEBUG_TYPE "linalg-drop-unit-dims" using namespace mlir; @@ -542,7 +548,7 @@ void mlir::linalg::populateFoldUnitExtentDimsPatterns( namespace { /// Pass that removes unit-extent dims within generic ops. struct LinalgFoldUnitExtentDimsPass - : public LinalgFoldUnitExtentDimsBase<LinalgFoldUnitExtentDimsPass> { + : public impl::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 2644e50c2684..d63b8f6767f8 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp @@ -9,12 +9,11 @@ // This file implements the linalg dialect Fusion on tensors operations pass. // //===----------------------------------------------------------------------===// -#include <utility> -#include "PassDetail.h" +#include "mlir/Dialect/Linalg/Passes.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" @@ -24,6 +23,13 @@ #include "mlir/IR/PatternMatch.h" #include "mlir/Support/LLVM.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h" +#include <utility> + +namespace mlir { +#define GEN_PASS_DEF_LINALGFOLDUNITEXTENTDIMS +#define GEN_PASS_DEF_LINALGELEMENTWISEOPFUSION +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir using namespace mlir; using namespace mlir::linalg; @@ -1753,7 +1759,8 @@ namespace { // favor of test passes that check the functionality of each of the patterns // added here individually. struct LinalgElementwiseOpFusionPass - : public LinalgElementwiseOpFusionBase<LinalgElementwiseOpFusionPass> { + : public impl::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 9b5dad05c689..0e115a8ba20f 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseToLinalg.cpp @@ -8,13 +8,17 @@ #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_CONVERTELEMENTWISETOLINALG +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir + using namespace mlir; static bool isElementwiseMappableOpOnRankedTensors(Operation *op) { @@ -121,7 +125,8 @@ void mlir::linalg::populateElementwiseToLinalgConversionPatterns( namespace { class ConvertElementwiseToLinalgPass - : public ConvertElementwiseToLinalgBase<ConvertElementwiseToLinalgPass> { + : public impl::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 9d38dd6084fe..ebef65626fd7 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp @@ -10,7 +10,6 @@ // //===----------------------------------------------------------------------===// -#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 24caab3b5895..ff28663d479b 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp @@ -10,7 +10,6 @@ // //===----------------------------------------------------------------------===// -#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 9c5b3fab2240..4f384c33e994 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp @@ -11,9 +11,10 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" -#include "mlir/Dialect/Linalg/IR/Linalg.h" #include "mlir/Dialect/Linalg/Passes.h" + +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/Linalg/IR/Linalg.h" #include "mlir/Dialect/Linalg/Transforms/Transforms.h" #include "mlir/IR/AffineMap.h" #include "mlir/IR/Attributes.h" @@ -24,6 +25,11 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Debug.h" +namespace mlir { +#define GEN_PASS_DEF_LINALGGENERALIZATION +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir + #define DEBUG_TYPE "linalg-generalization" using namespace mlir; @@ -67,7 +73,7 @@ FailureOr<GenericOp> mlir::linalg::generalizeNamedOp(RewriterBase &rewriter, namespace { struct LinalgGeneralizationPass - : public LinalgGeneralizationBase<LinalgGeneralizationPass> { + : public impl::LinalgGeneralizationBase<LinalgGeneralizationPass> { void runOnOperation() override; }; diff --git a/mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp b/mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp index 978220efbf20..518d7376ed2f 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/InitTensorToAllocTensor.cpp @@ -6,13 +6,17 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Dialect/Linalg/Passes.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_LINALGINITTENSORTOALLOCTENSOR +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir + using namespace mlir; using namespace mlir::bufferization; using namespace mlir::linalg; @@ -30,7 +34,8 @@ struct InitTensorLoweringPattern : public OpRewritePattern<InitTensorOp> { }; struct LinalgInitTensorToAllocTensor - : public LinalgInitTensorToAllocTensorBase<LinalgInitTensorToAllocTensor> { + : public impl::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 b2ad1b24c6b6..e8f5372e4fdc 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp @@ -12,15 +12,21 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Dialect/Linalg/Passes.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_LINALGINLINESCALAROPERANDS +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir + using namespace mlir; using namespace mlir::linalg; @@ -96,7 +102,8 @@ void mlir::linalg::populateInlineConstantOperandsPatterns( namespace { /// Pass that removes unit-extent dims within generic ops. struct LinalgInlineScalarOperandsPass - : public LinalgInlineScalarOperandsBase<LinalgInlineScalarOperandsPass> { + : public impl::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 b8a8bbd40a0a..96061dcc621a 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp @@ -11,15 +11,14 @@ // //===----------------------------------------------------------------------===// -#include <utility> +#include "mlir/Dialect/Linalg/Passes.h" -#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" @@ -33,6 +32,20 @@ #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; @@ -42,7 +55,8 @@ namespace { /// Configurable pass to apply pattern-based tiling and fusion. struct LinalgStrategyTileAndFusePass - : public LinalgStrategyTileAndFusePassBase<LinalgStrategyTileAndFusePass> { + : public impl::LinalgStrategyTileAndFusePassBase< + LinalgStrategyTileAndFusePass> { LinalgStrategyTileAndFusePass() = default; @@ -79,11 +93,12 @@ struct LinalgStrategyTileAndFusePass /// Configurable pass to apply pattern-based linalg tiling. struct LinalgStrategyTilePass - : public LinalgStrategyTilePassBase<LinalgStrategyTilePass> { + : public impl::LinalgStrategyTilePassBase<LinalgStrategyTilePass> { LinalgStrategyTilePass() = default; - LinalgStrategyTilePass(StringRef opName, LinalgTilingOptions opt, + LinalgStrategyTilePass(StringRef opName, + mlir::linalg::LinalgTilingOptions opt, LinalgTransformationFilter filt) : options(std::move(opt)), filter(std::move(filt)) { this->anchorOpName.setValue(opName.str()); @@ -106,13 +121,13 @@ struct LinalgStrategyTilePass (void)applyPatternsAndFoldGreedily(funcOp, std::move(tilingPattern)); } - LinalgTilingOptions options; + mlir::linalg::LinalgTilingOptions options; LinalgTransformationFilter filter; }; /// Configurable pass to apply hoisting and padding. struct LinalgStrategyPadPass - : public LinalgStrategyPadPassBase<LinalgStrategyPadPass> { + : public impl::LinalgStrategyPadPassBase<LinalgStrategyPadPass> { LinalgStrategyPadPass() = default; @@ -142,11 +157,11 @@ struct LinalgStrategyPadPass LinalgTransformationFilter filter; }; - /// Configurable pass to apply lowering of coarser-grained named linalg ops into /// finer-grained named versions. struct LinalgStrategyDecomposePass - : public LinalgStrategyDecomposePassBase<LinalgStrategyDecomposePass> { + : public impl::LinalgStrategyDecomposePassBase< + LinalgStrategyDecomposePass> { LinalgStrategyDecomposePass() = default; @@ -169,7 +184,7 @@ struct LinalgStrategyDecomposePass /// Configurable pass to apply pattern-based linalg peeling. struct LinalgStrategyPeelPass - : public LinalgStrategyPeelPassBase<LinalgStrategyPeelPass> { + : public impl::LinalgStrategyPeelPassBase<LinalgStrategyPeelPass> { LinalgStrategyPeelPass() = default; @@ -203,7 +218,8 @@ struct LinalgStrategyPeelPass /// Configurable pass to apply pattern-based linalg vectorization. struct LinalgStrategyVectorizePass - : public LinalgStrategyVectorizePassBase<LinalgStrategyVectorizePass> { + : public impl::LinalgStrategyVectorizePassBase< + LinalgStrategyVectorizePass> { LinalgStrategyVectorizePass() = default; @@ -259,7 +275,7 @@ struct LinalgStrategyVectorizePass /// Configurable pass to enable the application of other pattern-based linalg /// passes. struct LinalgStrategyEnablePass - : public LinalgStrategyEnablePassBase<LinalgStrategyEnablePass> { + : public impl::LinalgStrategyEnablePassBase<LinalgStrategyEnablePass> { LinalgStrategyEnablePass(LinalgEnablingOptions opt, LinalgTransformationFilter filt) @@ -309,7 +325,7 @@ struct LinalgStrategyEnablePass /// Configurable pass to lower vector operations. struct LinalgStrategyLowerVectorsPass - : public LinalgStrategyLowerVectorsPassBase< + : public impl::LinalgStrategyLowerVectorsPassBase< LinalgStrategyLowerVectorsPass> { LinalgStrategyLowerVectorsPass(LinalgVectorLoweringOptions opt, @@ -374,7 +390,7 @@ struct LinalgStrategyLowerVectorsPass /// Configurable pass to lower vector operations. struct LinalgStrategyRemoveMarkersPass - : public LinalgStrategyRemoveMarkersPassBase< + : public impl::LinalgStrategyRemoveMarkersPassBase< LinalgStrategyRemoveMarkersPass> { void runOnOperation() override { diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp index 3656bc2a1a06..e73d5aba9ff5 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp @@ -6,11 +6,13 @@ // //===----------------------------------------------------------------------===// -#include "PassDetail.h" +#include "mlir/Dialect/Linalg/Passes.h" + +#include "mlir/Dialect/Affine/IR/AffineOps.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" @@ -24,6 +26,13 @@ #include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "llvm/ADT/TypeSwitch.h" +namespace mlir { +#define GEN_PASS_DEF_LINALGLOWERTOAFFINELOOPS +#define GEN_PASS_DEF_LINALGLOWERTOLOOPS +#define GEN_PASS_DEF_LINALGLOWERTOPARALLELLOOPS +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir + using namespace mlir; using namespace mlir::linalg; @@ -311,7 +320,7 @@ static void lowerLinalgToLoopsImpl(func::FuncOp funcOp) { } struct LowerToAffineLoops - : public LinalgLowerToAffineLoopsBase<LowerToAffineLoops> { + : public impl::LinalgLowerToAffineLoopsBase<LowerToAffineLoops> { void getDependentDialects(DialectRegistry ®istry) const override { registry.insert<memref::MemRefDialect>(); } @@ -320,7 +329,7 @@ struct LowerToAffineLoops } }; -struct LowerToLoops : public LinalgLowerToLoopsBase<LowerToLoops> { +struct LowerToLoops : public impl::LinalgLowerToLoopsBase<LowerToLoops> { void getDependentDialects(DialectRegistry ®istry) const override { registry.insert<memref::MemRefDialect, scf::SCFDialect>(); } @@ -330,7 +339,7 @@ struct LowerToLoops : public LinalgLowerToLoopsBase<LowerToLoops> { }; struct LowerToParallelLoops - : public LinalgLowerToParallelLoopsBase<LowerToParallelLoops> { + : public impl::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 1d987ee62c9c..273518f8c382 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp @@ -10,15 +10,20 @@ // canonicalizations of named ops. // //===----------------------------------------------------------------------===// -#include "PassDetail.h" -#include "mlir/Dialect/Linalg/IR/Linalg.h" + #include "mlir/Dialect/Linalg/Passes.h" + +#include "mlir/Dialect/Linalg/IR/Linalg.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_LINALGNAMEDOPCONVERSION +#include "mlir/Dialect/Linalg/Passes.h.inc" +} // namespace mlir + using namespace mlir; using namespace mlir::linalg; @@ -135,7 +140,7 @@ struct SimplifyDepthwiseConvQOp }; struct LinalgNamedOpConversionPass - : public LinalgNamedOpConversionBase<LinalgNamedOpConversionPass> { + : public impl::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 deleted file mode 100644 index 63f947524cc7..000000000000 --- a/mlir/lib/Dialect/Linalg/Transforms/PassDetail.h +++ /dev/null @@ -1,52 +0,0 @@ -//===- 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 4c5fbf98cdf0..79ef14e700ac 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp @@ -10,7 +10,6 @@ // //===----------------------------------------------------------------------===// -#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 55ce5ea66ae3..c24f37949a03 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp @@ -10,14 +10,13 @@ // //===----------------------------------------------------------------------===// -#include <utility> +#include "mlir/Dialect/Linalg/Passes.h" -#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" @@ -28,8 +27,13 @@ #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 using namespace mlir; using namespace mlir::linalg; @@ -744,7 +748,7 @@ static void applyExtractSliceOfPadTensorSwapPattern(func::FuncOp funcOp) { } namespace { -struct LinalgTilingPass : public LinalgTilingBase<LinalgTilingPass> { +struct LinalgTilingPass : public impl::LinalgTilingPassBase<LinalgTilingPass> { LinalgTilingPass() = default; LinalgTilingPass(ArrayRef<int64_t> tileSizes, LinalgTilingLoopType loopType) { this->tileSizes = tileSizes; |