[Mlir-commits] [mlir] [mlir] Move vector.{to_elements, from_elements} unrolling to `VectorUnroll.cpp` (PR #159118)

Erick Ochoa Lopez llvmlistbot at llvm.org
Thu Sep 18 06:01:13 PDT 2025


================
@@ -884,6 +917,50 @@ struct UnrollStepPattern : public OpRewritePattern<vector::StepOp> {
   vector::UnrollVectorOptions options;
 };
 
+/// Unrolls 2 or more dimensional `vector.from_elements` ops by unrolling the
+/// outermost dimension. For example:
+/// ```
+/// %v = vector.from_elements %e0, %e1, %e2, %e3, %e4, %e5 : vector<2x3xf32>
+///
+/// ==>
+///
+/// %0   = ub.poison : vector<2x3xf32>
+/// %v0  = vector.from_elements %e0, %e1, %e2 : vector<3xf32>
+/// %1   = vector.insert %v0, %0 [0] : vector<3xf32> into vector<2x3xf32>
+/// %v1  = vector.from_elements %e3, %e4, %e5 : vector<3xf32>
+/// %v   = vector.insert %v1, %1 [1] : vector<3xf32> into vector<2x3xf32>
+/// ```
+///
+/// When applied exhaustively, this will produce a sequence of 1-d from_elements
+/// ops.
----------------
amd-eochoalo wrote:

https://github.com/llvm/llvm-project/pull/159118/commits/5d7afb1efd4a2b05918044c1bf0b46773b41619c

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


More information about the Mlir-commits mailing list