[Mlir-commits] [mlir] [mlir][vector] Add `vector.from_elements` op (PR #95938)

Matthias Springer llvmlistbot at llvm.org
Wed Jun 19 00:21:04 PDT 2024


================
@@ -1836,6 +1836,34 @@ struct VectorDeinterleaveOpLowering
   }
 };
 
+/// Conversion pattern for a `vector.from_elements`.
+struct VectorFromElementsLowering
+    : public ConvertOpToLLVMPattern<vector::FromElementsOp> {
+  using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern;
+
+  LogicalResult
+  matchAndRewrite(vector::FromElementsOp fromElementsOp, OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    Location loc = fromElementsOp.getLoc();
+    VectorType vectorType = fromElementsOp.getType();
+    // TODO: Multi-dimensional vectors lower to !llvm.array<... x vector<>>.
+    // Such ops should be handled in the same way as vector.insert.
+    if (vectorType.getRank() > 1)
----------------
matthias-springer wrote:

The op itself supports >1D. (And we have foldings etc.) Just the LLVM lowering is not implemented yet.


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


More information about the Mlir-commits mailing list