[Mlir-commits] [mlir] [mlir][vector] Fold vector extract from insert when trailing unit dims (PR #192109)

Mehdi Amini llvmlistbot at llvm.org
Wed Apr 15 09:59:35 PDT 2026


joker-eph wrote:

> I compared the pattern being matched here with your RFC and by the definition of implicit broadcast given on the RFC (and adapting it for vector.insert) I found and reported where they don't exactly match (and hence why I said that it didn't match that definition of implicit broadcast).

Of course it's not an exact match, but it looks to me pretty close in principle.
Basically we allow a mismatch of type and the operation performs **more** than just what it says it does (the name say "insert", but it actually does more). 
Again, the fact that we fold the insert/extract pair (because it's a no-op, or rather should be) into a broadcast should be self-illustrative of the semantics issue I'm describing.

>> I wonder if insert shouldn't just follow extract here.
> which I think the logic above shows that it already does follow the same logic. Please correct me if I'm wrong.

By this, I mean that the RFC was about this: the op should be doing **only** extraction and not more. The type matching should be exact: if I insert a scalar into a vector, I should provide the indexing down to the last element. If I insert a vector, I should provide the indexing into the destination vector so that we have an exact shape match for the inserted vector.



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


More information about the Mlir-commits mailing list