<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[MLIR][Vector] Add unroll pattern for vector.shape_cast (#167738)</title>
<updated>2025-11-20T00:16:44+00:00</updated>
<author>
<name>Nishant Patel</name>
<email>nishant.b.patel@intel.com</email>
</author>
<published>2025-11-20T00:16:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=af73aeaa19929127655d544b48a5145105e9e28c'/>
<id>af73aeaa19929127655d544b48a5145105e9e28c</id>
<content type='text'>
This PR adds pattern for unrolling shape_cast given a targetShape. This
PR is a follow up of #164010 which was very general and was using
inserts and extracts on each element (which is also
LowerVectorShapeCast.cpp is doing).
After doing some more research on use cases, we (me and @Jianhui-Li )
realized that the previous version in #164010 is unnecessarily generic
and doesn't fit our performance needs.

Our use case requires that targetShape is contiguous in both source and
result vector.

This pattern only applies when contiguous slices can be extracted from
the source vector and inserted into the result vector such that each
slice remains in vector form with targetShape (and not decompose to
scalars). In these cases, the unrolling proceeds as:

vector.extract_strided_slice -&gt; vector.shape_cast (on the slice
unrolled) -&gt; vector.insert_strided_slice</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds pattern for unrolling shape_cast given a targetShape. This
PR is a follow up of #164010 which was very general and was using
inserts and extracts on each element (which is also
LowerVectorShapeCast.cpp is doing).
After doing some more research on use cases, we (me and @Jianhui-Li )
realized that the previous version in #164010 is unnecessarily generic
and doesn't fit our performance needs.

Our use case requires that targetShape is contiguous in both source and
result vector.

This pattern only applies when contiguous slices can be extracted from
the source vector and inserted into the result vector such that each
slice remains in vector form with targetShape (and not decompose to
scalars). In these cases, the unrolling proceeds as:

vector.extract_strided_slice -&gt; vector.shape_cast (on the slice
unrolled) -&gt; vector.insert_strided_slice</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Vector] Add patterns to lower `vector.shuffle` (#157611)</title>
<updated>2025-09-17T01:01:30+00:00</updated>
<author>
<name>Diego Caballero</name>
<email>dieg0ca6aller0@gmail.com</email>
</author>
<published>2025-09-17T01:01:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7bdd88c1e3a70d8213f8bc68403fbd844f11b00c'/>
<id>7bdd88c1e3a70d8213f8bc68403fbd844f11b00c</id>
<content type='text'>
This PR adds patterns to lower `vector.shuffle` with inputs with
different vector sizes more efficiently. The current LLVM lowering for
these cases degenerates to a sequence of `vector.extract` and
`vector.insert` operations. With this PR, the smaller input is promoted
to larger vector size by introducing an extra `vector.shuffle`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds patterns to lower `vector.shuffle` with inputs with
different vector sizes more efficiently. The current LLVM lowering for
these cases degenerates to a sequence of `vector.extract` and
`vector.insert` operations. With this PR, the smaller input is promoted
to larger vector size by introducing an extra `vector.shuffle`.</pre>
</div>
</content>
</entry>
<entry>
<title>[MLIR][Vector] Add unrolling pattern for vector StepOp (#157752)</title>
<updated>2025-09-16T22:33:08+00:00</updated>
<author>
<name>Nishant Patel</name>
<email>nishant.b.patel@intel.com</email>
</author>
<published>2025-09-16T22:33:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0e5c32bd6d305f417d1b4fc023616711206eccc4'/>
<id>0e5c32bd6d305f417d1b4fc023616711206eccc4</id>
<content type='text'>
This PR adds unrolling pattern for vector.step op to VectorUnroll
transform.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds unrolling pattern for vector.step op to VectorUnroll
transform.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][vector] Tidy-up testing for to/from_elements unrolling (#158309)</title>
<updated>2025-09-15T07:35:03+00:00</updated>
<author>
<name>Andrzej Warzyński</name>
<email>andrzej.warzynski@arm.com</email>
</author>
<published>2025-09-15T07:35:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0ee7c9434a4745a10cb68217134a356b63a346f9'/>
<id>0ee7c9434a4745a10cb68217134a356b63a346f9</id>
<content type='text'>
1. Remove `TestUnrollVectorToElements` and
   `TestUnrollVectorFromElements` test passes - these are not required.
2. Make "vector-from-elements-lowering.mlir" use TD Op for testing (for
   consistency "vector-to-elements-lowering.mlir" and to make sure that
   the TD Op, `transform.apply_patterns.vector.unroll_from_elements`, is
   tested).
3. Unify `CHECK` prefixes (`CHECK-UNROLL` -&gt; `CHECK`).
4. Rename `@to_elements_1d` as `@negative_unroll_to_elements_1d`, for
   consistency with it's counterpart for `vector.from_elements` and to
   align with our testing guide (*).

(*)
https://mlir.llvm.org/getting_started/TestingGuide/#after-step-3-add-the-newly-identified-missing-case</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1. Remove `TestUnrollVectorToElements` and
   `TestUnrollVectorFromElements` test passes - these are not required.
2. Make "vector-from-elements-lowering.mlir" use TD Op for testing (for
   consistency "vector-to-elements-lowering.mlir" and to make sure that
   the TD Op, `transform.apply_patterns.vector.unroll_from_elements`, is
   tested).
3. Unify `CHECK` prefixes (`CHECK-UNROLL` -&gt; `CHECK`).
4. Rename `@to_elements_1d` as `@negative_unroll_to_elements_1d`, for
   consistency with it's counterpart for `vector.from_elements` and to
   align with our testing guide (*).

(*)
https://mlir.llvm.org/getting_started/TestingGuide/#after-step-3-add-the-newly-identified-missing-case</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][vector] Add a new TD op to wrap unit-dim collapsing patterns (#157507)</title>
<updated>2025-09-12T10:09:06+00:00</updated>
<author>
<name>Andrzej Warzyński</name>
<email>andrzej.warzynski@arm.com</email>
</author>
<published>2025-09-12T10:09:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=77596b78e5664fff8d272599c0420fc9b87e2c2d'/>
<id>77596b78e5664fff8d272599c0420fc9b87e2c2d</id>
<content type='text'>
Adds a new TD Op,
  * `apply_patterns.vector.drop_inner_most_unit_dims_from_xfer_ops`,

which wraps the following Vector patterns:

  * `DropInnerMostUnitDimsTransferRead`
  * `DropInnerMostUnitDimsTransferWrite`

This complements other existing unit-dimension–related patterns.

To reduce duplication, the
`TestVectorTransferCollapseInnerMostContiguousDims`
pass has been removed. That pass was only used for testing, and its
functionality is now covered by the newly added TD Op.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adds a new TD Op,
  * `apply_patterns.vector.drop_inner_most_unit_dims_from_xfer_ops`,

which wraps the following Vector patterns:

  * `DropInnerMostUnitDimsTransferRead`
  * `DropInnerMostUnitDimsTransferWrite`

This complements other existing unit-dimension–related patterns.

To reduce duplication, the
`TestVectorTransferCollapseInnerMostContiguousDims`
pass has been removed. That pass was only used for testing, and its
functionality is now covered by the newly added TD Op.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][vector] Add vector.to_elements unrolling (#157142)</title>
<updated>2025-09-11T17:56:57+00:00</updated>
<author>
<name>Erick Ochoa Lopez</name>
<email>erick.ochoalopez@amd.com</email>
</author>
<published>2025-09-11T17:56:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9d19250610fdaa80600d32fc7f6e06dcefd6bbff'/>
<id>9d19250610fdaa80600d32fc7f6e06dcefd6bbff</id>
<content type='text'>
This PR adds support for unrolling `vector.to_element`'s source operand.

It transforms

```mlir
%0:8 = vector.to_elements %v : vector&lt;2x2x2xf32&gt;
```

to

```mlir
%v0 = vector.extract %v[0] : vector&lt;2x2xf32&gt; from vector&lt;2x2x2xf32&gt;
%v1 = vector.extract %v[1] : vector&lt;2x2xf32&gt; from vector&lt;2x2x2xf32&gt;
%0:4 = vector.to_elements %v0 : vector&lt;2x2xf32&gt;
%1:4 = vector.to_elements %v1 : vector&lt;2x2xf32&gt;
// %0:8 = %0:4 - %1:4
```

This pattern will be applied until there are only 1-D vectors left.

---------

Signed-off-by: hanhanW &lt;hanhan0912@gmail.com&gt;
Co-authored-by: hanhanW &lt;hanhan0912@gmail.com&gt;
Co-authored-by: Jakub Kuderski &lt;kubakuderski@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR adds support for unrolling `vector.to_element`'s source operand.

It transforms

```mlir
%0:8 = vector.to_elements %v : vector&lt;2x2x2xf32&gt;
```

to

```mlir
%v0 = vector.extract %v[0] : vector&lt;2x2xf32&gt; from vector&lt;2x2x2xf32&gt;
%v1 = vector.extract %v[1] : vector&lt;2x2xf32&gt; from vector&lt;2x2x2xf32&gt;
%0:4 = vector.to_elements %v0 : vector&lt;2x2xf32&gt;
%1:4 = vector.to_elements %v1 : vector&lt;2x2xf32&gt;
// %0:8 = %0:4 - %1:4
```

This pattern will be applied until there are only 1-D vectors left.

---------

Signed-off-by: hanhanW &lt;hanhan0912@gmail.com&gt;
Co-authored-by: hanhanW &lt;hanhan0912@gmail.com&gt;
Co-authored-by: Jakub Kuderski &lt;kubakuderski@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][vector] Support multi-dimensional vectors in VectorFromElementsLowering (#151175)</title>
<updated>2025-08-18T17:09:12+00:00</updated>
<author>
<name>Yang Bai</name>
<email>baiyang0132@gmail.com</email>
</author>
<published>2025-08-18T17:09:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4eb1a07d7d1a9722e84490b0ff79d3ae5e260f76'/>
<id>4eb1a07d7d1a9722e84490b0ff79d3ae5e260f76</id>
<content type='text'>
This patch introduces a new unrolling-based approach for lowering
multi-dimensional `vector.from_elements` operations.

**Implementation Details:**
1. **New Transform Pattern**: Added `UnrollFromElements` that unrolls a
N-D(N&gt;=2) from_elements op to a (N-1)-D from_elements op align the
outermost dimension.
2. **Utility Functions**: Added `unrollVectorOp` to reuse the unroll
algo of vector.gather for vector.from_elements.
3. **Integration**: Added the unrolling pattern to the
convert-vector-to-llvm pass as a temporal transformation.
4. Use direct LLVM dialect operations instead of intermediate
vector.insert operations for efficiency in `VectorFromElementsLowering`.

**Example:**
```mlir
// unroll
%v = vector.from_elements  %e0, %e1, %e2, %e3 : vector&lt;2x2xf32&gt;
=&gt;
%poison_2d = ub.poison : vector&lt;2x2xf32&gt;
%vec_1d_0 = vector.from_elements %e0, %e1 : vector&lt;2xf32&gt;
%vec_2d_0 = vector.insert %vec_1d_0, %poison_2d [0] : vector&lt;2xf32&gt; into vector&lt;2x2xf32&gt;
%vec_1d_1 = vector.from_elements %e2, %e3 : vector&lt;2xf32&gt;
%result = vector.insert %vec_1d_1, %vec_2d_0 [1] : vector&lt;2xf32&gt; into vector&lt;2x2xf32&gt;

// convert-vector-to-llvm
%v = vector.from_elements %e0, %e1, %e2, %e3 : vector&lt;2x2xf32&gt;
=&gt;
%poison_2d = ub.poison : vector&lt;2x2xf32&gt;
%poison_2d_cast = builtin.unrealized_conversion_cast %poison_2d : vector&lt;2x2xf32&gt; to !llvm.array&lt;2 x vector&lt;2xf32&gt;&gt;
%poison_1d_0 = llvm.mlir.poison : vector&lt;2xf32&gt;
%c0_0 = llvm.mlir.constant(0 : i64) : i64
%vec_1d_0_0 = llvm.insertelement %e0, %poison_1d_0[%c0_0 : i64] : vector&lt;2xf32&gt;
%c1_0 = llvm.mlir.constant(1 : i64) : i64
%vec_1d_0_1 = llvm.insertelement %e1, %vec_1d_0_0[%c1_0 : i64] : vector&lt;2xf32&gt;
%vec_2d_0 = llvm.insertvalue %vec_1d_0_1, %poison_2d_cast[0] : !llvm.array&lt;2 x vector&lt;2xf32&gt;&gt;
%poison_1d_1 = llvm.mlir.poison : vector&lt;2xf32&gt;
%c0_1 = llvm.mlir.constant(0 : i64) : i64
%vec_1d_1_0 = llvm.insertelement %e2, %poison_1d_1[%c0_1 : i64] : vector&lt;2xf32&gt;
%c1_1 = llvm.mlir.constant(1 : i64) : i64
%vec_1d_1_1 = llvm.insertelement %e3, %vec_1d_1_0[%c1_1 : i64] : vector&lt;2xf32&gt;
%vec_2d_1 = llvm.insertvalue %vec_1d_1_1, %vec_2d_0[1] : !llvm.array&lt;2 x vector&lt;2xf32&gt;&gt;
%result = builtin.unrealized_conversion_cast %vec_2d_1 : !llvm.array&lt;2 x vector&lt;2xf32&gt;&gt; to vector&lt;2x2xf32&gt;
```

---------

Co-authored-by: Nicolas Vasilache &lt;Nico.Vasilache@amd.com&gt;
Co-authored-by: Yang Bai &lt;yangb@nvidia.com&gt;
Co-authored-by: James Newling &lt;james.newling@gmail.com&gt;
Co-authored-by: Diego Caballero &lt;dieg0ca6aller0@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch introduces a new unrolling-based approach for lowering
multi-dimensional `vector.from_elements` operations.

**Implementation Details:**
1. **New Transform Pattern**: Added `UnrollFromElements` that unrolls a
N-D(N&gt;=2) from_elements op to a (N-1)-D from_elements op align the
outermost dimension.
2. **Utility Functions**: Added `unrollVectorOp` to reuse the unroll
algo of vector.gather for vector.from_elements.
3. **Integration**: Added the unrolling pattern to the
convert-vector-to-llvm pass as a temporal transformation.
4. Use direct LLVM dialect operations instead of intermediate
vector.insert operations for efficiency in `VectorFromElementsLowering`.

**Example:**
```mlir
// unroll
%v = vector.from_elements  %e0, %e1, %e2, %e3 : vector&lt;2x2xf32&gt;
=&gt;
%poison_2d = ub.poison : vector&lt;2x2xf32&gt;
%vec_1d_0 = vector.from_elements %e0, %e1 : vector&lt;2xf32&gt;
%vec_2d_0 = vector.insert %vec_1d_0, %poison_2d [0] : vector&lt;2xf32&gt; into vector&lt;2x2xf32&gt;
%vec_1d_1 = vector.from_elements %e2, %e3 : vector&lt;2xf32&gt;
%result = vector.insert %vec_1d_1, %vec_2d_0 [1] : vector&lt;2xf32&gt; into vector&lt;2x2xf32&gt;

// convert-vector-to-llvm
%v = vector.from_elements %e0, %e1, %e2, %e3 : vector&lt;2x2xf32&gt;
=&gt;
%poison_2d = ub.poison : vector&lt;2x2xf32&gt;
%poison_2d_cast = builtin.unrealized_conversion_cast %poison_2d : vector&lt;2x2xf32&gt; to !llvm.array&lt;2 x vector&lt;2xf32&gt;&gt;
%poison_1d_0 = llvm.mlir.poison : vector&lt;2xf32&gt;
%c0_0 = llvm.mlir.constant(0 : i64) : i64
%vec_1d_0_0 = llvm.insertelement %e0, %poison_1d_0[%c0_0 : i64] : vector&lt;2xf32&gt;
%c1_0 = llvm.mlir.constant(1 : i64) : i64
%vec_1d_0_1 = llvm.insertelement %e1, %vec_1d_0_0[%c1_0 : i64] : vector&lt;2xf32&gt;
%vec_2d_0 = llvm.insertvalue %vec_1d_0_1, %poison_2d_cast[0] : !llvm.array&lt;2 x vector&lt;2xf32&gt;&gt;
%poison_1d_1 = llvm.mlir.poison : vector&lt;2xf32&gt;
%c0_1 = llvm.mlir.constant(0 : i64) : i64
%vec_1d_1_0 = llvm.insertelement %e2, %poison_1d_1[%c0_1 : i64] : vector&lt;2xf32&gt;
%c1_1 = llvm.mlir.constant(1 : i64) : i64
%vec_1d_1_1 = llvm.insertelement %e3, %vec_1d_1_0[%c1_1 : i64] : vector&lt;2xf32&gt;
%vec_2d_1 = llvm.insertvalue %vec_1d_1_1, %vec_2d_0[1] : !llvm.array&lt;2 x vector&lt;2xf32&gt;&gt;
%result = builtin.unrealized_conversion_cast %vec_2d_1 : !llvm.array&lt;2 x vector&lt;2xf32&gt;&gt; to vector&lt;2x2xf32&gt;
```

---------

Co-authored-by: Nicolas Vasilache &lt;Nico.Vasilache@amd.com&gt;
Co-authored-by: Yang Bai &lt;yangb@nvidia.com&gt;
Co-authored-by: James Newling &lt;james.newling@gmail.com&gt;
Co-authored-by: Diego Caballero &lt;dieg0ca6aller0@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][NFC] update `mlir` create APIs (34/n) (#150660)</title>
<updated>2025-07-25T17:36:54+00:00</updated>
<author>
<name>Maksim Levental</name>
<email>maksim.levental@gmail.com</email>
</author>
<published>2025-07-25T17:36:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=258daf539583b80e0217d1d87941412d65cf16aa'/>
<id>258daf539583b80e0217d1d87941412d65cf16aa</id>
<content type='text'>
See https://github.com/llvm/llvm-project/pull/147168 for more info.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See https://github.com/llvm/llvm-project/pull/147168 for more info.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][NFC] update `mlir/Dialect` create APIs (28/n) (#150641)</title>
<updated>2025-07-25T16:48:00+00:00</updated>
<author>
<name>Maksim Levental</name>
<email>maksim.levental@gmail.com</email>
</author>
<published>2025-07-25T16:48:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=258d04c810ab10f101324cbf1fe3c7be65eb1938'/>
<id>258d04c810ab10f101324cbf1fe3c7be65eb1938</id>
<content type='text'>
See https://github.com/llvm/llvm-project/pull/147168 for more info.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See https://github.com/llvm/llvm-project/pull/147168 for more info.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][vector][nfc] Rename `populateVectorTransferCollapseInnerMostContiguousDimsPatterns` (#145228)</title>
<updated>2025-07-02T19:07:35+00:00</updated>
<author>
<name>Andrzej Warzyński</name>
<email>andrzej.warzynski@arm.com</email>
</author>
<published>2025-07-02T19:07:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6ecb6a8a8cd5c604ae109bc84dfd317117e1ed43'/>
<id>6ecb6a8a8cd5c604ae109bc84dfd317117e1ed43</id>
<content type='text'>
Renames `populateVectorTransferCollapseInnerMostContiguousDimsPatterns`
as `populateDropInnerMostUnitDimsXferOpPatterns` + updates the
corresponding comments.

This addresses a TODO and makes the difference between these two
`populate*` methods clearer:
 * `populateDropUnitDimWithShapeCastPatterns`,
 * `populateDropInnerMostUnitDimsXferOpPatterns`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Renames `populateVectorTransferCollapseInnerMostContiguousDimsPatterns`
as `populateDropInnerMostUnitDimsXferOpPatterns` + updates the
corresponding comments.

This addresses a TODO and makes the difference between these two
`populate*` methods clearer:
 * `populateDropUnitDimWithShapeCastPatterns`,
 * `populateDropInnerMostUnitDimsXferOpPatterns`.</pre>
</div>
</content>
</entry>
</feed>
