translator: a controlled half pair is noted on every device; the two half workarounds go

What: a half rounded through the device's conversion and its widening under the 16-bit float
controls (QuantizeForm::Controlled) now records PrecisionNote::NativeHalfConversion on every
device, as a static note of the operation. Every profile with shaderFloat16 and those controls
takes that form, NVIDIA's included. DriverWorkaround::HalfConversionPairFolded (NVIDIA, identity)
and DriverWorkaround::HalfConversionFusedWithArithmetic (RADV, identity) are deleted, with
narrow::rounds_arithmetic, which only the second read.

Why: rule 2 of the owner's rules (one path for every device, no identity-keyed branch) and the
planner's ruling on these two rows of the workaround ladder. The pair is Metal's half(float) by
the Vulkan spec, but a driver's compiler may fold it (NVIDIA's) or fuse the float operation into
the narrowing (RADV's). Recording the note statically on every device covers both drivers with no
identity check, and it never refuses. NVIDIA's modules move from the Converted form to the
Controlled one (NoContraction on the pair, the entry declaring the 16-bit modes), so its golden
cells move. ANV's and RADV's modules gain only the note, which is not hashed. SEMANTICS_VERSION
goes to 2149.

Tests: engine_native_half, device::tests::profile (half_rounding_follows_the_queries_alone replaces
the two identity tests), engine_float_call_notes, and the native_maths and half_conversions
lanes, updated to expect the note on every controlled profile. Docs: API.md's
NativeHalfConversion entry and HOWTO.md. api_signatures.tsv loses the two variants, and
REFUSALS.md is regenerated unchanged.
This commit is contained in:
Anees Iqbal committed 2026-11-17 09:45:26 -08:00
1 parent eddc9b80bf
commit 07e62aa306
16 files changed
+225 -410

No files matched your search

+10 -12
View File
@@ -5229,18 +5229,16 @@ bound.
- `metal2vulkan-degrade-native-half-conversion` (precision). `PrecisionNote::NativeHalfConversion`:
Native half rounding (a conversion): the module rounds a `half` result it computes in `float` (a
`half` operation's, a function's, a conversion from `float`'s, a texel's) by the device's
conversion of the `float` to 16 bits and its widening, on a device with `shaderFloat16` whose
float controls do not make that conversion Metal's `half(float)` (`RoundingModeRTE`,
`DenormPreserve` and `SignedZeroInfNanPreserve` for 16 bits: ANV and RADV round through the
conversion under them, exactly, with no note): NVIDIA, whose driver folds the conversion's round
trip even under those controls (`DriverWorkaround::HalfConversionPairFolded`), MoltenVK,
lavapipe, and any device without them. NVIDIA's pipelines compute under those controls all the
same: a `half` `+`, `-`, `*`, `/` and `sqrt` there are the device's 16-bit instructions, whose
results take no such rounding. Also recorded under those controls on RADV where the
`half` is the result of a `float` addition, subtraction, multiply or fused multiply-add: its
compiler fuses the operation into the conversion and rounds the exact result once
(`DriverWorkaround::HalfConversionFusedWithArithmetic`), one `half` ulp from Metal's where the
`float` result lies on a `half` midpoint. Also recorded where a `half` read from its bits is the
conversion of the `float` to 16 bits and its widening, on every device with `shaderFloat16`.
Under the float controls that make that conversion Metal's `half(float)` by the Vulkan spec
(`RoundingModeRTE`, `DenormPreserve` and `SignedZeroInfNanPreserve` for 16 bits, which the entry
then declares) the pair is decorated `NoContraction`, and the note is recorded all the same, on
every device: a driver's compiler may still fold the pair into the value it started from
(NVIDIA's does, leaving the value unrounded) or fuse a `float` addition, subtraction, multiply or
fused multiply-add into the narrowing and round the exact result once (RADV's does, one `half`
ulp from Metal's where the `float` result lies on a `half` midpoint). Under those controls a
`half` `+`, `-`, `*`, `/` and `sqrt` are the device's 16-bit instructions, whose results take no
such rounding. Also recorded where a `half` read from its bits is the
device's widening, or a `half` encoded to its bits (where they are not the bits it was read from)
is the device's narrowing, and that conversion is neither under those controls nor measured to be
Metal's: the conversion on lavapipe, and `GLSL.std.450 UnpackHalf2x16` and