From e68eea5a2a5a99546b50f624e18d2eb9ca39652b Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Mon, 9 Nov 2026 01:08:29 -0800 Subject: [PATCH] Unit tests that list RADV's workarounds and set aside a half kernel's own rounding note Job 11253 (gem10, the whole metal2vulkan suite at 799d39233c) failed three tests: - moltenvk_on_apple_carries_the_early_tests_image_write_defect lists the workarounds of a description under RADV's driver id: it now carries HalfConversionFusedWithArithmetic too, which holds on any vendor as RADV's interpolation defect does. - exported_float_notes_are_the_ones_a_compile_records sets aside the note of a half kernel's own rounding (narrow::native_rounding); on a RADV profile the rounding of a half function computed in float arithmetic (log10_f16_flagless on amd-rdna2-apu-radv) now records NativeHalfConversion through the fused conversion (narrow::rounds_arithmetic), which is the module's rounding, not the function's, so the test sets it aside as well where the exported notes do not name it. - golden_hashes_match_the_table: 6480 cells under the RADV profiles, whose profile key changed with the new workaround ("no SEMANTICS_VERSION bump is needed"); re-blessed on development. (cherry picked from commit bd1796334a0cd8150484d2e8d4a9bccfb3d56898) --- crates/metal2vulkan/src/device/tests/profile.rs | 3 ++- .../src/tests/engine_float_call_notes.rs | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/crates/metal2vulkan/src/device/tests/profile.rs b/crates/metal2vulkan/src/device/tests/profile.rs index f52b79a2d..a07c85793 100644 --- a/crates/metal2vulkan/src/device/tests/profile.rs +++ b/crates/metal2vulkan/src/device/tests/profile.rs @@ -723,10 +723,11 @@ fn moltenvk_on_apple_carries_the_early_tests_image_write_defect() { desc.driver_id = Some(vk::DriverId::MESA_RADV); // Every rasterizer but Apple's hands a clipped primitive's fragments other coverage than // Metal's pieces, and every tessellator but Apple's orders a patch's triangles its own way; - // RADV's own interpolation facts hold on any vendor. + // RADV's own interpolation facts and its fused half conversion hold on any vendor. assert_eq!( workarounds(&desc), [ + W::HalfConversionFusedWithArithmetic, W::InterpolationNeedsTheWholeQuad, W::PerspectiveReadsExtrapolated, W::ClippedCoverageNotMetals, diff --git a/crates/metal2vulkan/src/tests/engine_float_call_notes.rs b/crates/metal2vulkan/src/tests/engine_float_call_notes.rs index 17d7e4eb7..1ad20438f 100644 --- a/crates/metal2vulkan/src/tests/engine_float_call_notes.rs +++ b/crates/metal2vulkan/src/tests/engine_float_call_notes.rs @@ -11,7 +11,9 @@ //! does, and whether its moves of a NaN are Metal's (`nan::moves_answered`). Each artifact's notes are exactly what the exported function answers for that call //! in that entry's math mode. The loads and stores around it record none, but a `half` kernel's //! widening and rounding, which the module records once by the profile's own form: its rounding's -//! note (`narrow::native_rounding`), which the test sets aside, and a module's widening of a +//! note (`narrow::native_rounding`), and under the float controls on a driver that fuses `float` +//! arithmetic into the conversion `NativeHalfConversion` where the module rounds such a result +//! (`narrow::rounds_arithmetic`), which the test sets aside, and a module's widening of a //! `half` from its bits or narrowing of one to them by the device (every profile), whose NaN's //! bits are the device's (`narrow::widens_bits`, `narrow::encodes_bits`, `NativeNanEncoding`) but //! where the device's moves of a NaN are measured to be Metal's (`narrow::moves_unfolded`), and @@ -22,7 +24,7 @@ use crate::air::intrinsics::{AirIntrinsic, Elem, Math, NumTy, Operand}; use crate::air::ir::{BinOp, FastMath}; -use crate::device::profile::{FloatFunctions, NanEncoding}; +use crate::device::profile::{DriverWorkaround, FloatFunctions, NanEncoding}; use crate::device::requirements::VkProperty; use crate::device::DeviceProfile; use crate::error::DriverDeviation; @@ -371,6 +373,15 @@ fn exported_float_notes_are_the_ones_a_compile_records() { } let (_, m) = typed_module(&bitcode, &k.name, p) .unwrap_or_else(|e| panic!("{what}: {e:?}")); + // The module's rounding of `float` arithmetic, fused into the conversion. + let fused = form == crate::spirv::builder::QuantizeForm::Controlled + && (p.workarounds()) + .contains(&DriverWorkaround::HalfConversionFusedWithArithmetic) + && narrow::rounds_arithmetic(&m, &mut meter()) + .unwrap_or_else(|e| panic!("{what}: {e:?}")); + if fused && !want.contains(&PrecisionNote::NativeHalfConversion) { + got.remove(&PrecisionNote::NativeHalfConversion); + } let crosses = narrow::widens_bits(&m, &mut meter()) .and_then(|w| Ok(w || narrow::encodes_bits(&m, &mut meter())?)) .unwrap_or_else(|e| panic!("{what}: {e:?}"));