Shaders: hardware test for the 32-bit scalar logic ops and s_ashr_i32 #1874

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

@⁠LouisRiverstone on GitHub · 2026-11-24 23:58 UTC · original
LouisRiverstone:shaders/s-logic-b32-test → main · +47 −0 · 1 files · 1 commits · closed without merging

s_and_b32, s_xor_b32, s_andn2_b32, s_orn2_b32, s_nand_b32, s_nor_b32, s_xnor_b32 (SOP2), s_not_b32 (SOP1 0x07) and s_ashr_i32 (SOP2 0x22) share two arms in lower.rs: the n2/nand/nor/xnor forms are built from an inversion and a base op, and the shift masks its amount to five bits. No hardware test ran them.

New test s_logic_not_and_ashr_b32_match_rdna2 runs all 49 ordered pairs of seven values (including shift amounts 31, 32 and a value with the sign bit set) through each SOP2 op, and the same values through s_not_b32. Expected values come from plain Rust operators. Adds a small sop1 encoder next to sop2.

Test only, no production change.

Verify: cargo test -p victory-shader s_logic_not_and_ashr (Windows, hardware GPU or WARP). I type-checked it with clippy for x86_64-pc-windows-msvc, but could not run it locally: the shader test module is Windows-only.

🤖 Generated with Claude Code

**@⁠LouisRiverstone** on GitHub · 2026-11-24 23:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/1874) `LouisRiverstone:shaders/s-logic-b32-test` → `main` · +47 −0 · 1 files · 1 commits · closed without merging `s_and_b32`, `s_xor_b32`, `s_andn2_b32`, `s_orn2_b32`, `s_nand_b32`, `s_nor_b32`, `s_xnor_b32` (SOP2), `s_not_b32` (SOP1 0x07) and `s_ashr_i32` (SOP2 0x22) share two arms in `lower.rs`: the `n2`/`nand`/`nor`/`xnor` forms are built from an inversion and a base op, and the shift masks its amount to five bits. No hardware test ran them. New test `s_logic_not_and_ashr_b32_match_rdna2` runs all 49 ordered pairs of seven values (including shift amounts 31, 32 and a value with the sign bit set) through each SOP2 op, and the same values through `s_not_b32`. Expected values come from plain Rust operators. Adds a small `sop1` encoder next to `sop2`. Test only, no production change. **Verify:** `cargo test -p victory-shader s_logic_not_and_ashr` (Windows, hardware GPU or WARP). I type-checked it with clippy for `x86_64-pc-windows-msvc`, but could not run it locally: the shader test module is Windows-only. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:20 +00:00
github-bot closed this pull request 2026-11-26 04:47:20 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 07:26 UTC · original

Automated triage for the maintainers.

This is a test-only change: s_logic_not_and_ashr_b32_match_rdna2 in crates/victory-shader/src/emit/valu_tests.rs runs s_and/xor/andn2/orn2/nand/nor/xnor_b32 and s_ashr_i32 (SOP2) and s_not_b32 (SOP1) through the lowering on hardware and WARP. I checked the GFX10 opcodes (SOP2 0x0e, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x22; SOP1 0x07) and the new sop1 encoding (0xBE80_0000 | sdst<<16 | op<<8 | src0). The expected values (!-based forms, 5-bit shift amount, sign bit set) are what the ISA defines, and build_valu_cs puts the inputs in s0/s1 as the test assumes.

This inserts at the same place in the file as #1875 and #1876, so whichever merges later needs a trivial rebase.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 07:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1874#issuecomment-7155859687) <!-- victory-triage v1 head=adc971bbb248712e8152895168f9a0dd5b3e4746 verdict=merge-candidate at=2026-11-25T07:26:18Z --> Automated triage for the maintainers. This is a test-only change: `s_logic_not_and_ashr_b32_match_rdna2` in `crates/victory-shader/src/emit/valu_tests.rs` runs `s_and/xor/andn2/orn2/nand/nor/xnor_b32` and `s_ashr_i32` (SOP2) and `s_not_b32` (SOP1) through the lowering on hardware and WARP. I checked the GFX10 opcodes (SOP2 0x0e, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x22; SOP1 0x07) and the new `sop1` encoding (`0xBE80_0000 | sdst<<16 | op<<8 | src0`). The expected values (`!`-based forms, 5-bit shift amount, sign bit set) are what the ISA defines, and `build_valu_cs` puts the inputs in `s0`/`s1` as the test assumes. This inserts at the same place in the file as #1875 and #1876, so whichever merges later needs a trivial rebase. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 12:02 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head adc971bb 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 12:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/1874#issuecomment-7161839586) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head adc971bb 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 22:03 UTC · original

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing as covered by #2015, whose more_scalar_alu_matches_the_hardware runs the same eight logic opcodes over 24x24 edge pairs and s_not_b32 over all edges, checks SCC for each and adds the 64-bit forms. s_and_b32 and s_ashr_i32 are already on main. The opcodes and expected values here are right.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 22:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/1874#issuecomment-7175874222) Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing as covered by #2015, whose `more_scalar_alu_matches_the_hardware` runs the same eight logic opcodes over 24x24 edge pairs and `s_not_b32` over all edges, checks SCC for each and adds the 64-bit forms. `s_and_b32` and `s_ashr_i32` are already on `main`. The opcodes and expected values here are right. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

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!1874
No description provided.