<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/mlir/lib/Dialect/Vector/Transforms/LowerVectorShapeCast.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] Use llvm accumulate wrappers. NFCI. (#162957)</title>
<updated>2025-10-11T15:33:18+00:00</updated>
<author>
<name>Jakub Kuderski</name>
<email>jakub@nod-labs.com</email>
</author>
<published>2025-10-11T15:33:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0820266651649c0eb6c384df91da4c6f662e5136'/>
<id>0820266651649c0eb6c384df91da4c6f662e5136</id>
<content type='text'>
Use wrappers around `std::accumulate` to make the code more concise and
less bug-prone: https://github.com/llvm/llvm-project/pull/162129.

With `std::accumulate`, it's the initial value that determines the
accumulator type. `llvm::sum_of` and `llvm::product_of` pick the right
accumulator type based on the range element type.

Found some funny bugs like a local accumulate helper that calculated a
sum with initial value of 1 -- we didn't hit the bug because the code
was actually dead...</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use wrappers around `std::accumulate` to make the code more concise and
less bug-prone: https://github.com/llvm/llvm-project/pull/162129.

With `std::accumulate`, it's the initial value that determines the
accumulator type. `llvm::sum_of` and `llvm::product_of` pick the right
accumulator type based on the range element type.

Found some funny bugs like a local accumulate helper that calculated a
sum with initial value of 1 -- we didn't hit the bug because the code
was actually dead...</pre>
</div>
</content>
</entry>
<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][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][vector] Improve shape_cast lowering  (#140800)</title>
<updated>2025-06-05T17:18:38+00:00</updated>
<author>
<name>James Newling</name>
<email>james.newling@gmail.com</email>
</author>
<published>2025-06-05T17:18:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7ce315d14aa5c084574cc3a17552625f322e1d16'/>
<id>7ce315d14aa5c084574cc3a17552625f322e1d16</id>
<content type='text'>
Before this PR, a rank-m -&gt; rank-n vector.shape_cast with m,n&gt;1 was
lowered to extracts/inserts of single elements, so that a shape_cast on
a vector with N elements would always require N extracts/inserts. While
this is necessary in the worst case scenario it is sometimes possible to
use fewer, larger extracts/inserts. Specifically, the largest common
suffix on the shapes of the source and result can be extracted/inserted.
For example:

```mlir
%0 = vector.shape_cast %arg0 : vector&lt;10x2x3xf32&gt; to vector&lt;2x5x2x3xf32&gt;
```

has common suffix of shape `2x3`. Before this PR, this would be lowered
to 60 extract/insert pairs with extracts of the form
`vector.extract %arg0 [a, b, c] : f32 from vector&lt;10x2x3xf32&gt;`. With
this PR it is 10 extract/insert pairs with extracts of the form
`vector.extract %arg0 [a] : vector&lt;2x3xf32&gt; from vector&lt;10x2x3xf32&gt;`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this PR, a rank-m -&gt; rank-n vector.shape_cast with m,n&gt;1 was
lowered to extracts/inserts of single elements, so that a shape_cast on
a vector with N elements would always require N extracts/inserts. While
this is necessary in the worst case scenario it is sometimes possible to
use fewer, larger extracts/inserts. Specifically, the largest common
suffix on the shapes of the source and result can be extracted/inserted.
For example:

```mlir
%0 = vector.shape_cast %arg0 : vector&lt;10x2x3xf32&gt; to vector&lt;2x5x2x3xf32&gt;
```

has common suffix of shape `2x3`. Before this PR, this would be lowered
to 60 extract/insert pairs with extracts of the form
`vector.extract %arg0 [a, b, c] : f32 from vector&lt;10x2x3xf32&gt;`. With
this PR it is 10 extract/insert pairs with extracts of the form
`vector.extract %arg0 [a] : vector&lt;2x3xf32&gt; from vector&lt;10x2x3xf32&gt;`.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Vector] Remove more special case uses for extractelement/insertelement (#130166)</title>
<updated>2025-03-24T13:04:16+00:00</updated>
<author>
<name>Kunwar Grover</name>
<email>groverkss@gmail.com</email>
</author>
<published>2025-03-24T13:04:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=dc28e0d5d24364de311a3dc432edfd8bb122560a'/>
<id>dc28e0d5d24364de311a3dc432edfd8bb122560a</id>
<content type='text'>
A number of places in our codebase special case to use
extractelement/insertelement for 0D vectors, because extract/insert did
not support 0D vectors previously. Since insert/extract support 0D
vectors now, use them instead of special casing.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A number of places in our codebase special case to use
extractelement/insertelement for 0D vectors, because extract/insert did
not support 0D vectors previously. Since insert/extract support 0D
vectors now, use them instead of special casing.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Vector] Generate poison vectors in vector.shape_cast lowering (#125613)</title>
<updated>2025-02-07T18:42:55+00:00</updated>
<author>
<name>Diego Caballero</name>
<email>dieg0ca6aller0@gmail.com</email>
</author>
<published>2025-02-07T18:42:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5a0075adbb623c8661862b9af1272b8f430d9e5c'/>
<id>5a0075adbb623c8661862b9af1272b8f430d9e5c</id>
<content type='text'>
This is the first PR that introduces `ub.poison` vectors as part of a
rewrite/conversion pattern in the Vector dialect. It replaces the
`arith.constant dense&lt;0&gt;` vector initialization for
`vector.insert_slice` ops with a poison vector.

This PR depends on all the previous PRs that introduced support for
poison in Vector operations such as `vector.shuffle`, `vector.extract`,
`vector.insert`, including ODS, canonicalization and lowering support.

This PR may improve end-to-end compilation time through LLVM, depending
on the workloads.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the first PR that introduces `ub.poison` vectors as part of a
rewrite/conversion pattern in the Vector dialect. It replaces the
`arith.constant dense&lt;0&gt;` vector initialization for
`vector.insert_slice` ops with a poison vector.

This PR depends on all the previous PRs that introduced support for
poison in Vector operations such as `vector.shuffle`, `vector.extract`,
`vector.insert`, including ODS, canonicalization and lowering support.

This PR may improve end-to-end compilation time through LLVM, depending
on the workloads.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Vector] Support efficient shape cast lowering for n-D vectors (#123497)</title>
<updated>2025-01-27T22:36:19+00:00</updated>
<author>
<name>Diego Caballero</name>
<email>dieg0ca6aller0@gmail.com</email>
</author>
<published>2025-01-27T22:36:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a7a4c16c672bdd8e245af533a1f170522e26e42a'/>
<id>a7a4c16c672bdd8e245af533a1f170522e26e42a</id>
<content type='text'>
This PR implements a generalization of the existing more efficient
lowering of shape casts from 2-D to 1D and 1-D to 2-D vectors. This
significantly reduces code size and generates more performant code for
n-D shape casts that make their way to LLVM/SPIR-V.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR implements a generalization of the existing more efficient
lowering of shape casts from 2-D to 1D and 1-D to 2-D vectors. This
significantly reduces code size and generates more performant code for
n-D shape casts that make their way to LLVM/SPIR-V.</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>
<entry>
<title>[mlir][vector] add result type to vector.extract assembly format (#66499)</title>
<updated>2023-09-28T10:11:16+00:00</updated>
<author>
<name>Cullen Rhodes</name>
<email>cullen.rhodes@arm.com</email>
</author>
<published>2023-09-28T10:11:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9816edc9f3ce198d41e364dd3467caa839a0c220'/>
<id>9816edc9f3ce198d41e364dd3467caa839a0c220</id>
<content type='text'>
The vector.extract assembly format currently only contains the source
type, for example:

  %1 = vector.extract %0[1] : vector&lt;3x7x8xf32&gt;

it's not immediately obvious if this is the source or result type. This
patch improves the assembly format to make this clearer, so the above
becomes:

  %1 = vector.extract %0[1] : vector&lt;7x8xf32&gt; from vector&lt;3x7x8xf32&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The vector.extract assembly format currently only contains the source
type, for example:

  %1 = vector.extract %0[1] : vector&lt;3x7x8xf32&gt;

it's not immediately obvious if this is the source or result type. This
patch improves the assembly format to make this clearer, so the above
becomes:

  %1 = vector.extract %0[1] : vector&lt;7x8xf32&gt; from vector&lt;3x7x8xf32&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][VectorOps] Add lowering for vector.shape_cast of scalable vectors</title>
<updated>2023-09-07T15:58:44+00:00</updated>
<author>
<name>Benjamin Maxwell</name>
<email>benjamin.maxwell@arm.com</email>
</author>
<published>2023-09-07T15:33:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8dffb71cbada73c5f9c1e9df7891566be0ff762d'/>
<id>8dffb71cbada73c5f9c1e9df7891566be0ff762d</id>
<content type='text'>
This adds a lowering similar to the general shape_cast lowering, but
instead moves elements a (scalable) subvector at a time via
vector.scalable.extract/insert. It is restricted to the case where both
the source and result vector types have a single trailing scalable
dimension (due to limitations of the insert/extract ops).

The current lowerings are now disabled for scalable vectors, as they
produce incorrect results at runtime (due to assuming a fixed number
of elements).

Examples of casts that now work:

  // Flattening:
  %v = vector.shape_cast %arg0 : vector&lt;4x[8]xi8&gt; to vector&lt;[32]xi8&gt;

  // Un-flattening:
  %v = vector.shape_cast %arg0 : vector&lt;[8]xi32&gt; to vector&lt;2x1x[4]xi32&gt;

Reviewed By: awarzynski, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D159217
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds a lowering similar to the general shape_cast lowering, but
instead moves elements a (scalable) subvector at a time via
vector.scalable.extract/insert. It is restricted to the case where both
the source and result vector types have a single trailing scalable
dimension (due to limitations of the insert/extract ops).

The current lowerings are now disabled for scalable vectors, as they
produce incorrect results at runtime (due to assuming a fixed number
of elements).

Examples of casts that now work:

  // Flattening:
  %v = vector.shape_cast %arg0 : vector&lt;4x[8]xi8&gt; to vector&lt;[32]xi8&gt;

  // Un-flattening:
  %v = vector.shape_cast %arg0 : vector&lt;[8]xi32&gt; to vector&lt;2x1x[4]xi32&gt;

Reviewed By: awarzynski, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D159217
</pre>
</div>
</content>
</entry>
</feed>
