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

Closed
github-bot wants to merge 1 commit from gh-pr/197/head into gh-pr/197/base
Owner

@⁠SchmashinPrunes on GitHub · 2026-11-23 00:46 UTC · original
SchmashinPrunes:rdna2-silicon-nan-class → main · +29 −0 · 3 files · 1 commits · closed without merging

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

**@⁠SchmashinPrunes** on GitHub · 2026-11-23 00:46 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/197) `SchmashinPrunes:rdna2-silicon-nan-class` → `main` · +29 −0 · 3 files · 1 commits · closed without merging 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)
Under TOMBOX_EXEC_HW=1 the 33 f16 FMA cases whose recorded gfx1036
result is a NaN now check that the result is a NaN (v_cmp_class_f16
with the NaN classes) and that the upper half is preserved, instead of
the exact payload: the translator uses host f16 math, so the payload
follows the host GPU (an RTX 3080 returns 0x7fff, #194). WARP still
compares every case bit-exact. BLOCKERS records that RDNA2 f16 FMA NaN
propagation is not modelled on non-AMD hosts. The recorded table is
unchanged; verify_gen.py writes the new test body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xsrj8HzdWhzzYYavNNpHjk
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:13:29 +00:00
github-bot closed this pull request 2026-11-26 06:13:29 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-23 00:53 UTC · original

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).

**@⁠omonkeyz** on GitHub · 2026-11-23 00:53 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/197#issuecomment-7088709472) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.