Carve MoltenVK on the M3 Max's identity out of NativeNanEncoding for NaN moves
reims-vgpu treats precision notes as fatal on Apple GPUs; NativeNanEncoding was its largest group of Mac-only failures. Measured on the M3 Max (MoltenVK 1.4.2, macOS 27.0.1), the device's widening of a half to float, its narrowing back, and float fneg/fabs and half fabs answer Metal's NaN bits, so the note was recorded where nothing differs. What: a new DriverDeviation::MetalNanMoves (VkProperty::MetalNanMoves), taken by the APPLE9 MoltenVK row alone. Where taken: - a float fneg or fabs records no NativeNanEncoding and the module requires the property (SPIRV-Cross writes -x and abs(x), Metal's own operators on the same operand); - a half's widening to float (fpext, air.convert) and a half fabs, and a module's reads and encodes of a half's bits, record no note and require the property, but only where the module moves its halves through the registers as measured. narrow::moves_unfolded keeps the note where a widened half is stored anywhere but a buffer, workgroup memory or a function's float variable, passes through a call, return, group, atomic or image operation, has its bits read (a bitcast that is not stored, frexp/modf/ldexp: the frexp routines stay noted), or where the module holds a float NaN constant other than 0x7fc00000. - A half fneg stays noted on every profile: the measured shapes matched only because the driver's compiler moved the negation onto the half. By construction: MoltenVK's MSL writes float(as_type<half>(x)) and half(f); Metal's compiler folds half(float(h)) across selects, phis and a function's local float variable, so moved halves keep their bits as Metal's do. Verified (all runs on this M3 Max): - Plain Metal running the lane's own AIR (8 kernels; every one of the 65,536 half patterns, 98,368 float words including 65,536 structured NaNs) matches the lane's model in every word. - runtime_lane::nan_moves on MoltenVK: the note is absent from every kernel but the half fneg, and 0 lanes differ from Metal in all 8 kernels. - Earlier MSL probe, fast and precise math: the same equalities over 262,144 float words. - New core tests: half_moves_are_metals_only_where_the_device_folds_them (a payload NaN constant keeps the note), the frexp negative control in engine_metal_routines, float_sign_operations and the class C/D NaN tests with a moves argument, and the driver-facts lists. - Core nextest (metal2vulkan, air, runtime, devtools, --all-features): 4,989 passed. Docs: API.md (native-nan-encoding exemption), HOWTO.md, the PrecisionNote and deviation rustdoc. SEMANTICS_VERSION 1946, ARTIFACT_FORMAT_VERSION 483 (a new VkProperty in the codec); these bumps cover the rest of this branch. api_signatures blessed (two variants); the moltenvk-m3 profile's golden hash re-blessed. (cherry picked from commit 93ae66b6ddb46b4d0d3db1944a4b043c40911592) (Note on the development copy: this message names SEMANTICS_VERSION 1946; the commit sets 1948, after a rebase.)
This commit is contained in:
1 parent
723191efb4
commit
3e28f68331
28 files changed
+1006
-149
No files matched your search
+13
-1
@@ -3458,7 +3458,19 @@ bound.
|
||||
widen with its bits. And wherever a `half` is encoded to its bits (a store, a reinterpretation, a
|
||||
texel's bits) where they are not the bits it was read from, on every device, since the encode is
|
||||
the device's narrowing (its conversion with `shaderFloat16`, `PackHalf2x16` without): a NaN's
|
||||
bits the device's, where Metal keeps a `half` NaN's sign and payload.
|
||||
bits the device's, where Metal keeps a `half` NaN's sign and payload. **Exempt:** on a profile
|
||||
that takes `DriverDeviation::MetalNanMoves`, MoltenVK on Apple's GPUs of the Apple M3 Max's
|
||||
macOS 27 identity, whose widening, narrowing, `float` `fneg` and `fabs` and `half` `fabs` were
|
||||
measured to answer Metal's bits (every `half` widened, moved through a select, a phi of a
|
||||
`half` and of a `half2`, a later block and `fabs`, and 98,368 `float` words negated and taken
|
||||
the magnitude of, on Metal and on the runtime, `runtime_lane::nan_moves`), a `float` `fneg` or
|
||||
`fabs`, a `half`'s widening to `float`, a `half` `fabs`, and a module's reads and encodes of a
|
||||
`half`'s bits record no note and require `VkProperty::MetalNanMoves`. The exemption stops where
|
||||
the module carries a widened `half` out of the registers before narrowing it (a store to a stage
|
||||
output or a variable other than a function's `float` one, a call, a return, a group, atomic or
|
||||
image operation), reads its widened bits (a bitcast but to store them to memory, `frexp`,
|
||||
`modf`, `ldexp`), or holds a `float` NaN constant other than `0x7fc00000`: such a module
|
||||
records the note there too. A `half` `fneg` records it on every device.
|
||||
- `metal2vulkan-degrade-native-min-max` (precision). `PrecisionNote::NativeMinMax`: Native device
|
||||
maths: Metal's `fmin`, `fmax`, `min3`, `max3`, `clamp` or `saturate` (its `clamp(x, +0, 1)`) on
|
||||
`float` or `half` is the device's `GLSL.std.450` `NMin`, `NMax` or `NClamp`, on a device not
|
||||
|
||||
Reference in new issue
Block a user