Skip to content

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

Closed
LouisRiverstone wants to merge 1 commit into
Marvisak:mainfrom
LouisRiverstone:shaders/s-logic-b32-test
Closed

LouisRiverstone wants to merge 1 commit into
Marvisak:mainfrom
LouisRiverstone:shaders/s-logic-b32-test

Conversation

@LouisRiverstone

Copy link
Copy Markdown
Contributor

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
LouisRiverstone force-pushed the shaders/s-logic-b32-test branch from 480da97 to adc971b Compare November 25, 2026 01:14

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (940d32f), cargo test → 144 passed, 0 failed. GPU execution tests are #[cfg(all(test, windows))] and run only on Windows.

victory-shader. Hardware test for the 32-bit scalar logic ops and s_…: RDNA2-matched GPU test (Windows-gated).

Copy link
Copy Markdown
Owner

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

@sinan-cmyk

Copy link
Copy Markdown

Offline measurement on a retail dump

Result: no count change against main.

I merged head adc971b 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).

@Marvisak

Copy link
Copy Markdown
Owner

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 Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants