<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/mlir/lib/Interfaces/ValueBoundsOpInterface.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] Apply clang-tidy fixes for llvm-qualified-auto in ValueBoundsOpInterface.cpp (NFC)</title>
<updated>2025-11-20T18:27:39+00:00</updated>
<author>
<name>Mehdi Amini</name>
<email>joker.eph@gmail.com</email>
</author>
<published>2025-08-21T17:30:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=41008451260e4b95a901a5e073d7b14e55d6d303'/>
<id>41008451260e4b95a901a5e073d7b14e55d6d303</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Use LDBG to replace LLVM_DEBUG (NFC) (#166733)</title>
<updated>2025-11-06T12:18:39+00:00</updated>
<author>
<name>lonely eagle</name>
<email>2020382038@qq.com</email>
</author>
<published>2025-11-06T12:18:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=fd9dd4327f2a014ef531cc908923c05f31d0ea3e'/>
<id>fd9dd4327f2a014ef531cc908923c05f31d0ea3e</id>
<content type='text'>
Co-authored-by: Mehdi Amini &lt;joker.eph@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: Mehdi Amini &lt;joker.eph@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[MLIR] Apply clang-tidy fixes for performance-unnecessary-value-param in ValueBoundsOpInterface.cpp (NFC)</title>
<updated>2025-09-11T22:36:06+00:00</updated>
<author>
<name>Mehdi Amini</name>
<email>joker.eph@gmail.com</email>
</author>
<published>2025-08-21T17:32:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c989f85cdb77db88a16ec6e490d8f16312e6f1a6'/>
<id>c989f85cdb77db88a16ec6e490d8f16312e6f1a6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[MLIR] Apply clang-tidy fixes for readability-simplify-boolean-expr in ValueBoundsOpInterface.cpp (NFC)</title>
<updated>2025-09-01T17:44:03+00:00</updated>
<author>
<name>Mehdi Amini</name>
<email>joker.eph@gmail.com</email>
</author>
<published>2025-08-21T17:32:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5e28192fbac7c11205d3cc9e3d18f3670d7cfc7f'/>
<id>5e28192fbac7c11205d3cc9e3d18f3670d7cfc7f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][affine|ValueBounds] Add transform to simplify affine min max ops with ValueBoundsOpInterface (#145068)</title>
<updated>2025-06-23T04:05:20+00:00</updated>
<author>
<name>Fabian Mora</name>
<email>fmora.dev@gmail.com</email>
</author>
<published>2025-06-23T04:05:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c7165587e49605452f96249412f123b47b78bb81'/>
<id>c7165587e49605452f96249412f123b47b78bb81</id>
<content type='text'>
This commit makes the following changes:

- Expose `map` and `mapOperands` in
`ValueBoundsConstraintSet::Variable`, so that the class can be used by
subclasses of `ValueBoundsConstraintSet`. Otherwise subclasses cannot
access those members.

- Add `ValueBoundsConstraintSet::strongCompare`. This method is similar
to `ValueBoundsConstraintSet::compare` except that it returns false when
the inverse comparison holds, and `llvm::failure()` if neither the
relation nor its inverse relation could be proven.

- Add `simplifyAffineMinOp`, `simplifyAffineMaxOp`, and
`simplifyAffineMinMaxOps` to simplify those operations using
`ValueBoundsConstraintSet`.

- Adds the `SimplifyMinMaxAffineOpsOp` transform op that uses
`simplifyAffineMinMaxOps`.

- Add the `test.value_with_bounds` op to test unknown values with a min
max range using `ValueBoundsOpInterface`.

- Adds tests verifying the transform.

Example:

```mlir
func.func @overlapping_constraints() -&gt; (index, index) {
  %0 = test.value_with_bounds {min = 0 : index, max = 192 : index}
  %1 = test.value_with_bounds {min = 128 : index, max = 384 : index}
  %2 = test.value_with_bounds {min = 256 : index, max = 512 : index}
  %r0 = affine.min affine_map&lt;()[s0, s1, s2] -&gt; (s0, s1, s2)&gt;()[%0, %1, %2]
  %r1 = affine.max affine_map&lt;()[s0, s1, s2] -&gt; (s0, s1, s2)&gt;()[%0, %1, %2]
  return %r0, %r1 : index, index
}
// Result of applying `simplifyAffineMinMaxOps` to `func.func`
#map1 = affine_map&lt;()[s0, s1] -&gt; (s1, s0)&gt;
func.func @overlapping_constraints() -&gt; (index, index) {
  %0 = test.value_with_bounds {max = 192 : index, min = 0 : index}
  %1 = test.value_with_bounds {max = 384 : index, min = 128 : index}
  %2 = test.value_with_bounds {max = 512 : index, min = 256 : index}
  %3 = affine.min #map1()[%0, %1]
  %4 = affine.max #map1()[%1, %2]
  return %3, %4 : index, index
}
```

---------

Co-authored-by: Nicolas Vasilache &lt;Nico.Vasilache@amd.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit makes the following changes:

- Expose `map` and `mapOperands` in
`ValueBoundsConstraintSet::Variable`, so that the class can be used by
subclasses of `ValueBoundsConstraintSet`. Otherwise subclasses cannot
access those members.

- Add `ValueBoundsConstraintSet::strongCompare`. This method is similar
to `ValueBoundsConstraintSet::compare` except that it returns false when
the inverse comparison holds, and `llvm::failure()` if neither the
relation nor its inverse relation could be proven.

- Add `simplifyAffineMinOp`, `simplifyAffineMaxOp`, and
`simplifyAffineMinMaxOps` to simplify those operations using
`ValueBoundsConstraintSet`.

- Adds the `SimplifyMinMaxAffineOpsOp` transform op that uses
`simplifyAffineMinMaxOps`.

- Add the `test.value_with_bounds` op to test unknown values with a min
max range using `ValueBoundsOpInterface`.

- Adds tests verifying the transform.

Example:

```mlir
func.func @overlapping_constraints() -&gt; (index, index) {
  %0 = test.value_with_bounds {min = 0 : index, max = 192 : index}
  %1 = test.value_with_bounds {min = 128 : index, max = 384 : index}
  %2 = test.value_with_bounds {min = 256 : index, max = 512 : index}
  %r0 = affine.min affine_map&lt;()[s0, s1, s2] -&gt; (s0, s1, s2)&gt;()[%0, %1, %2]
  %r1 = affine.max affine_map&lt;()[s0, s1, s2] -&gt; (s0, s1, s2)&gt;()[%0, %1, %2]
  return %r0, %r1 : index, index
}
// Result of applying `simplifyAffineMinMaxOps` to `func.func`
#map1 = affine_map&lt;()[s0, s1] -&gt; (s1, s0)&gt;
func.func @overlapping_constraints() -&gt; (index, index) {
  %0 = test.value_with_bounds {max = 192 : index, min = 0 : index}
  %1 = test.value_with_bounds {max = 384 : index, min = 128 : index}
  %2 = test.value_with_bounds {max = 512 : index, min = 256 : index}
  %3 = affine.min #map1()[%0, %1]
  %4 = affine.max #map1()[%1, %2]
  return %3, %4 : index, index
}
```

---------

Co-authored-by: Nicolas Vasilache &lt;Nico.Vasilache@amd.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] fix copypaste typos in asserts (#119878)</title>
<updated>2024-12-13T20:39:55+00:00</updated>
<author>
<name>klensy</name>
<email>klensy@users.noreply.github.com</email>
</author>
<published>2024-12-13T20:39:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9f2dd085ae981740e2986a1b200ca2a7df44953d'/>
<id>9f2dd085ae981740e2986a1b200ca2a7df44953d</id>
<content type='text'>
This fixes few copypaste typos

I've also spotted weird `getNumRows() == getNumRows()`: looks like
leftover after refactoring


https://github.com/llvm/llvm-project/blob/ea8e328ae2bea9d9a7d556ef4d791fa116f7de18/mlir/lib/Analysis/Presburger/Simplex.cpp#L107-L111

Co-authored-by: klensy &lt;nightouser@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes few copypaste typos

I've also spotted weird `getNumRows() == getNumRows()`: looks like
leftover after refactoring


https://github.com/llvm/llvm-project/blob/ea8e328ae2bea9d9a7d556ef4d791fa116f7de18/mlir/lib/Analysis/Presburger/Simplex.cpp#L107-L111

Co-authored-by: klensy &lt;nightouser@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[Interfaces] Avoid repeated hash lookups (NFC) (#108140)</title>
<updated>2024-09-11T13:40:37+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-09-11T13:40:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6ffa7cd8b04ab4b771925d329d7ee8788a3b00ca'/>
<id>6ffa7cd8b04ab4b771925d329d7ee8788a3b00ca</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][affine][Analysis] Add conservative bounds for semi-affine mods (#93576)</title>
<updated>2024-06-05T10:35:13+00:00</updated>
<author>
<name>Benjamin Maxwell</name>
<email>benjamin.maxwell@arm.com</email>
</author>
<published>2024-06-05T10:35:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=29a925abb660104b413b15075b3a19793825f57e'/>
<id>29a925abb660104b413b15075b3a19793825f57e</id>
<content type='text'>
This patch adds support for computing bounds for semi-affine mod
expression to FlatLinearConstraints. This is then enabled within the
ScalableValueBoundsConstraintSet to allow computing the bounds of
scalable remainder loops.

E.g. computing the bound of something like:
```
// `1000 mod s0` is a semi-affine.
#remainder_start_index = affine_map&lt;()[s0] -&gt; (-(1000 mod s0) + 1000)&gt;
#remaining_iterations = affine_map&lt;(d0) -&gt; (-d0 + 1000)&gt;

%0 = affine.apply #remainder_start_index()[%c8_vscale]
scf.for %i = %0 to %c1000 step %c8_vscale {
  %remaining_iterations = affine.apply #remaining_iterations(%i)
  // The upper bound for the remainder loop iterations should be:
  // %c8_vscale - 1  (expressed as an affine map,
  // affine_map&lt;()[s0] -&gt; (s0 * 8 - 1)&gt;, where s0 is vscale)
  %bound = "test.reify_bound"(%remaining_iterations) &lt;{scalable, ...}&gt;
}
```

There are caveats to this implementation. To be able to add a bound for
a `mod` we need to assume the rhs is positive (&gt; 0). This may not be
known when adding the bounds for the `mod` expression. So to handle this
a constraint is added for `rhs &gt; 0`, this may later be found not to hold
(in which case the constraints set becomes empty/invalid).

This is not a problem for computing scalable bounds where it's safe to
assume `s0` is vscale (or some positive multiple of it). But this may
need to be considered when enabling this feature elsewhere (to ensure
correctness).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds support for computing bounds for semi-affine mod
expression to FlatLinearConstraints. This is then enabled within the
ScalableValueBoundsConstraintSet to allow computing the bounds of
scalable remainder loops.

E.g. computing the bound of something like:
```
// `1000 mod s0` is a semi-affine.
#remainder_start_index = affine_map&lt;()[s0] -&gt; (-(1000 mod s0) + 1000)&gt;
#remaining_iterations = affine_map&lt;(d0) -&gt; (-d0 + 1000)&gt;

%0 = affine.apply #remainder_start_index()[%c8_vscale]
scf.for %i = %0 to %c1000 step %c8_vscale {
  %remaining_iterations = affine.apply #remaining_iterations(%i)
  // The upper bound for the remainder loop iterations should be:
  // %c8_vscale - 1  (expressed as an affine map,
  // affine_map&lt;()[s0] -&gt; (s0 * 8 - 1)&gt;, where s0 is vscale)
  %bound = "test.reify_bound"(%remaining_iterations) &lt;{scalable, ...}&gt;
}
```

There are caveats to this implementation. To be able to add a bound for
a `mod` we need to assume the rhs is positive (&gt; 0). This may not be
known when adding the bounds for the `mod` expression. So to handle this
a constraint is added for `rhs &gt; 0`, this may later be found not to hold
(in which case the constraints set becomes empty/invalid).

This is not a problem for computing scalable bounds where it's safe to
assume `s0` is vscale (or some positive multiple of it). But this may
need to be considered when enabling this feature elsewhere (to ensure
correctness).</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Interfaces] `Variable` abstraction for `ValueBoundsOpInterface` (#87980)</title>
<updated>2024-04-16T08:59:02+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>me@m-sp.org</email>
</author>
<published>2024-04-16T08:59:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=40dd3aa91d3f73184e34e45e597b84bec059c572'/>
<id>40dd3aa91d3f73184e34e45e597b84bec059c572</id>
<content type='text'>
This commit generalizes and cleans up the `ValueBoundsConstraintSet`
API. The API used to provide function overloads for comparing/computing
bounds of:
- index-typed SSA value
- dimension of shaped value
- affine map + operands

This commit removes all overloads. There is now a single entry point for
each `compare` variant and each `computeBound` variant. These functions
now take a `Variable`, which is internally represented as an affine map
and map operands.

This commit also adds support for computing bounds for an affine map +
operands. There was previously no public API for that.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit generalizes and cleans up the `ValueBoundsConstraintSet`
API. The API used to provide function overloads for comparing/computing
bounds of:
- index-typed SSA value
- dimension of shaped value
- affine map + operands

This commit removes all overloads. There is now a single entry point for
each `compare` variant and each `computeBound` variant. These functions
now take a `Variable`, which is internally represented as an affine map
and map operands.

This commit also adds support for computing bounds for an affine map +
operands. There was previously no public API for that.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Fix -Wsign-compare in ValueBoundsOpInterface.cpp (NFC)</title>
<updated>2024-04-11T06:50:40+00:00</updated>
<author>
<name>Jie Fu</name>
<email>jiefu@tencent.com</email>
</author>
<published>2024-04-11T06:50:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=dc39028906ba4196c3ba544c43ef6b428cf47c51'/>
<id>dc39028906ba4196c3ba544c43ef6b428cf47c51</id>
<content type='text'>
/llvm-project/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp:762:16:
error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
        rhsPos &gt;= cstr.positionToValueDim.size())
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/llvm-project/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp:761:16:
error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
    if (lhsPos &gt;= cstr.positionToValueDim.size() ||
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
/llvm-project/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp:762:16:
error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
        rhsPos &gt;= cstr.positionToValueDim.size())
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/llvm-project/mlir/lib/Interfaces/ValueBoundsOpInterface.cpp:761:16:
error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
    if (lhsPos &gt;= cstr.positionToValueDim.size() ||
        ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
</pre>
</div>
</content>
</entry>
</feed>
