[Mlir-commits] [mlir] [mlir] [vector] Reorder element/broadcast for FMA if the source is not scalar (PR #211208)

Diego Caballero llvmlistbot at llvm.org
Thu Jul 23 06:13:55 PDT 2026


dcaballe wrote:

Thanks for the contribution!

I'm not sure what you are trying to achieve. The intent of this pass is to minimize redundant computation on the same data. For your example:
```
  %0 = vector.broadcast %arg0 : vector<4xf32> to vector<3x4xf32>
  %1 = vector.broadcast %arg1 : f32 to vector<3x4xf32>
  %2 = vector.broadcast %arg2 : vector<4xf32> to vector<3x4xf32>
  %3 = vector.fma %0, %1, %2 : vector<3x4xf32>
```

I would expect that broadcasts on `%arg0` and `%arg2` are removed but `%arg1` is broadcasted to `<4xf32>`. Then FMA would happen on `<4xf32>`, followed by the broadcast to `<3x4xf32>`.

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


More information about the Mlir-commits mailing list