Shaders: lower binary64 class comparisons #1469

Open
github-bot wants to merge 2 commits from github-bot/gh-1469 into main AGit
Owner

@⁠Luizbc2 on GitHub · 2026-11-24 18:16 UTC · original
Luizbc2:fix/rdna2-binary64-class → main · +119 −10 · 2 files · 2 commits · open

What changed

Translate v_cmp_class_f64 and v_cmpx_class_f64 using the existing classification and lane-mask path. The two source words stay as i32, so the low payload participates in distinguishing infinities from NaNs and zero from subnormals, without requiring host driver FP64 support. Source abs/neg only update the sign bit. The FP64 arithmetic and ordered compares are covered separately by #1262.

Reproduction and tests

  • On ffe310e, the synthetic v_cmp_class_f64_preserves_all_binary64_classes test fails at shader lowering with Unsupported { offset: 44, what: "v_cmp_class_f64" }.
  • cargo test -p victory-shader --lib --locked --offline v_cmp_class -- --nocapture passed on Windows with the patch. The new test exercises all ten class bits, negative masks, low-word-only payloads, SGPR input, and abs/neg. The existing binary16 test also passed. The compute cases ran on hardware and WARP.
  • git diff --check passed.

AMD RDNA 2 ISA reference

**@⁠Luizbc2** on GitHub · 2026-11-24 18:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1469) `Luizbc2:fix/rdna2-binary64-class` → `main` · +119 −10 · 2 files · 2 commits · open ## What changed Translate `v_cmp_class_f64` and `v_cmpx_class_f64` using the existing classification and lane-mask path. The two source words stay as `i32`, so the low payload participates in distinguishing infinities from NaNs and zero from subnormals, without requiring host driver FP64 support. Source abs/neg only update the sign bit. The FP64 arithmetic and ordered compares are covered separately by #1262. ## Reproduction and tests - On `ffe310e`, the synthetic `v_cmp_class_f64_preserves_all_binary64_classes` test fails at shader lowering with `Unsupported { offset: 44, what: "v_cmp_class_f64" }`. - `cargo test -p victory-shader --lib --locked --offline v_cmp_class -- --nocapture` passed on Windows with the patch. The new test exercises all ten class bits, negative masks, low-word-only payloads, SGPR input, and abs/neg. The existing binary16 test also passed. The compute cases ran on hardware and WARP. - `git diff --check` passed. [AMD RDNA 2 ISA reference](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf)
Classify binary64 directly from the two 32-bit words.
Exercise all ten class bits, including low-word payloads and source modifiers.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:32:56 +00:00
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 18:21 UTC · original

Verified commit \ed9f8c6\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, SM 6.6) + WARP:

  • \cargo test -p victory-shader --lib: 121/121 passed (1 ignored), including \emit::valu_tests::v_cmp_class_f64_preserves_all_binary64_classes.
  • Checked \class_src64\ handling of 64-bit inline float constants, 32-bit literal placement in the high dword (\hi = bits, lo = 0), and \bs/
    eg\ sign-bit masking on the high dword; all look consistent with RDNA2 / GFX10.3 ISA.

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 18:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1469#issuecomment-7140525097) Verified commit \ed9f8c6\ on **Windows 11 / AMD Radeon RX 9060 XT (RDNA4, SM 6.6)** + **WARP**: - \cargo test -p victory-shader --lib\: **121/121 passed** (1 ignored), including \emit::valu_tests::v_cmp_class_f64_preserves_all_binary64_classes\. - Checked \class_src64\ handling of 64-bit inline float constants, 32-bit literal placement in the high dword (\hi = bits, lo = 0\), and \bs\/\ eg\ sign-bit masking on the high dword; all look consistent with RDNA2 / GFX10.3 ISA. *AI-assisted; synthetic tests only, no game files.*
Author
Owner

@⁠AnoHunted on GitHub · 2026-11-24 18:38 UTC · original

Independent NVIDIA hardware run. No game files were used.

Machine: Windows 11, NVIDIA GeForce RTX 5080, Rust 1.98.1, DXC dxil.dll 1.9.2609 (SDK 10.0.26100) validating.

cargo test -p victory-shader --features host -- --test-threads=1 with this PR:

  • 121 passed, 0 failed, 1 ignored (main: 120 / 0 / 1).
  • v_cmp_class_f64_preserves_all_binary64_classes executes via run_cases on the RTX 5080 (and WARP) and passes; every binary64 class (inf / NaN / zero / subnormal) checks out, so this adapter's FP64 path is exercised (not skipped).

Not tested: the in-game effect; AMD.

**@⁠AnoHunted** on GitHub · 2026-11-24 18:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1469#issuecomment-7140921543) Independent NVIDIA hardware run. No game files were used. Machine: Windows 11, NVIDIA GeForce RTX 5080, Rust 1.98.1, DXC `dxil.dll` 1.9.2609 (SDK 10.0.26100) validating. `cargo test -p victory-shader --features host -- --test-threads=1` with this PR: - **121 passed, 0 failed, 1 ignored** (main: 120 / 0 / 1). - `v_cmp_class_f64_preserves_all_binary64_classes` executes via `run_cases` on the RTX 5080 (and WARP) and passes; every binary64 class (inf / NaN / zero / subnormal) checks out, so this adapter's FP64 path is exercised (not skipped). Not tested: the in-game effect; AMD.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-24 20:43 UTC · original

Offline measurement on a retail dump, and the shader tests on Ada

Result: no count change against main.

Offline. I merged head ed9f8c6 onto main ffe310e (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 21,724 on main, 21,724 with this PR.

No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on main. The count shows that the change rejects nothing. It does not show whether the output is right.

Tests: with the same merge, cargo test --locked -p victory-shader --lib passed 121, failed 0. The bitcode benchmark is ignored, as on main, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with VICTORY_WARP unset.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-24 20:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/1469#issuecomment-7143979283) ### Offline measurement on a retail dump, and the shader tests on Ada **Result: no count change against `main`.** **Offline.** I merged head ed9f8c6 onto `main` ffe310e (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 21,724 on `main`, 21,724 with this PR. No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on `main`. The count shows that the change rejects nothing. It does not show whether the output is right. **Tests:** with the same merge, `cargo test --locked -p victory-shader --lib` passed 121, failed 0. The bitcode benchmark is ignored, as on `main`, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with `VICTORY_WARP` unset. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:29 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1469#issuecomment-7149602756) <!-- victory-triage v1 head=ed9f8c6bdf6b1a8d896619864c8f404eb9fc5e02 verdict=needs-rebase at=2026-11-25T01:29:17Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-shader/src/emit/valu_tests.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 11:00 UTC · original

The conflict with 940d32f is between adjacent tests in valu_tests.rs. I rebased the existing lowering b277c15 and the existing test 412c14d with your Git authorship intact. The test is inserted alongside the tests that main added.

I added a separate c07eb2b to exercise the v_cmpx_class_f64 EXEC update. Its WARP readback sees a write for the matching class and the untouched output for a non-matching class. All 30 VALU tests pass with DXIL validation and app-local WARP. Strict shader Clippy and the staged asset policy pass. If you fold the EXEC test into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 11:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1469#issuecomment-7160461128) The conflict with `940d32f` is between adjacent tests in `valu_tests.rs`. I rebased [the existing lowering `b277c15`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/b277c15b5943c31e56f1bbca9007ee15710bd68d) and [the existing test `412c14d`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/412c14d77cc9c8c8500e32bad1aadca5e13b1b3b) with your Git authorship intact. The test is inserted alongside the tests that `main` added. I added a separate [`c07eb2b`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/c07eb2bc92b997ab48e57726cdc76e1d4d8254f1) to exercise the `v_cmpx_class_f64` EXEC update. Its WARP readback sees a write for the matching class and the untouched output for a non-matching class. All 30 VALU tests pass with DXIL validation and app-local WARP. Strict shader Clippy and the staged asset policy pass. If you fold the EXEC test into another commit, please retain `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/valu_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1469/head:github-bot/gh-1469'
git switch 'github-bot/gh-1469'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1469'
git switch 'github-bot/gh-1469'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1469'
git switch 'github-bot/gh-1469'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1469'
git switch 'main'
git merge --squash 'github-bot/gh-1469'
git switch 'main'
git merge --ff-only 'github-bot/gh-1469'
git switch 'main'
git merge 'github-bot/gh-1469'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1469
No description provided.