A float ldexp records no NativeNanEncoding: its lowering answers Metal's NaN itself
The 11-02 carve-out run flagged ldexp as possibly over-noted. A float ldexp is lowered on the bits (math::ldexp_bits): an infinity or a NaN operand is selected as the result bit for bit, which is Metal's answer (NanAnswer::Operand: ldexp returns a NaN operand itself). No NaN of the device's reaches the result on any device, yet float_call left the answer to the device and recorded NativeNanEncoding everywhere, MoltenVK included. FloatFn::metal_nans now includes ldexp on float lanes, so the call leaves no NaN answer and records no NaN note. A half ldexp multiplies by 2^k, so its NaN is still the device's product's where Metal answers the canonical half NaN, and stays noted where the device does not answer that. PrecisionNote::NativeNanEncoding's docs and docs/API.md's catalogue say so. Verified: lower::arith::tests::float_ldexp_answers_metals_nan_itself (fails without the metal_nans change: call.nan is Some(Operand) and NativeNanEncoding is recorded). SEMANTICS_VERSION 2014: a module calling float ldexp records one note fewer. (cherry picked from commit c4b748c1e63cee2a32400145a3665387a8ca72cf)
This commit is contained in:
1 parent
b72b34e36f
commit
5bb3d04838
4 files changed
+65
-5
No files matched your search
+2
-1
@@ -4165,7 +4165,8 @@ bound.
|
||||
Metal's canonical one on a device measured to answer that, MoltenVK on an Apple GPU): a `float`
|
||||
`fneg` and `fabs`, which keep a NaN operand's payload on Metal, a `half` `fract`, which returns
|
||||
it, and a precise `float` `pow` of a NaN base to the exponent one, which returns the base, among
|
||||
them. Also
|
||||
them. A `float` `ldexp`, which the module computes on the bits, returns a NaN operand itself as
|
||||
Metal does, on every device, and records nothing. Also
|
||||
recorded wherever a `half` is read from its bits, on every device, since the read is the
|
||||
device's widening (its conversion with `shaderFloat16`, `UnpackHalf2x16` without): a NaN's bits
|
||||
the device's, where Metal widens every `half` NaN to `0x7fc00000` and moves one it does not
|
||||
|
||||
Reference in new issue
Block a user