[all-commits] [llvm/llvm-project] 0f9835: [mlir][vector] Add `vector.from_elements` op

Matthias Springer via All-commits all-commits at lists.llvm.org
Tue Jun 18 07:42:05 PDT 2024


  Branch: refs/heads/users/matthias-springer/vector_from_elements
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f9835fc464430b00e24c66d8213acd81c24dd1b
      https://github.com/llvm/llvm-project/commit/0f9835fc464430b00e24c66d8213acd81c24dd1b
  Author: Matthias Springer <mspringer at nvidia.com>
  Date:   2024-06-18 (Tue, 18 Jun 2024)

  Changed paths:
    M mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
    M mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
    M mlir/lib/Dialect/Vector/IR/VectorOps.cpp
    M mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
    M mlir/test/Dialect/Vector/canonicalize.mlir
    M mlir/test/Dialect/Vector/invalid.mlir
    M mlir/test/Dialect/Vector/ops.mlir

  Log Message:
  -----------
  [mlir][vector] Add `vector.from_elements` op

This commit adds a new operation to the vector dialect: `vector.from_elements`

The op constructs a new vector from a given list of scalar values. It is similar to `tensor.from_elements`.

Constructing a new vector from elements was tedious before this op existed: a typical way was to define an `arith.constant ... : vector<...>`, followed by a chain of `vector.insert`.

Folders/canonicalizations are added that can fold `vector.extract` ops and convert the `vector.from_elements` op into a `vector.splat` op.

The LLVM lowering generates an `llvm.mlir.undef`, followed by a sequence of scalar insertions in the form of `llvm.insertelement`. Only 0-D and 1-D vectors are currently supported in the LLVM lowering.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list