Adds a flag to optionally disable tosa decompositions

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D120338
This commit is contained in:
not-jenni 2022-02-28 15:30:13 -08:00 committed by Rob Suderman
parent 19d8642633
commit fd2550d80c
2 changed files with 8 additions and 4 deletions

View File

@ -24,8 +24,10 @@ 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.
void addTosaToLinalgPasses(OpPassManager &pm);
/// pipeline succeeds. The option to disable decompositions is available for
/// benchmarking performance improvements from the canonicalizations.
void addTosaToLinalgPasses(OpPassManager &pm,
bool disableTosaDecompositions = false);
/// Populates conversion passes from TOSA dialect to Linalg dialect.
void populateTosaToLinalgConversionPatterns(RewritePatternSet *patterns);

View File

@ -67,9 +67,11 @@ std::unique_ptr<Pass> mlir::tosa::createTosaToLinalg() {
return std::make_unique<TosaToLinalg>();
}
void mlir::tosa::addTosaToLinalgPasses(OpPassManager &pm) {
void mlir::tosa::addTosaToLinalgPasses(OpPassManager &pm,
bool disableTosaDecompositions) {
// Optional decompositions are designed to benefit linalg.
pm.addNestedPass<FuncOp>(mlir::tosa::createTosaOptionalDecompositions());
if (!disableTosaDecompositions)
pm.addNestedPass<FuncOp>(mlir::tosa::createTosaOptionalDecompositions());
pm.addNestedPass<FuncOp>(mlir::createCanonicalizerPass());
pm.addNestedPass<FuncOp>(tosa::createTosaMakeBroadcastablePass());