[Mlir-commits] [mlir] [mlir][vector] Fold transpose(broadcast(shape_cast)) to broadcast (PR #215940)
Jianhui Li
llvmlistbot at llvm.org
Thu Aug 20 23:04:34 PDT 2026
Jianhui-Li wrote:
> The folding use case is sound and helpful; +1 for the rewrite itself.
>
> From high-level, the new folder performs similar job to existing `FoldTransposeBroadcast` but it essentially just swaps source from `broadcast` to the producer's `shape_cast` value (with extra preconditions) and then performs general validation whether `transpose(broadcast)` can be applied.
>
> It looks to me that `FoldTransposeBroadcast` already contains exhaustive validation and rewrite logic. I wonder if the two patterns could be refactored to use the same core folder logic with the delta being using mostly different source values? If possible, it'd reduce maintenance and ensure the two rewrites don't diverge.
Thanks. Refactored so now two patterns share the same validation logic. It simplified FoldTransposeBroadcast implementation and increases its scope.
https://github.com/llvm/llvm-project/pull/215940
More information about the Mlir-commits
mailing list