[Mlir-commits] [mlir] [MLIR][Vector] Fix ShapeCastBroadcastFolder when shape_cast changes non-unit dim strides (PR #227574)

Andrzej WarzyƄski llvmlistbot at llvm.org
Sat Oct 3 08:57:18 PDT 2026


banach-space wrote:

This makes sense, but I think that we should start by completing the docs for `vector.broadcast`: 
* https://github.com/llvm/llvm-project/pull/228727

Once the formula is in place, this becomes indisputable:
> Since vector.shape_cast preserves the flattened 1-D (row-major) element order, shape_cast(broadcast(src, broadcastShape), dstShape) produces the exact same elements as broadcast(src, dstShape) if and only if every non-unit dimension of src (srcDim != 1) has the same linear stride in both broadcastShape and dstShape.

@yueshengys and @FedericoBruzzone , lets make sure that we are all on the same page and that #228727 makes sense before we proceed. Thanks!

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


More information about the Mlir-commits mailing list