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

Matthias Springer via All-commits all-commits at lists.llvm.org
Wed Jun 19 00:48:50 PDT 2024


  Branch: refs/heads/users/matthias-springer/vector_from_elements
  Home:   https://github.com/llvm/llvm-project
  Commit: dbab92d9293e3f4d34bc11a335db7d19407ab05c
      https://github.com/llvm/llvm-project/commit/dbab92d9293e3f4d34bc11a335db7d19407ab05c
  Author: Matthias Springer <mspringer at nvidia.com>
  Date:   2024-06-19 (Wed, 19 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