[Mlir-commits] [mlir] [mlir] [linalg] Add canonicalize pattern to swap transpose with broadcast (PR #97063)

Diego Caballero llvmlistbot at llvm.org
Thu Jul 4 10:45:25 PDT 2024


================
@@ -1890,9 +1890,67 @@ struct FoldTransposeWithTranspose : OpRewritePattern<linalg::TransposeOp> {
   }
 };
 
+/// This pattern reduces the cost of transpose by swapping the order of
+/// broadcast and transpose:
+///   transpose(broadcast(input)) -> broadcast(transpose(input))
----------------
dcaballe wrote:

I wouldn't say "reduces the cost of transpose" as this may turn a transpose with a performant implementation into a simpler one that may or may not have a performant implementation. I would just describe this as a canonicalization pattern.

https://github.com/llvm/llvm-project/pull/97063


More information about the Mlir-commits mailing list