rdna2_silicon: compare f16 FMA NaN results as a class on hardware GPUs (fixes #194) #197

Closed
SchmashinPrunes wants to merge 1 commit from upstream-pr/197 into main
SchmashinPrunes commented 2026-11-23 00:46:52 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by SchmashinPrunes on 2026-11-23T00:46:52Z.


Fixes #194, as proposed there.

Library / area: tombox-xshader tests (exec_vop/rdna2_silicon.rs), tools/rdna2-hwprobe/verify_gen.py, docs/BLOCKERS.md

Exports changed (exports.txt rows): none

Change

  • rdna2_silicon_results: when TOMBOX_EXEC_HW is set, f16 FMA cases (v_fmac_f16, v_fmamk_f16, v_fmaak_f16) whose recorded gfx1036 result is a NaN compare as a NaN class. For each such case the test checks two things:

    • v_cmp_class_f16 with the signalling and quiet NaN classes (mask 3) gives 1;
    • the upper 16 bits match the record exactly.

    It prints how many cases took that path. Every other case, and every case on WARP, is still compared bit-exact.

  • Sign isn't part of the class check, because the NaN in #194 also differs in sign (0x7fff from the RTX 3080, 0xfe00 recorded). IEEE leaves the sign of a propagated NaN unspecified.

  • verify_gen.py writes the new test body. The recorded CASES table is byte-identical to main's, regenerated from the same recordings.

  • docs/BLOCKERS.md: a new entry saying RDNA2 f16 FMA NaN propagation isn't modelled on non-AMD hosts. It also notes the signalling-NaN-unquieted behaviour that the recordings leave out.

Tests (Windows 11 Pro, DXC 1.9.2609, on c4e72f0)

cargo test -p tombox-xshader --release --test exec rdna2_silicon                       (WARP)
  rdna2_silicon: 15 mnemonics verified, 0 failing, 480 cases (fixed and runtime inputs)
TOMBOX_EXEC_HW=1 cargo test -p tombox-xshader --release --test exec rdna2_silicon      (AMD Radeon RX 9060 XT)
  TOMBOX_EXEC_HW: 33 f16 FMA cases whose recorded result is a NaN compare as a NaN class
  rdna2_silicon: 15 mnemonics verified, 0 failing, 480 cases

The 33 cases are the ones listed in #194. My hardware-mode GPU is AMD (RDNA4), so this shows the new path runs and passes, but not the NVIDIA failure itself. @kiwe147, could you rerun TOMBOX_EXEC_HW=1 cargo test -p tombox-xshader --test exec rdna2_silicon on the RTX 3080 with this branch?

  • cargo test -p tombox-xshader passes
  • No game or console files and no binaries included
  • No fake success

🤖 Generated with Claude Code

<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6549988849 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/197). Originally posted by [SchmashinPrunes](https://github.com/SchmashinPrunes) on 2026-11-23T00:46:52Z. --- Fixes #194, as proposed there. **Library / area:** tombox-xshader tests (`exec_vop/rdna2_silicon.rs`), `tools/rdna2-hwprobe/verify_gen.py`, `docs/BLOCKERS.md` **Exports changed (exports.txt rows):** none ### Change - `rdna2_silicon_results`: when `TOMBOX_EXEC_HW` is set, f16 FMA cases (`v_fmac_f16`, `v_fmamk_f16`, `v_fmaak_f16`) whose recorded gfx1036 result is a NaN compare as a NaN class. For each such case the test checks two things: - `v_cmp_class_f16` with the signalling and quiet NaN classes (mask 3) gives 1; - the upper 16 bits match the record exactly. It prints how many cases took that path. Every other case, and every case on WARP, is still compared bit-exact. - Sign isn't part of the class check, because the NaN in #194 also differs in sign (`0x7fff` from the RTX 3080, `0xfe00` recorded). IEEE leaves the sign of a propagated NaN unspecified. - `verify_gen.py` writes the new test body. The recorded `CASES` table is byte-identical to main's, regenerated from the same recordings. - `docs/BLOCKERS.md`: a new entry saying RDNA2 f16 FMA NaN propagation isn't modelled on non-AMD hosts. It also notes the signalling-NaN-unquieted behaviour that the recordings leave out. ### Tests (Windows 11 Pro, DXC 1.9.2609, on c4e72f0) ``` cargo test -p tombox-xshader --release --test exec rdna2_silicon (WARP) rdna2_silicon: 15 mnemonics verified, 0 failing, 480 cases (fixed and runtime inputs) TOMBOX_EXEC_HW=1 cargo test -p tombox-xshader --release --test exec rdna2_silicon (AMD Radeon RX 9060 XT) TOMBOX_EXEC_HW: 33 f16 FMA cases whose recorded result is a NaN compare as a NaN class rdna2_silicon: 15 mnemonics verified, 0 failing, 480 cases ``` The 33 cases are the ones listed in #194. My hardware-mode GPU is AMD (RDNA4), so this shows the new path runs and passes, but not the NVIDIA failure itself. @kiwe147, could you rerun `TOMBOX_EXEC_HW=1 cargo test -p tombox-xshader --test exec rdna2_silicon` on the RTX 3080 with this branch? - [x] `cargo test -p tombox-xshader` passes - [x] No game or console files and no binaries included - [x] No fake success 🤖 Generated with [Claude Code](https://claude.com/claude-code)
omonkeyz commented 2026-11-23 00:53:08 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-23T00:53:08Z.


Applied in 06110e0 (merged in 9e62058) with your authorship kept, thanks. Checked rdna2_silicon on WARP (bit-exact, unchanged) and with TOMBOX_EXEC_HW=1 (33 f16 FMA NaN cases compared as a class, all pass).

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7088709472 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/197#issuecomment-7088709472). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-23T00:53:08Z. --- Applied in 06110e0 (merged in 9e62058) with your authorship kept, thanks. Checked rdna2_silicon on WARP (bit-exact, unchanged) and with TOMBOX_EXEC_HW=1 (33 f16 FMA NaN cases compared as a class, all pass).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
omonkeyz/xbox-emulator!197
No description provided.