translator: a half fma is the device's 16-bit Fma on from_queries' profile under the 16-bit float controls
On every device the new runtime makes, Metal's fma on half was the device's float Fma on the operands held in float, rounded to half by the controlled conversion pair (two OpFConvert decorated NoContraction). On a chain of 1,024 dependent half4 fmas over 2^19 threads, the device's 16-bit Fma took 437.5 against 1,818-1,832 us on an RTX 3090, 284 against 377-389 us on an RX 7900 XTX, and 22.0 against 114.2 ms on a UHD 630 (probe jobs 42069, 42068, 42070). The translator: a new profile fact, HalfFma. Device::new keeps Measured, the routes it took (the measured 16-bit Fma on MoltenVK, OpFmaKHR on 16 bits under the controls where shaderFmaFloat16 is enabled, else the float Fma rounded), which ROWS renders as nothing, so every Device::new fingerprint and module is unchanged. Device::from_queries takes Native: a half fma is fma::Route::F16Native, the device's GLSL.std.450 Fma on 16-bit floats, wherever the profile computes half under the 16-bit float controls (shaderFloat16, with 16-bit RoundingModeRTE, DenormPreserve and SignedZeroInfNanPreserve); spirv::half_hold then removes its exact conversions, so the kernel carries no NoContraction pair for it. Elsewhere today's float Fma rounded to half stays: on the RX 550, without shaderFloat16, and on lavapipe, which does not preserve 16-bit denormals. OpFmaKHR is not taken on that profile: shaderFmaFloat16 is not one of the queries that may choose a second form, and the new runtime does not enable VK_KHR_shader_fma. The note is PrecisionNote::NativeFma, the float fma's. It is per operation, not per width: it already covers both formats with a bound for each, and Vulkan gives the 16-bit Fma the precision of the 32-bit one (a multiply and an add, each rounded), so its float bound holds in half. A half twin would add a Degradation kind to the frozen old runtime and a row to the conformance suite's native notes for the same statement. Every half fma on from_queries' profile records it, on either route, and none requires VkProperty::MetalHalfFma. RADV (Mesa 26.2.6, RX 7900 XTX) does not round the 16-bit Fma once: 1,622,016 lanes of that chain ended up to 9 half ulp from Metal's (42068). NVIDIA's driver on an RTX 3090 and Intel's Windows driver on a UHD 630 matched Metal in every lane (42069, 42070). The new runtime's README lists it among the known gaps of pipeline states. Tests: engine_arith's a_half_fused_multiply_add_is_the_devices_16_bit_fma_on_from_queries compiles a half fma through Device::from_queries on five captures: on RADV's, ANV's and NVIDIA's it is one 16-bit Fma with no NoContraction decoration, no MetalHalfFma requirement and NativeFma recorded, rounding once on the interpreter; on lavapipe's and vk12-floor's it is the float Fma rounded, NativeFma recorded, rounding twice. The profile facts test covers HalfFma and its fingerprint; the fused emit test takes the new route. docs/API.md's native-fma entry and PrecisionNote::NativeFma's doc state the 16-bit form and its bound.
This commit is contained in:
1 parent
1b97a620c8
commit
b78f8163f9
9 files changed
+276
-83
No files matched your search
+5
-1
@@ -5219,7 +5219,11 @@ bound.
|
||||
`float` fused multiply-add on a device without `OpFmaKHR`, or a `half` one where the device's
|
||||
16-bit `Fma` is not measured to be Metal's and the device has no 16-bit `OpFmaKHR` under the
|
||||
16-bit float controls, is the device's `GLSL.std.450 Fma` (on the `half` operands held in
|
||||
`float`, its result rounded to `half`), where Metal's rounds once.
|
||||
`float`, its result rounded to `half`), where Metal's rounds once. On a device
|
||||
`Device::from_queries` made 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.
|
||||
- `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
|
||||
|
||||
Reference in new issue
Block a user