mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-05 00:48:08 +00:00
[mlir][linalg] Retire LinalgStrategyEnablePass
This revision retires LinalgStrategyEnablePass. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D133557
This commit is contained in:
parent
681d0d9e5f
commit
1e2b4ff936
@ -143,12 +143,6 @@ std::unique_ptr<OperationPass<func::FuncOp>> createLinalgStrategyVectorizePass(
|
||||
linalg::LinalgTransformationFilter(),
|
||||
bool padVectorize = false);
|
||||
|
||||
/// Create a LinalgStrategyEnablePass.
|
||||
std::unique_ptr<OperationPass<func::FuncOp>> createLinalgStrategyEnablePass(
|
||||
linalg::LinalgEnablingOptions opt = linalg::LinalgEnablingOptions(),
|
||||
const linalg::LinalgTransformationFilter &filter =
|
||||
linalg::LinalgTransformationFilter());
|
||||
|
||||
/// Create a LinalgStrategyLowerVectorsPass.
|
||||
std::unique_ptr<OperationPass<func::FuncOp>>
|
||||
createLinalgStrategyLowerVectorsPass(
|
||||
|
@ -253,18 +253,6 @@ def LinalgStrategyVectorizePass
|
||||
];
|
||||
}
|
||||
|
||||
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.";
|
||||
|
@ -42,8 +42,6 @@ void mlir::linalg::CodegenStrategy::configurePassPipeline(
|
||||
: linalg::LinalgTransformationFilter(
|
||||
t->filter, currentState, nextState);
|
||||
t->addToPassPipeline(pm, filter);
|
||||
if (addEnablePass)
|
||||
pm.addPass(createLinalgStrategyEnablePass(linalgEnablingOptions));
|
||||
}
|
||||
pm.addPass(createLinalgStrategyRemoveMarkersPass());
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ namespace mlir {
|
||||
#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,57 +271,6 @@ struct LinalgStrategyVectorizePass
|
||||
LinalgTransformationFilter filter;
|
||||
};
|
||||
|
||||
/// Configurable pass to enable the application of other pattern-based linalg
|
||||
/// passes.
|
||||
struct LinalgStrategyEnablePass
|
||||
: public impl::LinalgStrategyEnablePassBase<LinalgStrategyEnablePass> {
|
||||
|
||||
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<AffineForOp>(op))
|
||||
(void)promoteIfSingleIteration(forOp);
|
||||
else if (auto forOp = dyn_cast<scf::ForOp>(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
|
||||
: public impl::LinalgStrategyLowerVectorsPassBase<
|
||||
@ -454,13 +402,6 @@ mlir::createLinalgStrategyVectorizePass(
|
||||
padVectorize);
|
||||
}
|
||||
|
||||
/// Create a LinalgStrategyEnablePass.
|
||||
std::unique_ptr<OperationPass<func::FuncOp>>
|
||||
mlir::createLinalgStrategyEnablePass(LinalgEnablingOptions opt,
|
||||
const LinalgTransformationFilter &filter) {
|
||||
return std::make_unique<LinalgStrategyEnablePass>(opt, filter);
|
||||
}
|
||||
|
||||
/// Create a LinalgStrategyLowerVectorsPass.
|
||||
std::unique_ptr<OperationPass<func::FuncOp>>
|
||||
mlir::createLinalgStrategyLowerVectorsPass(
|
||||
|
Loading…
x
Reference in New Issue
Block a user