[Mlir-commits] [mlir] [mlir][vector] Support multi-dimensional vectors in VectorFromElementsLowering (PR #151175)
Kunwar Grover
llvmlistbot at llvm.org
Fri Aug 8 07:25:49 PDT 2025
Groverkss wrote:
> The idea is to have a vector-to-vector lowering [here](https://github.com/llvm/llvm-project/blob/193995d5a21dc8b923e19d9370aa8e1f374cd940/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp#L80), and to keep the actual vector-to-llvm conversion simple and restricted to already 'lowered' vector ops.
>
> So I guess the request is to implement a function `populateVectorFromElementsOpLoweringPatterns`. Or my suggestion was to add a pattern there to split a rank-D from_elements op into a rank-1 from_elements op preceded by a shape_cast, and then `populateVectorShapeCastLoweringPatterns` will kick in and generate the inserts/extracts.
I'm not sure about this approach. There are two approaches that can be taken in general, unrolling or flattening. I would much rather us do unrolling for lowering. While flattenting looks nice, it can sometimes generate shuffles (by generating extract_strided_slice/insert_strided_slice).
We also need to be consistent across lowerings, if one lowering does flattenting while other does unrolling, we start relying too much on LLVM to cleanup code that we generated.
https://github.com/llvm/llvm-project/pull/151175
More information about the Mlir-commits
mailing list