Repository navigation
fix(shader): return src0 when both f32 min/max sources are NaN - #568
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks. The change is exactly the select order: the rhs-NaN select now wins last, so two NaNs give src0 unchanged and a single NaN still gives the other source; the ±0 and numeric paths are untouched. All callers pass src0 as
It changes |
|
Gated on PPSA21564: no visual or FPS change. |
What
v_min_f32/v_max_f32with two NaN sources returned src1. On hardware they return src0, sov_min3_f32,v_max3_f32andv_med3_f32(built from the same helper) gave the wrong NaN too.EmitMinMaxF32Valuenow picks src0 when both sources are NaN; every other case is unchanged.f16 min/max go through the same helper on main, so their both-NaN result is now src0 too. That is the f16 hardware rule (#533).
Behaviour measured on HW (RDNA2 gfx1035 compute kernel, MODE
IEEE=0 DENORM=0, the mode the recompiler assumes): all 4913 triples of 17 values (±0, ±1, 2.5, -3, ±inf, max float, min normal, ±qNaN with payloads, ±sNaN) throughv_min_f32,v_max_f32(e32 and e64),v_min3_f32,v_max3_f32andv_med3_f32. A model matches all 34391 results:med3with any NaN returnsmin3Only the both-NaN row differs from main. With
IEEE=1the hardware quiets sNaN, which the recompiler doesn't model (same as before this PR).Tested
New execution test
agc_driver_f32_min_max_nan(F32MinMaxNan.cpp): 128 rows (all 100 ordered pairs of ±0, 1, -3, ±inf, ±qNaN, ±sNaN, plus rows picked to cover the remaining class combinations) × 7 ops, expected values taken from the hardware, compared bit for bit. All result bits are picked by selects, so the driver's NaN handling doesn't affect them. It fails on main (row 67 v_min_f32 v10, v4, v5 is 0xffd54321, expected 0x7fc12345) and passes with the change on RADV, local lavapipe and CI's lavapipe (Mesa 25.2.8). Full Release ctest on Linux/RADV: only the three tests that already fail on main locally (agc_driver_pixel_helper_lanes,agc_driver_global_load_addtid,agc_driver_vop3_carry_out, wave32 lane 32 on RADV's 64-wide subgroup) fail. Theagc_driversuite passes on CI's lavapipe.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)