Translator docs: NativeFma states that an unfused half product can overflow

What: NativeFma's rustdoc and its docs/API.md catalogue entry state the one case its recorded
bound does not cover: an unfused product can overflow where Metal's fused result is finite, and
the overflow stays the device's answer. A 16-bit product of magnitude 65520 or more rounds to
the infinity of its sign, so the result is that infinity where Metal's is finite, or a NaN
where the addend is the infinity of the other sign and Metal's result is that infinity.

Why: the bound (half an ulp of the product plus half an ulp of the result) read as covering
every input; the public cases fused-multiply-add-rounding-and-fmuladd-without-fast-math and
fused-multiply-add-rounding-and-contraction-under-fast-math show the other answer on lavapipe:
fma(256.0h, 256.0h, -65504.0h) is inf where Metal answers 32, and fma(65504.0h, 65504.0h,
-inf) a NaN where Metal answers -inf (job m3-max-82667's rows against the committed Metal rows
of the Apple M3 Max). No lowering changes; the note stays unbounded in validation.

Text only: no output and no recorded note changes, so SEMANTICS_VERSION stays. artifact.rs is
not a runtime source input, so runtime-sources.sha256 stays.
This commit is contained in:
Anees Iqbal committed 2026-12-03 03:27:51 -08:00
1 parent e31bc61172
commit 2c61e4fc52
2 files changed
+12 -2

No files matched your search

+7 -1
View File
@@ -1445,7 +1445,13 @@ pub enum PrecisionNote {
/// Metal's (the product of two `half` values is exact in `float`, so only the two roundings
/// differ); a `float` one, and a 16-bit one, within half a unit in the last place of the
/// product plus half a unit in the last place of the result, in its own format (Vulkan lets
/// `Fma` round the product and then the sum). Validation derives no tolerance from it.
/// `Fma` round the product and then the sum). The stated exception: an unfused product can
/// overflow where Metal's fused result is finite, and the overflow is the device's answer. A
/// 16-bit product of magnitude `65520` or more rounds to the infinity of its sign, so the
/// result is that infinity where Metal's is finite, or a NaN where the addend is the infinity
/// of the other sign and Metal's result is that infinity (lavapipe:
/// `fma(256.0h, 256.0h, -65504.0h)` answers `inf` where Metal answers 32). Validation derives
/// no tolerance from it.
NativeFma,
/// Native device sampling (a texel conversion): the module hands a read, sample or gather
/// with a `float` result the device's own conversion of the texel's codes. Recorded for every
+5 -1
View File
@@ -2373,7 +2373,11 @@ category, and says what makes an operation carry the note and what may differ. E
device that computes `half` in 16 bits under the 16-bit float controls, a `half` one is the
device's 16-bit `Fma` on the `half` operands. Recorded bound: a `half` result
held in `float` within one `half` ulp of Metal's; a `float` one, and a 16-bit one, within half an
ulp of the product plus half an ulp of the result, in its own format.
ulp of the product plus half an ulp of the result, in its own format, but where the unfused
product overflows: an unfused `half` product can overflow where Metal's fused result is finite,
and the overflow is the device's answer (a 16-bit product of magnitude `65520` or more is the
infinity of its sign, so `fma(256.0h, 256.0h, -65504.0h)` answers `inf` on lavapipe where Metal
answers 32).
- `metal2vulkan-degrade-device-texel-conversion` (precision).
`PrecisionNote::DeviceTexelConversion`: Native device sampling (a texel conversion): the module
hands a read, sample or gather with a `float` result the device's own conversion of the texel's