Repository navigation
feat(shader): follow IEEE_MODE in f16 and f64 min and max - #2036
Conversation
|
I reviewed the full diff and the hardware evidence in the PR description. The current Build, Conventions, and Progress workflows for this head are all marked action_required, so those upstream checks have not run. CONTRIBUTING says a maintainer must approve held fork workflows; please have that done before merge. I am holding approval until the required checks are visible. |
84b1fca to
b05a804
Compare
|
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
No title was run. 🤖 Addressed by Claude Code |
The f16 min/max/min3/max3/med3 now pick NaN results on the bits and quiet a signaling NaN only with IEEE=1. With IEEE=0, v_min_f64 and v_max_f64 return the other operand for a NaN, not a quieted NaN. This completes boykopovar#1826 for these forms, as measured on RDNA2 (gfx1036). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Rebased onto current |
b05a804 to
6d1fe2b
Compare
…6-f64-ieee feat(shader): follow IEEE_MODE in f16 and f64 min and max
What
The f16 and f64 min/max family ignored the shader's
IEEE_MODE, so a NaN operand gave a different result than on the console:#1826 and #1867 made the f32 forms and the unary instructions follow
IEEE_MODE; TechnicalDebt still listed "the f16 and f64 min/max/med3" as following a single mode. This PR covers those forms:v_min_f16,v_max_f16,v_min3_f16,v_max3_f16,v_med3_f16,v_min_f64andv_max_f64. RDNA2 has no f64 min3, max3 or med3.The f16 forms now choose the NaN result on the f16 bits, like the packed f16 forms already do. The f64 forms keep their current lowering at IEEE=1 (it already matched) and get the IEEE=0 rule. The f32 path and
ieeeMinMaxF32are unchanged. Shaders with no known float mode follow IEEE=0, as elsewhere.Measured with the hardware oracle on RDNA2. I used gfx1036 (Radeon 610M), not the gfx1035 of #1826; both are RDNA2. Every float control was set explicitly, at IEEE=0 and IEEE=1, with f32 denormals kept and flushed:
main)Measured rows (gfx1036):
mainv_min_f160x0000,0xfd230xff230x0000v_med3_f160x0000,0x0000,0xfd230xff230x0000v_min_f160x7c01,0xfe550x7c010x7e01RADV,0x7fffNVIDIAv_min_f640x7ff0000000000001,+0+00x7ff8000000000001v_max_f640x7ff0000000000001,0x7ff80000000000000x7ff00000000000010x7ff8000000000001The TechnicalDebt float mode line now lists these forms with their rule. It also records a separate gap: when f16/f64 denormals are flushed, the hardware flushes denormal inputs of these instructions (
v_min_f16(0x0001, 0x8001)gives0x8000), and this lowering does not, before or after this PR.Which title needs it
No title yet. This completes the
IEEE_MODEseries (#1826, #1867) for the f16 and f64 min/max forms that TechnicalDebt still listed as following a single mode. Most titles useFLOAT_MODE0xc0 with IEEE=0, wherev_min_f64/v_max_f64now return the non-NaN operand as the console does instead of a NaN, and f16 min/max keep src0's NaN bits when both operands are NaN. No title is known to hit either case.Tested
CachyOS Linux, RTX 4070 Ti (NVIDIA) and Radeon 610M (RADV), Release build.
agc_driver_f16_min_max_nan, laid out likeagc_driver_f32_min_max_nan: 128 rows of ±0, ±1, ±inf, quiet and signaling NaNs with payloads and denormals, with garbage in the high halves, through the five f16 ops and-/|x|modifiers. Each row runs with no float mode and with IEEE=1, against tables captured on the oracle. It passes on both GPUs. Onmainit fails atrow 94 v_min_f16 v10, v4, v5 is 0x00007e01, expected 0x00007c01.agc_driver_f64_arithmeticheld the IEEE=1 results (its table matches gfx1036 exactly at IEEE=1) but ran without a float mode. It now runs both ways, and its min/max columns at IEEE=0 come from the oracle.v_min/max_f16_sdwawith WORD_0/WORD_1 selects, clamp,mul:2and neg/abs, 400 rows each in two IEEE=1 modes (DX10 clamp on and off), match the hardware on both drivers with this branch (main: 64 of 400 differ).check_conventions.py,git diff --check.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)F64Arithmetic.cppand fix(shader): round the f16 fused multiply-adds once #2000 editsFloatInstructions.cpp; different functions, I'll rebase whichever lands second🤖 Generated with Claude Code