[Mlir-commits] [mlir] [mlir][vector] Fold vector extract from insert when trailing unit dims (PR #192109)
Erick Ochoa Lopez
llvmlistbot at llvm.org
Wed Apr 15 09:28:37 PDT 2026
amd-eochoalo wrote:
@joker-eph
> I question that vector.insert is implicitly broadcasting...
Thanks! I spent some time thinking about this. I am leaning towards agreeing with @Groverkss that this is not implicit broadcast. I believe implicit broadcast would look more like the following:
```
// %src : f32
vector.insert %src, %vec [0] : f32 into vector<32x1xf32>
```
where the %src operand would be implicitly broadcasted to be `<1xf32>`.
This definition of implicit broadcasting will be caught by the verifiers.
Changing result here for operand (taken from the RFC) is what I believe is already guaranteed by the op.
> If num_indices == rank, the result is a scalar
> Otherwise (num_indices < rank), the result is a vector
It does look a lot like implicit broadcasting though!
@dcaballe
> This is a different case that is not crossing the scalar/vector boundary and would be turned into a vector.shape_cast by other folders/canonicalization patterns, IIRC.
I disabled the pattern on the PR and it was not turned into vector.shape_cast by the other canonicalization patterns. It is transformed into a vector.shape_cast but only after this pattern is applied first.
https://github.com/llvm/llvm-project/pull/192109
More information about the Mlir-commits
mailing list