[Mlir-commits] [mlir] [mlir][vector] ND vectors linearization pass (PR #81159)

Diego Caballero llvmlistbot at llvm.org
Thu Feb 8 10:57:20 PST 2024


https://github.com/dcaballe requested changes to this pull request.

Hey, thanks for the contribution!

I think we should look at applying vector unrolling instead or linearization. It's currently happening at LLVM level but we have always talked about moving it to an earlier stage so that the lowering to LLVM and SPIR-V are aligned. 

Collapsing some vector dimensions is definitely beneficial for some cases, esp. when the trailing dimension can't fill a full 1-D physical vector register, such as in your test (I think @hanhanW was working on something for these cases). However, I'm not sure we can apply it in a general way. For example, we couldn't turn an arbitrary `vector<2x2xf32>` load/store into a `vector<4xf32>` one because elements might not be contiguous in memory across the dimensions. Also, by linearizing an n-D vector instead of unrolling it, we are losing control on the actual vector length used and relying on the hardware backend to do what we expected, which is something we have been trying to avoid.

Would vector unrolling work for your case?

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


More information about the Mlir-commits mailing list