DriverWorkaround::HalfConversionPairFolded (every NVIDIA_PROPRIETARY GPU)
made narrow::controlled_modes return None, so NVIDIA's profiles lost the
16-bit float controls altogether: quantize_form was Converted and
f16_arithmetic None, a half + - * was computed in f32 and "rounded" by an
FConvert pair the driver folds away, spirv::half_hold never ran, and a
half / and sqrt were f32. The workaround is the pair's alone: NVIDIA's
compiler folds an OpFConvert 32->16 and its widening back into the 32-bit
value; it reports RTE, DenormPreserve and SignedZeroInfNanPreserve for
Float16 (independence ALL), under which its 16-bit instructions and a
single conversion are Metal's by the Vulkan spec (owner rule 1: the
device's native form is the only form).
- narrow::half_controls(p): shaderFloat16 and every mode of
controlled_modes, which no longer reads the workaround.
- narrow::quantize_form: Controlled (the decorated pair under the
controls) only where the driver keeps the pair; NVIDIA stays Converted,
so an f32 result rounded to half through a round trip is still the
device's conversion, recorded NativeHalfConversion.
- What keyed on Controlled but is no round trip now keys on the controls
(ArithPlan::controls, ModuleBuilder::half_controls): a half + - *
(f16_arithmetic), / (divide::native), sqrt (math::float_fn), the half
fma route (fma::half_route), spirv::half_hold, and in compile.rs the
declaration of the modes and the widening/narrowing note. The modes are
declared for a pair only where the pair is Controlled.
- Unchanged: blend's half_of, round, round_texel and the bit conversions
follow the rounding form.
Docs: narrow.rs, half_hold.rs, divide/math/fma, the workaround's doc,
PrecisionNote::NativeHalfConversion, docs/API.md's
native-half-conversion entry and docs/HOWTO.md say NVIDIA computes under
the controls and keeps the native conversion for the round trip only.
Tests:
- tests::engine_native_half::nvidia_computes_half_on_16_bit_floats_under_the_float_controls:
nvidia-rtx50-linux, nvidia-rtx5080-laptop and the 5080 laptop's
description with an RTX 2080's (0x1E87) and an RTX 3090's (0x2204)
device ID emit 16-bit OpFAdd/OpFMul for a half sum, product and chain,
declare the three 16-bit modes, require their properties, record no
NativeHalfConversion, pass L3, and round each operation on the
interpreter; a half narrowed and widened alone stays the noted round
trip. Negative control: the 2080 description without
shaderRoundingModeRTEFloat16, and Pascal (no shaderFloat16), emit no
16-bit instruction or mode and record the note.
- Existing tests that pinned NVIDIA's widening note or keyed on
Controlled for the controls follow the split.
- runtime_lane::native_maths::half_arithmetic_under_the_float_controls_answers_metals
(device): a half sum, difference, product and product plus a third
operand over 4096 threads equal Metal's per-operation half answers
exactly where the module declares the controls; it prints how many
words the f32 computation (the folded pairs' answer) differs at.
half_rounding_answers_within_its_recorded_bound now expects the sum
Metal's and the round trip noted on a driver that folds it.