[Mlir-commits] [mlir] [mlir] [linalg] Add canonicalize pattern to swap transpose with broadcast (PR #97063)
donald chen
llvmlistbot at llvm.org
Thu Jul 4 22:11:38 PDT 2024
cxy-1993 wrote:
> This looks like an interesting canonicalization, indeed!
>
> Two side effects we should watch out for:
>
> 1. This may lead to not only lit test failures but also to performance regressions if we turn a transpose with a highly optimized lowering into a simpler transpose that falls into a default lowering path.
> 2. We may get some performance improvements if we get rid of the transpose in `transpose(broadcast(1D->2D))` (assuming the transpose is not already optimized away somehow). We should add a test for this scenario.
>
> An interesting follow-up would be to consider scenarios where a type conversion happens between the broadcast and the transpose.
Thanks for the comment. I have considered the issue you mentioned. If there is a performance improvement for some special permutation transpose, then using expand shape should be a better solution. Of course, if this pattern breaks downstream repos, please feel free to discuss and remove it.
https://github.com/llvm/llvm-project/pull/97063
More information about the Mlir-commits
mailing list