[all-commits] [llvm/llvm-project] 5fdd3a: [mlir][vector] Follow-up improvements for multi-di...

Yang Bai via All-commits all-commits at lists.llvm.org
Wed Aug 27 21:41:28 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5fdd3a12e5aaab8411a64ac2e5e162d490c3161d
      https://github.com/llvm/llvm-project/commit/5fdd3a12e5aaab8411a64ac2e5e162d490c3161d
  Author: Yang Bai <baiyang0132 at gmail.com>
  Date:   2025-08-27 (Wed, 27 Aug 2025)

  Changed paths:
    M mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
    M mlir/test/Dialect/Vector/linearize.mlir

  Log Message:
  -----------
  [mlir][vector] Follow-up improvements for multi-dimensional vector.from_elements support (#154664)

This PR is a follow-up to #151175 that supported lowering
multi-dimensional `vector.from_elements` op to LLVM by introducing a
unrolling pattern.

## Changes

### Add `vector.shape_cast` based flattening pattern for
`vector.from_elements`

This change introduces a new linearization pattern that uses
`vector.shape_cast` to flatten multi-dimensional `vector.from_elements`
operations. This provides an alternative approach to the unrolling-based
method introduced in #151175.

**Example:**
```mlir
// Before
%v = vector.from_elements %e0, %e1, %e2, %e3 : vector<2x2xf32>

// After
%flat = vector.from_elements %e0, %e1, %e2, %e3 : vector<4xf32>
%result = vector.shape_cast %flat : vector<4xf32> to vector<2x2xf32>
```

---------

Co-authored-by: Yang Bai <yangb at nvidia.com>
Co-authored-by: James Newling <james.newling at gmail.com>



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