[Mlir-commits] [mlir] fd2550d - Adds a flag to optionally disable tosa decompositions

Rob Suderman llvmlistbot at llvm.org
Mon Feb 28 15:44:49 PST 2022


Author: not-jenni
Date: 2022-02-28T15:41:13-08:00
New Revision: fd2550d80cf52c858bcc3644218aeebc063e784a

URL: https://github.com/llvm/llvm-project/commit/fd2550d80cf52c858bcc3644218aeebc063e784a
DIFF: https://github.com/llvm/llvm-project/commit/fd2550d80cf52c858bcc3644218aeebc063e784a.diff

LOG: Adds a flag to optionally disable tosa decompositions

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D120338

Added: 
    

Modified: 
    mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
    mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h b/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
index ec44d01065a7a..fc7fd3790cbf5 100644
--- a/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
+++ b/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h
@@ -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);

diff  --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
index 55b6726efb82f..583ea05279d59 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgPass.cpp
@@ -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());


        


More information about the Mlir-commits mailing list