tools: hold the ALU check's float results to the native RDNA 2 reference #446
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/446"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-11-29T05:08:02Z.
Summary
Holds
check_basic_alu_gpu.py's float results to the hardware reference from #420 instead of its own looser models. At this head it passes on the RX 6700 XT. An RTX 3090 and an RTX 5090, run by contributors (thanks @snoozedDev and @NickStallman), passed it at0f6af00, before #571 was merged; see Tested.Five commits:
tools: judge the ALU check's float results by the native RDNA 2 reference. The check's programs never write MODE, so they run under0xc0. The float instructions the native routes ran now expectrdna2_float.py's words under that mode: denormal sources flushed, signaling NaNs passed through, one rounding for the fused forms, -0 below +0 for min and max.Float.matchesnow looks atalsowhen the expectation is a NaN; it used to return before it got there.tools: feed the ALU check the native float reference's edges and triples.FLOAT_EDGEhad no f32 denormal, no signaling NaN and no negative NaN, and the random values stay between 2^-30 and 2^30, so the check never fed in a source the card flushes. It now takes the reference's edge values and its chosen triples (products whose fused and separate sums differ, results tiny after rounding). Lanes stay deterministic. The DX9 multiply-adds keep the shader of their own and the ∞ × denormal triple #571 gave them, ahead of the shared triples.tools: tolerate what NVIDIA hosts do to NaN and denormal float results, by name. What the first NVIDIA run showed, below.tests: hold the approximate models' flushed and kept sides apart.test_native_rdna2_approxlanded onmainwhile this was open and still expected the old models' rejections forv_rcp_f32and its relatives. It now checks that the flushed side accepts every word the card gives and the kept side rejects the same lanes as before.tools: drop the v_mac_legacy_f32 fault that #571 fixed. #571 madev_mac_legacy_f32keep the DX9 multiply, so it's now held to the same model asv_mad_legacy_f32, with only the console's rounding left open.Why
With the new inputs and the old models, 27 instructions fail on the RX 6700 XT, and for the ones the reference covers it's the model that's wrong and the GPU that's right: the models compute from denormal sources the card flushes. For example
v_ceil_f32(0x00000001)is +0 on the card and 1.0 in the model, andv_mul_f32of0x7f7fffff × 0x00000001is 0 on the card.What still passes without being exact
The blanket slack is gone (any NaN, either zero sign, fused or not). What a host may still do differently is named, and the receipt counts it under
tolerated:v_fma_f32was 5 lanes on one and 2 on the other, same shader.v_mac_f32,v_mad_f32,v_madak_f32,v_madmk_f32rounded once or twice. gfx1030 doesn't have them, so the reference can't say.v_med3_f32,v_cubesc_f32,v_cubetc_f32reading a denormal source as it is. No hardware result for those yet.v_fma_f32in the shader where av_mul_f32shares its product. This is the one from #333 that the check already accepted either way; it's still accepted, it's just counted by name now. It's modeled exactly, so the check will say so when it stops showing.The other translator fault this found,
v_mac_legacy_f32without the DX9 rule, is fixed by #571, so this no longer tolerates it.What NVIDIA does differently
The first 3090 run failed 32 instructions, in two groups. Both are now named, and both apply only when
--adapterstarts with10de:, so AMD results stay exact:0x7fffffff(f32) or0x7fff(f16) for every NaN result, whatever the sources. Accepted only where the reference, or a word already named for that lane, is a NaN of that width. 656 lanes at0f6af00. Two of them werev_mac_legacy_f32lanes where only the DX9-rule fault gave a NaN; with #571 those should now return the card's number.v_min_f32,v_max_f32,v_floor_f32andv_ceil_f32don't flush a denormal f32 source on NVIDIA, where RADV does and the console does. The translator writes them as plain HLSL with no flush. 21 lanes. Modeled exactly; a translator flush is the fix, not done here.So that answers the question I had before the NVIDIA runs: NVIDIA does flush f32 denormals in general (
v_mul_f32(0x7f7fffff, 0x00000001)is 0 on the 3090), except in those four instructions.Under DXVK an NVIDIA card can report as
1002:73dfuntildxgi.hideNvidiaGpu = Falseis set. Pass the real10de:id;CONSOLE_REFERENCE.mdhas the details.The float-forms check shares
Float.matches, so I ran it too; it's unchanged and passes.Doesn't touch the translator or anything the game runs, so I didn't run the game for this.
Tested
0f6af00, before #571. A rerun of--only alu --only float-formsat this head would confirm the merge.No Lanes scenario: this changes what a translator check expects, not provider behaviour.
GPU, driver and backend: RX 6700 XT (
1002:73df, RDNA 2), Mesa RADV 26.3.1, GE-Proton11-14, at58fb8daonmainata564e8c. Earlier heads also ran on a Radeon 890M (1002:150e, RDNA 3.5) and, by contributors at0f6af00, an RTX 3090 (10de:2204, 615.78.08, results) and an RTX 5090 (10de:2b85, 620.70.10, results).The
Evidence:linetuxbox.py checkprints last, one per card (it names the commit it tested; run it on this pull request's head):Commands run and their results:
mad rounded twiceis x9 here, against x8 before. Whether the driver fuses thatmadis its choice per shader, so the count can move. I haven't traced which lane is new.The one refusal is
s_bcnt0_i32_b32("needs proven ordinary scalar operands (not a wave mask)"). It's refused onmainwithout this change as well, and it isn't a float instruction.Checks
No evidence JSON changes. The tests for #420's receipts now also require the ALU models to give every recorded MODE
0xc0word.Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-11-29T18:30:55Z.
NVIDIA run of the two commands under Tested. On the RTX 3090 the ALU check fails with 32 instructions wrong. float-forms passes.
GPU, driver and backend: RTX 3090 (
10de:2204), NVIDIA 615.78.08, GE-Proton11-14. PR head1a58255built as it is (not rebased). For control, I ranmainat56ebdc8on the same card, and the PR head on an RDNA 2 iGPU (1002:164e, RADV 26.2.5).I ran the PR head three times on the 3090. All three runs gave the same 32
WRONGlines and the sametoleratedline. The refusal iss_bcnt0_i32_b32, as on your cards.The check prints one
WRONGline per instruction, for the first lane that differs, so the rows below are those first lanes. To see every lane, I ran the PR head once more on the 3090 with a local print added to the check (not committed) that saves every lane. That run gave the same 32WRONGlines and the sametoleratedline. It has 677 wrong lanes across the 32 instructions. The lane counts below come from it.By first lane, the 32 fall into two groups.
NaN results, 30 instructions (656 lanes across all 32). Every wrong lane where the 3090 returns a NaN returns
0x7fffffff(f32, 443 lanes) or0x7fff(f16, 213 lanes), whatever the sources' sign and payload. So these lanes don't fall under "another NaN source"; they come back as wrong. In 652 of them the reference itself expects a NaN. In the other 4 it expects a number and only a tolerated alternative is0xffc00000. Two arev_mac_legacy_f32lanes (0x7f800000times a zero or a denormal) where the reference wants the DX9-rule result. That probably explains why the tolerated line below has the "without the DX9 rule" entry x2 here against x4 on the iGPU. The other two arev_mad_legacy_f32andv_mac_legacy_f32on0x7f000000, 0x7f000000, 0xff800000, where the reference wants0xff800000and "rounded twice" is the tolerated NaN.v_min_f32andv_max_f32have NaN lanes too (2 each), but their first wrong lane falls in the other group.v_ceil_f32andv_floor_f32are the reverse: their first wrong lane is a NaN, and they also have lanes in the other group. Examples:v_add_f320x4f000000, 0x7fc00000, 0xffc123450x7fffffff0x7fc00000v_sub_f320x4f000000, 0x7fc00000, 0xffc123450x7fffffff0xffc00000or0x7fc00000v_fma_f320xbf800000, 0x4f000000, 0x7fc000000x7fffffff0x7fc00000v_floor_f320x7fc00000, ...0x7fffffff0x7fc00000v_fma_mix_f32@lll0x00000000, 0xc0200000, 0xff7fffff0x7fffffff0xffffe000v_fma_mixlo_f16@hhh0x00000000, 0xc0200000, 0xff7fffff0x7fff0x0000ff7fA denormal source read as it is, 2 instructions (21 lanes in 4). By lane:
v_min_f328,v_max_f326,v_ceil_f324,v_floor_f323. Examples (the first two are the check'sWRONGlines):v_min_f320x7f7fffff, 0x00000001, 0xbfc000000x000000010x00000000v_max_f320xff7fffff, 0x807fffff, 0x402000000x807fffff0x80000000v_ceil_f320x00000001, 0xbfc00000, 0x800000010x3f8000000x00000000v_floor_f320x807fffff, 0x40200000, 0x007fffff0xbf8000000x80000000On your denormal question, for your two examples:
v_ceil_f32(0x00000001)is wrong on the 3090. It returns0x3f800000(1.0) where the reference wants0x00000000.v_mul_f32(0x7f7fffff, 0x00000001)matches: both give0x00000000, so the 3090 flushes that source. Across all 359 instructions, the only wrong lanes with a denormal source and a result that isn't a NaN are the 21 above, inv_min_f32,v_max_f32,v_ceil_f32andv_floor_f32.v_trunc_f32andv_rndne_f32have no such lanes, but for them flushing and not flushing give the same ±0, so these inputs can't tell. Themin3/max3/cvt_flr"unmeasured" entries below, which the iGPU run here doesn't list, fit the same pattern.v_cubesc_f32andv_cubetc_f32are unmeasured on both, but x10 and x6 here against x7 and x4 on the iGPU.v_med3_f32is x12 on both.All 32 WRONG lines (identical in all four runs)
The
toleratedline on the 3090 (same in all four runs):Compared with AMD: there is no
v_fma_f32 translator fault: mad rounded twiceentry at all. Your two cards and the iGPU here show x8. Nothing inalu.logoralu.jsonsays a modelled fault went unseen. On fusion: the "rounded once" entries forv_mac_f32,v_mad_f32andv_madak_f32(x6, x6 and x4 on the iGPU) are absent here, and "rounded twice" x5 forv_mac_legacy_f32andv_mad_legacy_f32appears only here. Most of the "another NaN source" entries are gone, which fits the 3090's NaN matching none of the sources.One local setup detail, in case another NVIDIA run disagrees on the adapter: DXVK here reported the 3090 as
1002:73dfuntil I setDXVK_CONFIG="dxgi.hideNvidiaGpu = False", and the check's adapter guard refused that (guest failed: 0 {'adapter': '1002:73df', ...}; I confirmed that onmain). I also setVKD3D_FILTER_DEVICE_NAME/DXVK_FILTER_DEVICE_NAME, because there's novulkaninfoon this machine.Not run: the full
python tuxbox.py check, any Lanes scenario, and any check other than--only alu --only float-forms.This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-11-29T21:48:16Z.
@snoozedDev Thanks for the 3090 run, the per-lane counts made this easy to act on. Pushed
0f6af003.I read your two groups differently:
0x7fffffff(f32) or0x7fff(f16) whatever the sources. The check now accepts that word, only on an NVIDIA adapter, and only where the reference or an already-named alternative is a NaN of that width. It's counted intoleratedasNVIDIA host: canonical NaN. Other NaN payloads,0x7fc00001for example, and either zero sign are still wrong.v_min_f32,v_max_f32,v_floor_f32,v_ceil_f32: I treated this as a translator fault. The console flushes these sources and the translator writes plain HLSLmin/max/floor/ceil, with no flush. So I modeled it exactly instead of dropping those inputs. It's counted astranslator fault on NVIDIA: a denormal source read as it is. Fixing the translator is a separate change.Both names apply only when
--adapterstarts with10de:, so AMD results are unchanged. A name counts only where it's seen, so the missingv_fma_f32"mad rounded twice" on your card fails nothing.min3/max3/cvt_flr/cubesc/cubetc/med3are untouched and still unmeasured.Your DXVK note is now in
docs/CONSOLE_REFERENCE.md. The tolerances follow--adapter, so pass the real10de:id withhideNvidiaGpu = Falseset. Passing the reported1002:73dfgets AMD-exact rules on an NVIDIA card.I have no NVIDIA card, so none of this has been run on one. Could you rerun the two commands at
0f6af003? I'd expect 0 wrong and atoleratedline with both new names. If a NaN lane still comes back wrong, the first-lane row from thatWRONGline would show whether the canonical-NaN assumption holds for every lane.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T21:54:15Z.
NVIDIA run of
0f6af003as it is, RTX 5090 (10de:2b85, 620.70.10, GE-Proton11-14, Linux;windows-dxc1.8.2505.1; provider built from a tree on2d6dc338):I ran these two checks, not the whole translator check.
Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-11-29T22:01:07Z.
Reran the two commands at
0f6af003, built as it is. Same setup as before: RTX 3090 (10de:2204), NVIDIA 615.78.08, GE-Proton11-14,hideNvidiaGpu = False,--adapter 10de:2204. Both checks pass, with 0 wrong.The refusal is still
s_bcnt0_i32_b32. The three 3090 runs printed the sametoleratedline. It has both new names, and the counts match the per-lane dump from1a58255exactly:NVIDIA host: canonical NaN: 32 entries, 656 lanes in total. That is every lane that came back as0x7fffffffor0x7fffat1a58255, the 4 where only a tolerated alternative was a NaN included.translator fault on NVIDIA: a denormal source read as it is:v_min_f32x8,v_max_f32x6,v_ceil_f32x4,v_floor_f32x3, 21 lanes, the same split as before.Every other entry is unchanged from
1a58255on this card. On the iGPU thetoleratedline is identical to its1a58255run, and neither new name appears.python -m unittest tests.test_basic_alu_referencepasses at0f6af003(16 tests).The 3090's tolerated line at
0f6af003Not run: the full
python tuxbox.py check, any Lanes scenario, any check other than--only alu --only float-forms, and the1002:73dfcase you describe.This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-11-29T22:04:18Z.
Thanks, both. The 3090 counts line up exactly with the per-lane dump (656 canonical-NaN lanes, 21 denormal), and the iGPU's tolerated line didn't change, so AMD stays exact. The 5090 passing too is a nice second data point.
Since then I've rebased onto main and fixed a test that landed there in the meantime (
test_native_rdna2_approx, which still expected the old models' rejections). The ALU check's float models are unchanged from0f6af003, so no need to rerun.Imported from brcly/TuxBox. Originally posted by JeffreyBytes on 2026-11-30T13:25:05Z.
Rebased onto main now that #571 is in, and added a commit that drops the
v_mac_legacy_f32DX9-rule fault from the check, since #571 fixed it.v_mac_legacy_f32is now held to the same model asv_mad_legacy_f32, with only the console's rounding left open. The rebase had two conflicts: #571'sseparateandALU_CHECK_REJECTSchanges, which this PR removes anyway, and its ∞ × denormal triple, which I kept. The DX9 multiply-adds still get their own shader and run that triple ahead of the shared ones, so every other float shader feeds the same lanes as before.check --changedat58fb8daon the RX 6700 XT: 15 passed, 0 failed.aluis 362 instructions, 0 wrong, and the DX9-rule fault no longer shows up undertolerated.@snoozedDev @NickStallman, could one of you rerun
--only alu --only float-formsat58fb8da? Your runs were at0f6af00, before #571, and the contributing rules want each vendor on the PR's head. I'd expect 0 wrong and the sametoleratedline as before, exceptv_mac_legacy_f32: the "without the DX9 rule" entry should be gone, and the two canonical NaN lanes that came from it should now return the card's number.Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T18:46:33Z.
@JeffreyBytes at
58fb8dae, fullpython tuxbox.py check(which includes both), GE-Proton11-14:10de:2b85, 620.70.10)1002:13c0, RADV)alufloat-formsThe check's summary line doesn't print the
toleratedlist, so I haven't compared that part with the earlier run.Evidence: TuxBox check of
58fb8dae3e, no uncommitted changes, GPU 10de:2b85: 17 passed, 0 failed, 0 not runEvidence: TuxBox check of
58fb8dae3e, no uncommitted changes, GPU 1002:13c0: 17 passed, 0 failed, 0 not run