Tests: a half +, - or * on the 16-bit instructions records NativeHalfConversion (red)

Under the 16-bit float controls a half sum, product or chain is the device's 16-bit OpFAdd or
OpFMul between exact conversions. Intel's Windows driver 101.2145 on a UHD Graphics 630 computes
such operations in float and leaves them unrounded: a standalone tree of three of them came back
at float precision (jobs m3-max-83092 on the UHD 630 and m3-max-83093, the Iris Xe under Mesa ANV
26.2.6, as the control). The planner ruled that the operation carries the static note,
NativeHalfConversion, on every device.

The tests now expect that note:
- native_half_rounding_records_its_kind: on the half sum, on lavapipe and on RADV;
- nvidia_computes_half_on_16_bit_floats_under_the_float_controls: on each of the 16-bit
  kernels.

Red until the product records it.
This commit is contained in:
Anees Iqbal committed 2026-12-03 04:14:21 -08:00
1 parent 6e83de343d
commit e87fdd5a23
1 file changed
+8 -6
@@ -196,8 +196,9 @@ fn half_rounding_is_the_devices_on_every_profile() {
/// through the conversion and records `NativeHalfConversion`; on a profile without `shaderFloat16`
/// it quantizes and records `NativeHalfQuantize`; RADV and lavapipe (the 16-bit controls, lavapipe's
/// without `DenormPreserve`) take the controlled conversion and hold `half` at 16 bits under those
/// controls: the sum, between exact conversions, records no rounding note, and the narrowing
/// widened back, a conversion pair a driver's compiler may fold, records `NativeHalfConversion`.
/// controls: the sum, the device's 16-bit `OpFAdd`, which a driver's compiler may compute in
/// `float` and leave unrounded, and the narrowing widened back, a conversion pair a driver's
/// compiler may fold, each record `NativeHalfConversion`.
/// Each passes L3. On the interpreter,
/// whose conversion and quantize round to nearest even, the native modules answer Metal's
/// `half(float)`, but for the quantize's zero below the smallest normal half.
@@ -212,10 +213,10 @@ fn native_half_rounding_records_its_kind() {
];
// Each profile and its note for each of the kernels, in their order.
let cases: [(&str, [Option<PrecisionNote>; 2]); 4] = [
("lavapipe", [None, Some(natives[0])]),
("lavapipe", [Some(natives[0]); 2]),
("runtime-floor", [Some(natives[1]); 2]),
("moltenvk-m3", [Some(natives[0]); 2]),
("amd-780m-radv", [None, Some(natives[0])]),
("amd-780m-radv", [Some(natives[0]); 2]),
];
for (stem, notes) in cases {
let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile");
@@ -887,7 +888,8 @@ const NATIVE: [(&str, &str); 4] = [
/// 16-bit instructions under them: on the committed RTX 50 series profiles (`nvidia-rtx50-linux`,
/// `nvidia-rtx5080-laptop`) a `half` sum, product and product plus a sum compute on 16-bit floats,
/// one `OpFAdd` or `OpFMul` an operation, between the narrowings of the loaded `float`s, which feed
/// them directly (no round trip, so no `NativeHalfConversion`); the entry declares
/// them directly, each recording `NativeHalfConversion` (a driver's compiler may compute them in
/// `float` and leave them unrounded); the entry declares
/// `RoundingModeRTE`, `DenormPreserve` and `SignedZeroInfNanPreserve` for 16 bits and requires
/// their properties. A `half` narrowed and widened back alone is the controlled pair
/// (`QuantizeForm::Controlled`), recorded. Each passes L3. On the interpreter each operation rounds
@@ -936,7 +938,7 @@ fn nvidia_computes_half_on_16_bit_floats_under_the_float_controls() {
assert_eq!(r.f16_ops, ops, "{what}: {r:?}");
assert_eq!(r.quantizes, 0, "{what}: {r:?}");
let conversion = a.precision.contains(&PrecisionNote::NativeHalfConversion);
assert_eq!(conversion, ops == 0, "{what}: {:?}", a.precision);
assert!(conversion, "{what}: {:?}", a.precision);
if ops == 0 {
continue;
}