Shaders: cover v_cmp_class_f32 VOPC SGPR/literal, mask bits, and v_cmpx_class_* EXEC narrowing #2081

Open
github-bot wants to merge 1 commit from github-bot/gh-2081 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 04:27 UTC · original
fuzeofficlal:test/shader-vcmp-class-799 → main · +130 −0 · 1 files · 1 commits · open

Addresses #799.

Summary

Audited Lower::compare ("class") and lane_bits_for (v_cmpx_*) against RDNA2 V_CMP_CLASS_F32 / V_CMPX_CLASS_* semantics and added hardware + WARP tests in valu_tests::v_cmp_and_cmpx_class_f32_match_rdna2 covering the paths not exercised by 328eec1:

  • v_cmpx_class_f32 (0x098) & v_cmpx_class_f16 (0x09f) EXEC narrowing: verifies direct EXEC masking across matching and non-matching lanes without flushing denormals or quieting sNaN.
  • 32-bit VOPC encoding (v_cmp_class_f32_e32): covers SGPR src0 (s0) and 32-bit literal src0 (0xFF followed by raw +sNaN and -denormal bit patterns).
  • Ignored upper mask bits (src1[31:10]) & combined masks: verifies 0xFFFF_FC00 is ignored by hardware and exercises combined class masks across all 10 IEEE-754 binary32 class min/max boundaries.

Testing

  • cargo test -p victory-shader --locked v_cmp_and_cmpx_class_f32_match_rdna2 -- --test-threads=1 on hardware GPU (RTX 5090), WARP, and dxil.dll validation.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings and cargo xtask policy.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 04:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2081) `fuzeofficlal:test/shader-vcmp-class-799` → `main` · +130 −0 · 1 files · 1 commits · open Addresses #799. ### Summary Audited `Lower::compare` (`"class"`) and `lane_bits_for` (`v_cmpx_*`) against RDNA2 `V_CMP_CLASS_F32` / `V_CMPX_CLASS_*` semantics and added hardware + WARP tests in `valu_tests::v_cmp_and_cmpx_class_f32_match_rdna2` covering the paths not exercised by `328eec1`: - **`v_cmpx_class_f32` (`0x098`) & `v_cmpx_class_f16` (`0x09f`) `EXEC` narrowing**: verifies direct `EXEC` masking across matching and non-matching lanes without flushing denormals or quieting `sNaN`. - **32-bit VOPC encoding (`v_cmp_class_f32_e32`)**: covers SGPR `src0` (`s0`) and 32-bit literal `src0` (`0xFF` followed by raw `+sNaN` and `-denormal` bit patterns). - **Ignored upper mask bits (`src1[31:10]`) & combined masks**: verifies `0xFFFF_FC00` is ignored by hardware and exercises combined class masks across all 10 IEEE-754 binary32 class min/max boundaries. ### Testing - `cargo test -p victory-shader --locked v_cmp_and_cmpx_class_f32_match_rdna2 -- --test-threads=1` on hardware GPU (RTX 5090), WARP, and `dxil.dll` validation. - `cargo clippy --workspace --all-targets --all-features -- -D warnings` and `cargo xtask policy`.
Add hardware and WARP tests in valu_tests covering all 10 IEEE-754 binary32 classes at subnormal, normal, and NaN boundaries across VOP3 and 32-bit VOPC (SGPR and literal src0), ignored src1[31:10] mask bits, combined class masks, and EXEC-narrowing v_cmpx_class_f32 / v_cmpx_class_f16 (#799).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:18 +00:00
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 09:08 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 616de417 onto main 940d32f (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: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

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

**@⁠sinan-cmyk** on GitHub · 2026-11-25 09:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2081#issuecomment-7157935750) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 616de417 onto `main` 940d32f (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: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 10:30 UTC · original

Automated triage for the maintainers.

This adds valu_tests::v_cmp_and_cmpx_class_f32_match_rdna2. It is test-only and covers the "class" arm of Lower::compare in emit/lower.rs through the VOPC e32 form with an SGPR and a literal src0, mask bits above bit 9, and v_cmpx_class_f32/v_cmpx_class_f16 narrowing EXEC. I decoded the hand-assembled VOPC words (0x088, 0x098, 0x09f; s0, v1, v2, literal 0xFF), and they match the comments. The expected values follow the class table that semantics_tests::class already uses. The per-bit e64 cases mostly repeat semantics_tests::class_compares_match_the_hardware. The new parts are the cmpx, SGPR and literal cases. CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 10:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2081#issuecomment-7159800817) <!-- victory-triage v1 head=616de4179144003973b1bb052bf28518121540bd verdict=merge-candidate at=2026-11-25T10:30:52Z --> Automated triage for the maintainers. This adds `valu_tests::v_cmp_and_cmpx_class_f32_match_rdna2`. It is test-only and covers the `"class"` arm of `Lower::compare` in `emit/lower.rs` through the VOPC e32 form with an SGPR and a literal `src0`, mask bits above bit 9, and `v_cmpx_class_f32`/`v_cmpx_class_f16` narrowing EXEC. I decoded the hand-assembled VOPC words (0x088, 0x098, 0x09f; s0, v1, v2, literal 0xFF), and they match the comments. The expected values follow the class table that `semantics_tests::class` already uses. The per-bit e64 cases mostly repeat `semantics_tests::class_compares_match_the_hardware`. The new parts are the cmpx, SGPR and literal cases. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2081'
git switch 'github-bot/gh-2081'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2081'
git switch 'github-bot/gh-2081'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2081'
git switch 'main'
git merge --squash 'github-bot/gh-2081'
git switch 'main'
git merge --ff-only 'github-bot/gh-2081'
git switch 'main'
git merge 'github-bot/gh-2081'
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!2081
No description provided.