[Mlir-commits] [mlir] [mlir][vector] shape_cast(broadcast) -> broadcast canonicalization (PR #134939)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Wed Apr 9 02:01:35 PDT 2025
================
@@ -5778,8 +5778,7 @@ class ShapeCastCreateMaskFolderTrailingOneDim final
/// Pattern to rewrite a ShapeCast(Broadcast) -> Broadcast.
/// This only applies when the shape of the broadcast source
-/// 1. is a suffix of the shape of the result (i.e. when broadcast without
-/// reshape is expressive enough to capture the result in a single op), or
+/// 1. can be broadcast directly to the final shape, or
/// 2. has the same element count as the shape cast result.
----------------
banach-space wrote:
Doesn't this case mean that the broadcast is redundant and that the pattern will do this instead:
* ShapeCast(Broadcast(src)) -> ShapCast(src)
? IIUC, that's tested in `canonicalize_broadcast_shapecast_to_shapecast`?
https://github.com/llvm/llvm-project/pull/134939
More information about the Mlir-commits
mailing list