<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/mlir/lib/Transforms/Utils/DialectConversion.cpp, branch users/chapuni/cov/single/loop</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][Transforms] Fix mapping in `findOrBuildReplacementValue` (#121644)</title>
<updated>2025-01-06T07:55:18+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2025-01-06T07:55:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5f7568a32c5572e10c8818192a985d7278a261e2'/>
<id>5f7568a32c5572e10c8818192a985d7278a261e2</id>
<content type='text'>
Fixes two minor issues in `findOrBuildReplacementValue`:
* Remove a redundant `mapping.map`.
* Map `repl` instead of `value`. We used to overwrite an existing
mapping, which could introduce extra materializations.

Note: We generally do not want to overwrite mappings, but create a chain
of mappings. There are still a few more places, where a mapping is
overwritten. Once those are fixed, I will put an assertion into
`ConversionValueMapping::map`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes two minor issues in `findOrBuildReplacementValue`:
* Remove a redundant `mapping.map`.
* Map `repl` instead of `value`. We used to overwrite an existing
mapping, which could introduce extra materializations.

Note: We generally do not want to overwrite mappings, but create a chain
of mappings. There are still a few more places, where a mapping is
overwritten. Once those are fixed, I will put an assertion into
`ConversionValueMapping::map`.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Transforms][NFC] Simplify `buildUnresolvedMaterialization` implementation (#121651)</title>
<updated>2025-01-05T16:32:07+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2025-01-05T16:32:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=486f83faa31ae5356523da868a557619601a0e3e'/>
<id>486f83faa31ae5356523da868a557619601a0e3e</id>
<content type='text'>
The `buildUnresolvedMaterialization` implementation used to check if a
materialization is necessary. A materialization is not necessary if the
desired types already match the input. However, this situation can never
happen: we look for mapped values with the desired type at the call
sites before requesting a new unresolved materialization.

The previous implementation seemed incorrect because
`buildUnresolvedMaterialization` created a mapping that is never rolled
back. (When in reality that code was never executed, so it is
technically not incorrect.)

Also fix a comment that in `findOrBuildReplacementValue` that was
incorrect.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `buildUnresolvedMaterialization` implementation used to check if a
materialization is necessary. A materialization is not necessary if the
desired types already match the input. However, this situation can never
happen: we look for mapped values with the desired type at the call
sites before requesting a new unresolved materialization.

The previous implementation seemed incorrect because
`buildUnresolvedMaterialization` created a mapping that is never rolled
back. (When in reality that code was never executed, so it is
technically not incorrect.)

Also fix a comment that in `findOrBuildReplacementValue` that was
incorrect.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Transforms] Fix build after #116524 (part 2) (#121662)</title>
<updated>2025-01-04T20:28:59+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2025-01-04T20:28:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=afef716e839bf7dd96ebce5264779b1d316db58e'/>
<id>afef716e839bf7dd96ebce5264779b1d316db58e</id>
<content type='text'>
Since #116524, an integration test started to become flaky (failure rate
~15%).

```
bin/mlir-opt mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir --sparsifier="enable-arm-sve=true enable-runtime-library=false vl=2 reassociate-fp-reductions=true enable-index-optimizations=true" | mlir-cpu-runner --march=aarch64 --mattr="+sve" -e main -entry-point-result=void -shared-libs=./lib/libmlir_runner_utils.so,./lib/libmlir_c_runner_utils.so | bin/FileCheck mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir
# executed command: bin/mlir-opt mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir '--sparsifier=enable-arm-sve=true enable-runtime-library=false vl=2 reassociate-fp-reductions=true enable-index-optimizations=true'
# .---command stderr------------
# | mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir:71:10: error: null operand found
# |     %0 = linalg.generic #trait_mul
# |          ^
# | mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir:71:10: note: see current operation: %70 = "arith.mulf"(&lt;&lt;NULL VALUE&gt;&gt;, %69) &lt;{fastmath = #arith.fastmath&lt;none&gt;}&gt; : (&lt;&lt;NULL TYPE&gt;&gt;, vector&lt;[2]xf64&gt;) -&gt; vector&lt;[2]xf64&gt;
# `-----------------------------
# error: command failed with exit status: 1
```

I traced the issue back to the `DenseMap&lt;ValueVector, ValueVector,
ValueVectorMapInfo&gt; mapping;` data structure: previously, some
`mapping.erase(foo)` calls were unsuccessful (returning `false`), even
though the `mapping` contains `foo` as a key.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since #116524, an integration test started to become flaky (failure rate
~15%).

```
bin/mlir-opt mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir --sparsifier="enable-arm-sve=true enable-runtime-library=false vl=2 reassociate-fp-reductions=true enable-index-optimizations=true" | mlir-cpu-runner --march=aarch64 --mattr="+sve" -e main -entry-point-result=void -shared-libs=./lib/libmlir_runner_utils.so,./lib/libmlir_c_runner_utils.so | bin/FileCheck mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir
# executed command: bin/mlir-opt mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir '--sparsifier=enable-arm-sve=true enable-runtime-library=false vl=2 reassociate-fp-reductions=true enable-index-optimizations=true'
# .---command stderr------------
# | mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir:71:10: error: null operand found
# |     %0 = linalg.generic #trait_mul
# |          ^
# | mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir:71:10: note: see current operation: %70 = "arith.mulf"(&lt;&lt;NULL VALUE&gt;&gt;, %69) &lt;{fastmath = #arith.fastmath&lt;none&gt;}&gt; : (&lt;&lt;NULL TYPE&gt;&gt;, vector&lt;[2]xf64&gt;) -&gt; vector&lt;[2]xf64&gt;
# `-----------------------------
# error: command failed with exit status: 1
```

I traced the issue back to the `DenseMap&lt;ValueVector, ValueVector,
ValueVectorMapInfo&gt; mapping;` data structure: previously, some
`mapping.erase(foo)` calls were unsuccessful (returning `false`), even
though the `mapping` contains `foo` as a key.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Transforms][NFC] Delete unused `nTo1TempMaterializations` (#121647)</title>
<updated>2025-01-04T14:16:35+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2025-01-04T14:16:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c9d61cde2ba3521c7604c8ee0c3e1ba4dfc4d406'/>
<id>c9d61cde2ba3521c7604c8ee0c3e1ba4dfc4d406</id>
<content type='text'>
`nTo1TempMaterializations` is no longer used since the conversion value
mapping supports 1:N mappings.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`nTo1TempMaterializations` is no longer used since the conversion value
mapping supports 1:N mappings.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Transforms][NFC] Use `DominanceInfo` to compute materialization insertion point (#120746)</title>
<updated>2025-01-04T08:23:15+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2025-01-04T08:23:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=95c5c5d4badf7c2128d098be325356e15c2197be'/>
<id>95c5c5d4badf7c2128d098be325356e15c2197be</id>
<content type='text'>
In the dialect conversion driver, use `DominanceInfo` to compute a
suitable insertion point for N:1 source materializations.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the dialect conversion driver, use `DominanceInfo` to compute a
suitable insertion point for N:1 source materializations.
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Transforms] Fix build after #116524 (#121578)</title>
<updated>2025-01-03T15:35:02+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2025-01-03T15:35:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=faa30be101e9ae2bdb58d2acb250341f1b13031c'/>
<id>faa30be101e9ae2bdb58d2acb250341f1b13031c</id>
<content type='text'>
Fix build errors after #116524.

```
error: call of overloaded ‘TypeRange(ValueVector&amp;)’ is ambiguous
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix build errors after #116524.

```
error: call of overloaded ‘TypeRange(ValueVector&amp;)’ is ambiguous
```</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Transforms] Support 1:N mappings in `ConversionValueMapping` (#116524)</title>
<updated>2025-01-03T15:11:56+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2025-01-03T15:11:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3ace685105d3b50bca68328bf0c945af22d70f23'/>
<id>3ace685105d3b50bca68328bf0c945af22d70f23</id>
<content type='text'>
This commit updates the internal `ConversionValueMapping` data structure
in the dialect conversion driver to support 1:N replacements. This is
the last major commit for adding 1:N support to the dialect conversion
driver.

Since #116470, the infrastructure already supports 1:N replacements. But
the `ConversionValueMapping` still stored 1:1 value mappings. To that
end, the driver inserted temporary argument materializations (converting
N SSA values into 1 value). This is no longer the case. Argument
materializations are now entirely gone. (They will be deleted from the
type converter after some time, when we delete the old 1:N dialect
conversion driver.)

Note for LLVM integration: Replace all occurrences of
`addArgumentMaterialization` (except for 1:N dialect conversion passes)
with `addSourceMaterialization`.

---------

Co-authored-by: Markus Böck &lt;markus.boeck02@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit updates the internal `ConversionValueMapping` data structure
in the dialect conversion driver to support 1:N replacements. This is
the last major commit for adding 1:N support to the dialect conversion
driver.

Since #116470, the infrastructure already supports 1:N replacements. But
the `ConversionValueMapping` still stored 1:1 value mappings. To that
end, the driver inserted temporary argument materializations (converting
N SSA values into 1 value). This is no longer the case. Argument
materializations are now entirely gone. (They will be deleted from the
type converter after some time, when we delete the old 1:N dialect
conversion driver.)

Note for LLVM integration: Replace all occurrences of
`addArgumentMaterialization` (except for 1:N dialect conversion passes)
with `addSourceMaterialization`.

---------

Co-authored-by: Markus Böck &lt;markus.boeck02@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Fix typo in parameter name annotation comment.</title>
<updated>2025-01-03T12:50:05+00:00</updated>
<author>
<name>Adrian Kuegel</name>
<email>akuegel@google.com</email>
</author>
<published>2025-01-03T12:48:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cba9c6ac15b462e68cf76d496ba0f832a531db8b'/>
<id>cba9c6ac15b462e68cf76d496ba0f832a531db8b</id>
<content type='text'>
Found by ClangTidyBugProne check.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Found by ClangTidyBugProne check.
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Fix -Werror,-Wundefined-bool-conversion after #117513 (#120985)</title>
<updated>2024-12-23T18:47:59+00:00</updated>
<author>
<name>Pranav Kant</name>
<email>prka@google.com</email>
</author>
<published>2024-12-23T18:47:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d8e792931226b15d9d2424ecd24ccfe13adc2367'/>
<id>d8e792931226b15d9d2424ecd24ccfe13adc2367</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Transforms] Dialect Conversion: No target mat. for 1:N replacement (#117513)</title>
<updated>2024-12-23T12:27:39+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2024-12-23T12:27:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3cc311ab8674eab6b9101cdf3823b55ea23d6535'/>
<id>3cc311ab8674eab6b9101cdf3823b55ea23d6535</id>
<content type='text'>
During a 1:N replacement (`applySignatureConversion` or
`replaceOpWithMultiple`), the dialect conversion driver used to insert
two materializations:

* Argument materialization: convert N replacement values to 1 SSA value
of the original type `S`.
* Target materialization: convert original type to legalized type `T`.

The target materialization is unnecessary. Subsequent patterns receive
the replacement values via their adaptors. These patterns have their own
type converter. When they see a replacement value of type `S`, they will
automatically insert a target materialization to type `T`. There is no
reason to do this already during the 1:N replacement. (The functionality
used to be duplicated in `remapValues` and `insertNTo1Materialization`.)

Special case: If a subsequent pattern does not have a type converter, it
does *not* insert any target materializations. That's because the
absence of a type converter indicates that the pattern does not care
about type legality. Therefore, it is correct to pass an SSA value of
type `S` (or any other type) to the pattern.

Note: Most patterns in `TestPatterns.cpp` run without a type converter.
To make sure that the tests still behave the same, some of these
patterns now have a type converter.

This commit is in preparation of adding 1:N support to the conversion
value mapping. Before making any further changes to the mapping
infrastructure, I'd like to make sure that the code base around it (that
uses the mapping) is robust.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
During a 1:N replacement (`applySignatureConversion` or
`replaceOpWithMultiple`), the dialect conversion driver used to insert
two materializations:

* Argument materialization: convert N replacement values to 1 SSA value
of the original type `S`.
* Target materialization: convert original type to legalized type `T`.

The target materialization is unnecessary. Subsequent patterns receive
the replacement values via their adaptors. These patterns have their own
type converter. When they see a replacement value of type `S`, they will
automatically insert a target materialization to type `T`. There is no
reason to do this already during the 1:N replacement. (The functionality
used to be duplicated in `remapValues` and `insertNTo1Materialization`.)

Special case: If a subsequent pattern does not have a type converter, it
does *not* insert any target materializations. That's because the
absence of a type converter indicates that the pattern does not care
about type legality. Therefore, it is correct to pass an SSA value of
type `S` (or any other type) to the pattern.

Note: Most patterns in `TestPatterns.cpp` run without a type converter.
To make sure that the tests still behave the same, some of these
patterns now have a type converter.

This commit is in preparation of adding 1:N support to the conversion
value mapping. Before making any further changes to the mapping
infrastructure, I'd like to make sure that the code base around it (that
uses the mapping) is robust.</pre>
</div>
</content>
</entry>
</feed>
