[Mlir-commits] [mlir] [mlir][math] Fix the description of the semantics of math.clampf (PR #175012)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jan 15 09:21:20 PST 2026
jack-slingsby wrote:
Ahh the way round I've put this is verbatium for the SPIRV spec: https://registry.khronos.org/SPIR-V/specs/unified1/GLSL.std.450.html
<img width="1147" height="260" alt="image" src="https://github.com/user-attachments/assets/a358b5b7-ba9f-4baa-92a6-74faf9218865" />
This is an equivelent definition to the cuda spec `min(max(val, min_val), max_val) === max(min(val, max_val), min_val)`.
However, whichever spec you prefer, both specs disagree with `math.clamp`. Potentially it's useful to highlight and alternative, but equivelent, way to change to the `math.clamp` description :)
```
- maxf(minf(value, min), max)
+ maxf(minf(value, max), min)
```
https://github.com/llvm/llvm-project/pull/175012
More information about the Mlir-commits
mailing list