[Mlir-commits] [mlir] [mlir][vector] shape_cast(broadcast) -> broadcast canonicalization (PR #134939)

James Newling llvmlistbot at llvm.org
Wed Apr 9 13:47:45 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
----------------
newling wrote:

Makes sense, thanks. Docs updated, and I've updated the logic to now try and canonicalize to a ShapeCast before a Broadcast. 

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


More information about the Mlir-commits mailing list