[Mlir-commits] [mlir] [MLIR][TOSA] Add --tosa-remove-redundant-transposes pass (PR #108260)
Mehdi Amini
llvmlistbot at llvm.org
Thu Sep 12 03:05:30 PDT 2024
================
@@ -126,4 +126,20 @@ def TosaValidation : Pass<"tosa-validate", "mlir::ModuleOp"> {
];
}
+def TosaRemoveRedundantTransposes : Pass<"tosa-remove-redundant-transposes", "func::FuncOp"> {
+ let summary = "Remove redundant transposes";
+ let description = [{
+ Pass that identifies and removes redundant tosa.TRANSPOSE operations.
+ It does so by traversing dependencies of tosa.TRANSPOSE operations until they terminate in either
+ tosa.RESHAPE, a nullifying tosa.TRANSPOSE, or a tosa.CONST. It then propagates the downstream
+ transform upward through the intervening operators if it is able and replaces the downstream tosa.TRANSPOSE.
+ Results generally better when run after Canonicalization and resolution of dynamic shapes.
+ Canonicalization is required for dead code elimination after pass is run.
+ This pass has an important use-case in cleaning up the results of frameworks that introduce a lot
+ of data-layout transformations when legalizing to TOSA, a common one being transformations between NHWC and NCHW
+ layouts.
+ }];
+ let constructor = "tosa::createTosaRemoveRedundantTransposes()";
----------------
joker-eph wrote:
Please remove this line, it'll be all auto-generated.
https://github.com/llvm/llvm-project/pull/108260
More information about the Mlir-commits
mailing list