vector.splat is a subset of vector.broadcast. In other words what can be expressed with splat
%v1 = vector.splat %x : vector<2x4x3xi32>
can also be represented by broadcast
%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. SplatOp was introduced in Feb 2022here 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.
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!
+1 to option 2. Thanks a lot for proposing this! Indeed, keeping both ops around has been expensive… I think this deprecation should be easier than vector.extractelements and vector.insertelements, as vector.broadcast has been used more broadly than vector.splat and existing vector.splat canonicalizations should be a subset of vector.broadcast canonicalizations. Let’s see how it goes…
I’m done with the preparation work, and think the next step is complete removal. When should this happen? I’m not familiar with the release process, do we just let this sit in a ‘deprecated’ state for a few months/years, and then remove it? Note that we now have a notice about this here: Deprecations & Current Refactoring - MLIR