[Mlir-commits] [mlir] [mlir][tosa] Add NaN Propagation Mode Support (PR #121951)

Luke Hutton llvmlistbot at llvm.org
Fri Jan 10 11:14:44 PST 2025


================
@@ -361,7 +361,7 @@ struct ClampClampOptimization : public OpRewritePattern<tosa::ClampOp> {
           op, op.getType(), clampOp.getInput(),
----------------
lhutton1 wrote:

This comment went missing for some reason...

Unrelated to this PR, but I believe there could be a problem with this optimization when the two clamp ranges are disjoint. For example say we have:
```
clamp(clamp(in_values, min_val=-10, max_val=-5), min_val=1, max_val=5)
```
this becomes:
```
new_min_val = max(-10, 1) = 1
new_max_val = min(-5, 5) = -5
clamp(in_values, min_val=new_min_val, max_val=new_max_val)
```
but then `new_min_val` > `new_max_val`, which is invalid.

https://github.com/llvm/llvm-project/pull/121951


More information about the Mlir-commits mailing list