diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.h b/mlir/include/mlir/Dialect/Linalg/Passes.h --- a/mlir/include/mlir/Dialect/Linalg/Passes.h +++ b/mlir/include/mlir/Dialect/Linalg/Passes.h @@ -143,11 +143,6 @@ linalg::LinalgTransformationFilter(), bool padVectorize = false); -/// Create a LinalgStrategyEnablePass. -std::unique_ptr> createLinalgStrategyEnablePass( - linalg::LinalgEnablingOptions opt = linalg::LinalgEnablingOptions(), - const linalg::LinalgTransformationFilter &filter = - linalg::LinalgTransformationFilter()); /// Create a LinalgStrategyLowerVectorsPass. std::unique_ptr> diff --git a/mlir/include/mlir/Dialect/Linalg/Passes.td b/mlir/include/mlir/Dialect/Linalg/Passes.td --- a/mlir/include/mlir/Dialect/Linalg/Passes.td +++ b/mlir/include/mlir/Dialect/Linalg/Passes.td @@ -253,18 +253,6 @@ ]; } -def LinalgStrategyEnablePass - : Pass<"linalg-strategy-enable-pass", "func::FuncOp"> { - let summary = "Configurable pass to enable the application of other " - "pattern-based linalg passes."; - let constructor = "mlir::createLinalgStrategyEnablePass()"; - let dependentDialects = ["linalg::LinalgDialect"]; - let options = [ - Option<"anchorFuncName", "anchor-func", "std::string", /*default=*/"", - "Which func op is the anchor to latch on.">, - ]; -} - def LinalgStrategyLowerVectorsPass : Pass<"linalg-strategy-lower-vectors-pass", "func::FuncOp"> { let summary = "Configurable pass to lower vector operations."; diff --git a/mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp b/mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/CodegenStrategy.cpp @@ -42,8 +42,6 @@ : linalg::LinalgTransformationFilter( t->filter, currentState, nextState); t->addToPassPipeline(pm, filter); - if (addEnablePass) - pm.addPass(createLinalgStrategyEnablePass(linalgEnablingOptions)); } pm.addPass(createLinalgStrategyRemoveMarkersPass()); } diff --git a/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp b/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/LinalgStrategyPasses.cpp @@ -41,7 +41,6 @@ #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" @@ -272,56 +271,6 @@ LinalgTransformationFilter filter; }; -/// Configurable pass to enable the application of other pattern-based linalg -/// passes. -struct LinalgStrategyEnablePass - : public impl::LinalgStrategyEnablePassBase { - - LinalgStrategyEnablePass(LinalgEnablingOptions opt, - LinalgTransformationFilter filt) - : options(opt), filter(std::move(filt)) {} - - void runOnOperation() override { - auto funcOp = getOperation(); - if (!anchorFuncName.empty() && funcOp.getName() != anchorFuncName) - return; - - MLIRContext *context = funcOp.getContext(); - RewritePatternSet patterns = - linalg::getLinalgTilingCanonicalizationPatterns(context); - scf::populateSCFForLoopCanonicalizationPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) - return signalPassFailure(); - - if (options.licm) { - funcOp->walk([&](LoopLikeOpInterface loopLike) { - moveLoopInvariantCode(loopLike); - }); - } - - // Gathers all innermost loops through a post order pruned walk. - funcOp.walk([](Operation *op) { - if (auto forOp = dyn_cast(op)) - (void)promoteIfSingleIteration(forOp); - else if (auto forOp = dyn_cast(op)) - (void)promoteIfSingleIteration(forOp); - }); - if (options.hoistRedundantVectorTransfers) - hoistRedundantVectorTransfers(funcOp); - - if (options.hoistRedundantVectorTransfersOnTensor) - hoistRedundantVectorTransfersOnTensor(funcOp); - - // Run CSE to cleanup after canonicalization. - OpPassManager dynamicPM("func.func"); - dynamicPM.addPass(createCSEPass()); - if (failed(runPipeline(dynamicPM, funcOp))) - return signalPassFailure(); - } - - LinalgEnablingOptions options; - LinalgTransformationFilter filter; -}; /// Configurable pass to lower vector operations. struct LinalgStrategyLowerVectorsPass @@ -454,13 +403,6 @@ padVectorize); } -/// Create a LinalgStrategyEnablePass. -std::unique_ptr> -mlir::createLinalgStrategyEnablePass(LinalgEnablingOptions opt, - const LinalgTransformationFilter &filter) { - return std::make_unique(opt, filter); -} - /// Create a LinalgStrategyLowerVectorsPass. std::unique_ptr> mlir::createLinalgStrategyLowerVectorsPass(