Shaders: hardware test for the three-operand integer ops #1384

Closed
LouisRiverstone wants to merge 1 commit from upstream-pr/1384 into main
LouisRiverstone commented 2026-11-24 17:40:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LouisRiverstone on 2026-11-24T17:40:14Z.


v_xor3_b32, v_xad_u32, v_lshl_add_u32, v_add_lshl_u32, v_add3_u32, v_lshl_or_b32, v_and_or_b32 and v_or3_b32 share one arm in lower.rs, with the shift amount masked to five bits in the lshl forms, but no hardware test ran them.

New test v_three_operand_integer_ops_match_rdna2 runs all 216 ordered triples of {0, 1, 5, 31, 32, 0x80000001} through each opcode. The values include shift amounts that wrap (32 and 0x80000001 act as 0 and 1). Expected values come from plain Rust arithmetic.

Test only, no production change.

Verify: cargo test -p victory-shader v_three_operand_integer (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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6587820230 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1384). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-11-24T17:40:14Z. --- `v_xor3_b32`, `v_xad_u32`, `v_lshl_add_u32`, `v_add_lshl_u32`, `v_add3_u32`, `v_lshl_or_b32`, `v_and_or_b32` and `v_or3_b32` share one arm in `lower.rs`, with the shift amount masked to five bits in the `lshl` forms, but no hardware test ran them. New test `v_three_operand_integer_ops_match_rdna2` runs all 216 ordered triples of `{0, 1, 5, 31, 32, 0x80000001}` through each opcode. The values include shift amounts that wrap (32 and `0x80000001` act as 0 and 1). Expected values come from plain Rust arithmetic. Test only, no production change. **Verify:** `cargo test -p victory-shader v_three_operand_integer` (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)
catminou4 commented 2026-11-24 18:05:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T17:52:29Z.

Review: APPROVED


Hardware test only: eight three-operand VOP3 integer ops (xor3/xad/lshl_add/add_lshl/add3/lshl_or/and_or/or3, opcodes 0x178/0x345-0x347/0x36d/0x36f/0x371/0x372 in the VOP3-only range). Shift amounts use the low 5 bits as the ISA specifies; wrap-around cases (32, 0x8000_0001) included. Windows-only execution — xad's operand order is the one worth an eyeball on the hardware run. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p victory-shader --locked. Shader execution tests (valu_tests/host/diff_tests) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. 96 passed, 0 failed.

<!-- greyfinch-sync:Marvisak/VIctory:review:6044526950 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1384#pullrequestreview-6044526950). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T17:52:29Z. **Review:** APPROVED --- Hardware test only: eight three-operand VOP3 integer ops (xor3/xad/lshl_add/add_lshl/add3/lshl_or/and_or/or3, opcodes 0x178/0x345-0x347/0x36d/0x36f/0x371/0x372 in the VOP3-only range). Shift amounts use the low 5 bits as the ISA specifies; wrap-around cases (32, 0x8000_0001) included. Windows-only execution — xad's operand order is the one worth an eyeball on the hardware run. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, `cargo test -p victory-shader --locked`. Shader execution tests (valu_tests/host/diff_tests) are `#[cfg(all(test, windows))]`, so macOS covers lowering/decode/unit tests only. 96 passed, 0 failed.
nullmarsh commented 2026-11-24 18:06:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by nullmarsh on 2026-11-24T18:00:42Z.


Ran on RDNA2 hardware through vkd3d-proton on a Steam Deck (not native Windows): AMD Van Gogh, RADV 26.1.99, SteamOS 3.8.28, Proton 11.0-3 (wine-11.0) with its vkd3d-proton 212991fc. Windows MSVC test binary (rustc 1.100.0) built from head 3215e71 on main ffe310e.

  • v_three_operand_integer_ops_match_rdna2 passes: v_xor3, v_xad, v_lshl_add, v_add_lshl, v_add3, v_lshl_or, v_and_or and v_or3 over all 216 triples, including shift amounts 32 and 0x80000001.
  • victory-shader lib tests: 120 passed, 1 failed, 1 ignored (main on the same host: 119/1/1). The one failure, stub_pipeline_is_created, fails on main too (likely vkd3d-proton accepting the zero DXIL digest the test expects refused; environment, not this PR).
  • No hangs. A pass means the translated DXIL gives these values on RDNA2 through vkd3d-proton/RADV; it isn't a console measurement.

Not tested: native Windows AMD drivers; WARP (this setup has none, so the WARP leg ran on RADV too).

AI-assisted (Claude Code, Claude Opus 5.5); no game data.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140027198 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1384#issuecomment-7140027198). Originally posted by [nullmarsh](https://github.com/nullmarsh) on 2026-11-24T18:00:42Z. --- Ran on RDNA2 hardware through vkd3d-proton on a Steam Deck (not native Windows): AMD Van Gogh, RADV 26.1.99, SteamOS 3.8.28, Proton 11.0-3 (wine-11.0) with its vkd3d-proton 212991fc. Windows MSVC test binary (rustc 1.100.0) built from head `3215e71` on main `ffe310e`. - `v_three_operand_integer_ops_match_rdna2` passes: v_xor3, v_xad, v_lshl_add, v_add_lshl, v_add3, v_lshl_or, v_and_or and v_or3 over all 216 triples, including shift amounts 32 and 0x80000001. - victory-shader lib tests: 120 passed, 1 failed, 1 ignored (main on the same host: 119/1/1). The one failure, `stub_pipeline_is_created`, fails on main too (likely vkd3d-proton accepting the zero DXIL digest the test expects refused; environment, not this PR). - No hangs. A pass means the translated DXIL gives these values on RDNA2 through vkd3d-proton/RADV; it isn't a console measurement. Not tested: native Windows AMD drivers; WARP (this setup has none, so the WARP leg ran on RADV too). AI-assisted (Claude Code, Claude Opus 5.5); no game data.
marquezinii commented 2026-11-24 20:03:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by marquezinii on 2026-11-24T19:13:00Z.


Native Windows NVIDIA data point: RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1, head 3215e71. cargo test -p victory-shader --lib -- --test-threads=1 --nocapture gives 121 passed, 0 failed, 1 ignored. v_three_operand_integer_ops_match_rdna2 passes on the hardware adapter and WARP, with nothing skipped on the hardware adapter.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7141769705 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1384#issuecomment-7141769705). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T19:13:00Z. --- Native Windows NVIDIA data point: RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1, head `3215e71`. `cargo test -p victory-shader --lib -- --test-threads=1 --nocapture` gives 121 passed, 0 failed, 1 ignored. `v_three_operand_integer_ops_match_rdna2` passes on the hardware adapter and WARP, with nothing skipped on the hardware adapter.
wwwwwwww3333333 commented 2026-11-24 20:03:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by wwwwwwww3333333 on 2026-11-24T19:14:11Z.


Native Windows run on AMD RDNA2: RX 6750 XT (RDNA2, gfx1031), AMD driver 32.0.21045.29003, i5-13400F, Windows 11, Rust 1.98.1 MSVC. Head 3215e71 on main ffe310e (clean merge).

cargo test -p victory-shader --lib -- --test-threads=1: 121 passed, 0 failed, 1 ignored (main alone: 120 passed). v_three_operand_integer_ops_match_rdna2 ran on the hardware adapter and then on WARP, and passed on both. The earlier RDNA2 runs on this PR went through vkd3d-proton on Linux; this one is AMD's own D3D12 driver.

Synthetic tests only, no game files. AI-assisted (Claude picked the PRs and wrote the batch script; I ran it on my machine).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7141800346 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1384#issuecomment-7141800346). Originally posted by [wwwwwwww3333333](https://github.com/wwwwwwww3333333) on 2026-11-24T19:14:11Z. --- Native Windows run on AMD RDNA2: RX 6750 XT (RDNA2, gfx1031), AMD driver 32.0.21045.29003, i5-13400F, Windows 11, Rust 1.98.1 MSVC. Head 3215e71 on main ffe310e (clean merge). `cargo test -p victory-shader --lib -- --test-threads=1`: **121 passed, 0 failed**, 1 ignored (main alone: 120 passed). `v_three_operand_integer_ops_match_rdna2` ran on the hardware adapter and then on WARP, and passed on both. The earlier RDNA2 runs on this PR went through vkd3d-proton on Linux; this one is AMD's own D3D12 driver. Synthetic tests only, no game files. AI-assisted (Claude picked the PRs and wrote the batch script; I ran it on my machine).
upstream-sync closed this pull request 2026-11-25 01:06:26 +00:00
Marvisak commented 2026-11-25 01:08:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:39:31Z.


Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

All eight ops (v_xor3, v_xad, v_lshl_add, v_add_lshl, v_add3, v_lshl_or, v_and_or, v_or3) are already probed in main's semantics_tests.rs integer_probes, shift counts past 31 included.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148741385 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1384#issuecomment-7148741385). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:39:31Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. All eight ops (v_xor3, v_xad, v_lshl_add, v_add_lshl, v_add3, v_lshl_or, v_and_or, v_or3) are already probed in main's semantics_tests.rs `integer_probes`, shift counts past 31 included. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1384
No description provided.