# \[RFC, mlir, vector\] Deprecate then remove \`vector.splat\`

**URL:** <https://discourse.llvm.org/t/rfc-mlir-vector-deprecate-then-remove-vector-splat/87143>\
**Category:** MLIR\
**Tags:** mlir\
**Created:** [June 30, 2025, 4:58pm UTC](https://discourse.llvm.org/t/rfc-mlir-vector-deprecate-then-remove-vector-splat/87143 "2025-06-30T16:58:34Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![newling](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/newling/32/16483_2.png) [@newling](https://discourse.llvm.org/u/newling)\
**Post date:** [June 30, 2025, 4:58pm UTC](https://discourse.llvm.org/t/rfc-mlir-vector-deprecate-then-remove-vector-splat/87143/1 "2025-06-30T16:58:34Z")

</div>

### Motivation

`vector.splat` is a subset of `vector.broadcast`. In other words what can be expressed with splat

```auto
%v1 = vector.splat %x : vector<2x4x3xi32>

```

can also be represented by broadcast

```auto
%v1 = vector.broadcast %x : f32 to vector<2x4x3xi32>

```

`vector.splat` is a special case of `vector.broadcast` but it is easy to recognise a `vector.broadcast` that is a `vector.splat`, so if we removed `vector.splat` we wouldn’t lose optimization opportunities.

Maintaining `vector.splat` requires work. For example in the last 2 months there are 3 commits primarily about `vector.splat`. So, I propose investing time now to save it in the future!

### History

BroadcastOp was introduced in **2019** , in [this commit](https://github.com/llvm/llvm-project/commit/cf97263cb8cd4f6f21f00eabb9d6a007e221eaab). SplatOp was introduced in **Feb 2022** [here](https://reviews.llvm.org/D118202) as part of the effort to remove the std dialect. It was noted there that `vector.broadcast` already existed. From what I can tell the general consensus there was that `vector.splat` should be removed as a follow-up. One other suggestion there was that `vector.splat` should be kept but that `vector.broadcast` only accepts vector operand. So I guess there are 3 options:

### Option 1

Leave `vector.splat` and `vector.broadcast` as they are.

### Option 2

Remove `vector.splat`.

### Option 3

Disallow scalar operand for `vector.broadcast`.

#### Next steps

My preference would be option 2. Steps for removal could follow those of `vector.extract_element` and `vector.insert_element` in [[RFC][PSA?] Remove `vector.extractelement` and `vector.insertelement` ops in favor of `vector.extract` and `vector.insert` ops](https://discourse.llvm.org/t/rfc-psa-remove-vector-extractelement-and-vector-insertelement-ops-in-favor-of-vector-extract-and-vector-insert-ops/71116)

If we reach agreement on one of the options above, I am happy to explore further and define a more detailed series of steps. Help in executing would be extremely welcome!

---

_[View the full topic](https://discourse.llvm.org/t/rfc-mlir-vector-deprecate-then-remove-vector-splat/87143)._
