<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.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] Simplify op rewrite pattern inheriting constructors. NFC. (#161670)</title>
<updated>2025-10-02T23:07:25+00:00</updated>
<author>
<name>Jakub Kuderski</name>
<email>jakub@nod-labs.com</email>
</author>
<published>2025-10-02T23:07:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3960ff6ca03b0441087f9042850199583d9e11d2'/>
<id>3960ff6ca03b0441087f9042850199583d9e11d2</id>
<content type='text'>
Use the `Base` type alias from
https://github.com/llvm/llvm-project/pull/158433.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use the `Base` type alias from
https://github.com/llvm/llvm-project/pull/158433.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][vector] Propagate alignment in LowerVectorGather. (#155683)</title>
<updated>2025-09-05T13:43:18+00:00</updated>
<author>
<name>Erick Ochoa Lopez</name>
<email>erick.ochoalopez@amd.com</email>
</author>
<published>2025-09-05T13:43:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=250d2517b26f44ab585d0ce9bd3c5baf45027cdb'/>
<id>250d2517b26f44ab585d0ce9bd3c5baf45027cdb</id>
<content type='text'>
Alignment is properly propagated when patterns
`UnrollGather`, `RemoveStrideFromGatherSource`, or
`Gather1DToConditionalLoads` are applied.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Alignment is properly propagated when patterns
`UnrollGather`, `RemoveStrideFromGatherSource`, or
`Gather1DToConditionalLoads` are applied.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][vector] Rename gather/scatter arguments (nfc) (#153640)</title>
<updated>2025-08-25T16:02:11+00:00</updated>
<author>
<name>Andrzej Warzyński</name>
<email>andrzej.warzynski@arm.com</email>
</author>
<published>2025-08-25T16:02:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=613ec4c24c145eb20ef1967a714d74c9cf403da5'/>
<id>613ec4c24c145eb20ef1967a714d74c9cf403da5</id>
<content type='text'>
Renames `indices` as `offsets` and `index_vec` as `indices`. This is
primarily to make clearer distinction between the arguments.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Renames `indices` as `offsets` and `index_vec` as `indices`. This is
primarily to make clearer distinction between the arguments.</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/Dialect` create APIs (32/n) (#150657)</title>
<updated>2025-07-25T18:50:15+00:00</updated>
<author>
<name>Maksim Levental</name>
<email>maksim.levental@gmail.com</email>
</author>
<published>2025-07-25T18:50:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=fcbcfe44cff00101a6a98a73971398eb8dd87710'/>
<id>fcbcfe44cff00101a6a98a73971398eb8dd87710</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 (24/n) (#149931)</title>
<updated>2025-07-22T12:16:15+00:00</updated>
<author>
<name>Maksim Levental</name>
<email>maksim.levental@gmail.com</email>
</author>
<published>2025-07-22T12:16:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f904cdd6c3049e605d24ed17680e80e7133908a0'/>
<id>f904cdd6c3049e605d24ed17680e80e7133908a0</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] Remove unused includes (NFC) (#148769)</title>
<updated>2025-07-15T05:19:23+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-07-15T05:19:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c06d3a7b728293cbc53ff91239d6cd87c0982ffb'/>
<id>c06d3a7b728293cbc53ff91239d6cd87c0982ffb</id>
<content type='text'>
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][vector] Decouple unrolling gather and gather to llvm lowering (#132206)</title>
<updated>2025-03-24T12:25:17+00:00</updated>
<author>
<name>Kunwar Grover</name>
<email>groverkss@gmail.com</email>
</author>
<published>2025-03-24T12:25:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cf0efb31880dab5f5b2f20bda6634c68a42d6908'/>
<id>cf0efb31880dab5f5b2f20bda6634c68a42d6908</id>
<content type='text'>
This patch decouples unrolling vector.gather and lowering vector.gather
to llvm.masked.gather.

This is consistent with how vector.load, vector.store,
vector.maskedload, vector.maskedstore lower to LLVM.

Some interesting test changes from this patch:

- 2D vector.gather lowering to llvm tests are deleted. This is
consistent with other memory load/store ops.
- There are still tests for 2D vector.gather, but the constant mask for
these test is modified. This is because with the updated lowering, one
of the unrolled vector.gather disappears because it is masked off (also
demonstrating why this is a better lowering path)

Overall, this makes vector.gather take the same consistent path for
lowering to LLVM as other load/store ops.

Discourse Discussion:
https://discourse.llvm.org/t/rfc-improving-gather-codegen-for-vector-dialect/85011/13</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch decouples unrolling vector.gather and lowering vector.gather
to llvm.masked.gather.

This is consistent with how vector.load, vector.store,
vector.maskedload, vector.maskedstore lower to LLVM.

Some interesting test changes from this patch:

- 2D vector.gather lowering to llvm tests are deleted. This is
consistent with other memory load/store ops.
- There are still tests for 2D vector.gather, but the constant mask for
these test is modified. This is because with the updated lowering, one
of the unrolled vector.gather disappears because it is masked off (also
demonstrating why this is a better lowering path)

Overall, this makes vector.gather take the same consistent path for
lowering to LLVM as other load/store ops.

Discourse Discussion:
https://discourse.llvm.org/t/rfc-improving-gather-codegen-for-vector-dialect/85011/13</pre>
</div>
</content>
</entry>
<entry>
<title>[MLIR][Vector] Allow any strided memref for one-element vector.load in lowering vector.gather (#122437)</title>
<updated>2025-01-12T16:02:41+00:00</updated>
<author>
<name>Twice</name>
<email>twice@apache.org</email>
</author>
<published>2025-01-12T16:02:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b91d5af1ac3ad2c18b1dfde2061a6ac1d638e6e4'/>
<id>b91d5af1ac3ad2c18b1dfde2061a6ac1d638e6e4</id>
<content type='text'>
In `Gather1DToConditionalLoads`, currently we will check if the stride
of the most minor dim of the input memref is 1. And if not, the
rewriting pattern will not be applied. However, according to the
verification of `vector.load` here:

https://github.com/llvm/llvm-project/blob/4e32271e8b304eb018c69f74c16edd1668fcdaf3/mlir/lib/Dialect/Vector/IR/VectorOps.cpp#L4971-L4975

.. if the output vector type of `vector.load` contains only one element,
we can ignore the requirement of the stride of the input memref, i.e.
the input memref can be with any stride layout attribute in such case.

So here we can allow more cases in lowering `vector.gather` by relaxing
such check.

As shown in the test case attached in this patch
[here](https://github.com/llvm/llvm-project/blob/1933fbad58302814ccce5991a9320c0967f3571b/mlir/test/Dialect/Vector/vector-gather-lowering.mlir#L151),
now `vector.gather` of memref with non-trivial stride can be lowered
successfully if the result vector contains only one element.

---------

Signed-off-by: PragmaTwice &lt;twice@apache.org&gt;
Co-authored-by: Andrzej Warzyński &lt;andrzej.warzynski@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In `Gather1DToConditionalLoads`, currently we will check if the stride
of the most minor dim of the input memref is 1. And if not, the
rewriting pattern will not be applied. However, according to the
verification of `vector.load` here:

https://github.com/llvm/llvm-project/blob/4e32271e8b304eb018c69f74c16edd1668fcdaf3/mlir/lib/Dialect/Vector/IR/VectorOps.cpp#L4971-L4975

.. if the output vector type of `vector.load` contains only one element,
we can ignore the requirement of the stride of the input memref, i.e.
the input memref can be with any stride layout attribute in such case.

So here we can allow more cases in lowering `vector.gather` by relaxing
such check.

As shown in the test case attached in this patch
[here](https://github.com/llvm/llvm-project/blob/1933fbad58302814ccce5991a9320c0967f3571b/mlir/test/Dialect/Vector/vector-gather-lowering.mlir#L151),
now `vector.gather` of memref with non-trivial stride can be lowered
successfully if the result vector contains only one element.

---------

Signed-off-by: PragmaTwice &lt;twice@apache.org&gt;
Co-authored-by: Andrzej Warzyński &lt;andrzej.warzynski@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>mlir/LogicalResult: move into llvm (#97309)</title>
<updated>2024-07-02T09:42:33+00:00</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>ramkumar.ramachandra@codasip.com</email>
</author>
<published>2024-07-02T09:42:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=db791b278a414fb6df1acc1799adcf11d8fb9169'/>
<id>db791b278a414fb6df1acc1799adcf11d8fb9169</id>
<content type='text'>
This patch is part of a project to move the Presburger library into
LLVM.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch is part of a project to move the Presburger library into
LLVM.</pre>
</div>
</content>
</entry>
</feed>
