Shaders: hardware test for s_lshl1..4_add_u32 #1362

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

@⁠LouisRiverstone on GitHub · 2026-11-24 17:36 UTC · original
LouisRiverstone:shaders/s-lshl-add-test → main · +31 −0 · 1 files · 2 commits · open

s_lshl1_add_u32 .. s_lshl4_add_u32 (SOP2 0x2e..0x31) share one arm in lower.rs that reads the shift amount out of the instruction name, but no hardware test ran them.

New test s_lshl_add_shifts_the_first_operand_then_adds runs all 49 ordered pairs of seven values (including bits shifted out of the top and sums that wrap) through each of the four opcodes. Expected value: (a << n).wrapping_add(b).

Test only, no production change.

Verify: cargo test -p victory-shader s_lshl_add (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 17:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/1362) `LouisRiverstone:shaders/s-lshl-add-test` → `main` · +31 −0 · 1 files · 2 commits · open `s_lshl1_add_u32` .. `s_lshl4_add_u32` (SOP2 0x2e..0x31) share one arm in `lower.rs` that reads the shift amount out of the instruction name, but no hardware test ran them. New test `s_lshl_add_shifts_the_first_operand_then_adds` runs all 49 ordered pairs of seven values (including bits shifted out of the top and sums that wrap) through each of the four opcodes. Expected value: `(a << n).wrapping_add(b)`. Test only, no production change. **Verify:** `cargo test -p victory-shader s_lshl_add` (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:28:48 +00:00
Author
Owner

@⁠matheusfermiano-source on GitHub · 2026-11-24 18:08 UTC · original

First GPU run of this PR's test that I could find, on an AMD GPU under Proton on Linux: s_lshl_add_shifts_the_first_operand_then_adds: pass on a Radeon 660M (RDNA2).

  • Head c98c50f. Built on Linux with llvm-mingw for x86_64-pc-windows-gnullvm (Rust 1.98.1) and run under Proton Experimental (11.0-20261027b) with its vkd3d-proton 3.1.0, one GPU at a time; dxil.dll from DXC 1.9.2609 was loaded, so the test modules were validated.
  • Radeon 660M (RDNA2, RADV Mesa 26.3.1, waves 32..64): whole victory-shader suite 120 passed, 1 failed, 1 ignored. Nothing fails that passes on main (ffe310e). The one failure, emit::tests::stub_pipeline_is_created, fails on main here too: vkd3d-proton accepts the zeroed DXIL hash that the Windows runtime refuses (one of the Wine failures listed in #1218).

This is RADV, not AMD's Windows driver, so it adds to a Windows run rather than replacing it. Synthetic tests only, no game files. AI-assisted (Claude Code, Opus 5.5); every run was on this machine.

**@⁠matheusfermiano-source** on GitHub · 2026-11-24 18:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/1362#issuecomment-7140214980) First GPU run of this PR's test that I could find, on an AMD GPU under Proton on Linux: **`s_lshl_add_shifts_the_first_operand_then_adds`: pass** on a Radeon 660M (RDNA2). - Head `c98c50f`. Built on Linux with llvm-mingw for `x86_64-pc-windows-gnullvm` (Rust 1.98.1) and run under Proton Experimental (11.0-20261027b) with its vkd3d-proton 3.1.0, one GPU at a time; `dxil.dll` from DXC 1.9.2609 was loaded, so the test modules were validated. - **Radeon 660M** (RDNA2, RADV Mesa 26.3.1, waves 32..64): whole `victory-shader` suite 120 passed, 1 failed, 1 ignored. Nothing fails that passes on `main` (`ffe310e`). The one failure, `emit::tests::stub_pipeline_is_created`, fails on `main` here too: vkd3d-proton accepts the zeroed DXIL hash that the Windows runtime refuses (one of the Wine failures listed in #1218). This is RADV, not AMD's Windows driver, so it adds to a Windows run rather than replacing it. Synthetic tests only, no game files. AI-assisted (Claude Code, Opus 5.5); every run was on this machine.
Author
Owner

@⁠wwwwwwww3333333 on GitHub · 2026-11-24 19:12 UTC · original

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 c98c50f on main ffe310e (clean merge).

cargo test -p victory-shader --lib -- --test-threads=1: 121 passed, 0 failed, 1 ignored (main alone: 120 passed). s_lshl_add_shifts_the_first_operand_then_adds 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).

**@⁠wwwwwwww3333333** on GitHub · 2026-11-24 19:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/1362#issuecomment-7141753125) 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 c98c50f on main ffe310e (clean merge). `cargo test -p victory-shader --lib -- --test-threads=1`: **121 passed, 0 failed**, 1 ignored (main alone: 120 passed). `s_lshl_add_shifts_the_first_operand_then_adds` 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).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 02:36 UTC · original · edited 2026-11-26 02:17 UTC

Automated triage for the maintainers.

Merge candidate (recommending a look, not an approval). Reviewed at ebf7ebe, which merges cleanly into main. Test only: s_lshl_add_shifts_the_first_operand_then_adds in crates/victory-shader/src/emit/valu_tests.rs.

It runs s_lshl1..4_add_u32 (SOP2 0x2d + n = 0x2e..0x31, which matches gfx10/opcodes.rs) over 49 operand pairs and expects (a << n).wrapping_add(b), the RDNA2 definition. main lowers all four in one arm of emit/lower.rs that reads the shift from the opcode name, and no test ran them before.

CI: check failing on this head, but the failure is victory-gpu's frame::tests::waits_end_on_ticks_and_count_frames (crates/victory-gpu/src/frame.rs:231), a timing test in another crate that this PR does not touch. A re-run should clear it.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 02:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/1362#issuecomment-7150946872) · edited 2026-11-26 02:17 UTC <!-- victory-triage v1 head=ebf7ebebc007c756d2221fc6ceff3ebd36109a91 verdict=merge-candidate at=2026-11-26T02:17:45Z --> Automated triage for the maintainers. **Merge candidate** (recommending a look, not an approval). Reviewed at `ebf7ebe`, which merges cleanly into `main`. Test only: `s_lshl_add_shifts_the_first_operand_then_adds` in `crates/victory-shader/src/emit/valu_tests.rs`. It runs `s_lshl1..4_add_u32` (SOP2 `0x2d + n` = 0x2e..0x31, which matches `gfx10/opcodes.rs`) over 49 operand pairs and expects `(a << n).wrapping_add(b)`, the RDNA2 definition. `main` lowers all four in one arm of `emit/lower.rs` that reads the shift from the opcode name, and no test ran them before. CI: `check` **failing** on this head, but the failure is `victory-gpu`'s `frame::tests::waits_end_on_ticks_and_count_frames` (`crates/victory-gpu/src/frame.rs:231`), a timing test in another crate that this PR does not touch. A re-run should clear it. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠StExpeditus on GitHub · 2026-11-25 09:29 UTC · original

Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at 33d51a3. cargo test --workspace --locked --no-fail-fast -> 694 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.

**@⁠StExpeditus** on GitHub · 2026-11-25 09:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1362#issuecomment-7158396261) **Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24.** Branch at `33d51a3`. `cargo test --workspace --locked --no-fail-fast` -> 694 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 17:42 UTC · original · approved these changes

Hardware test only: s_lshl{1..4}_add_u32 (SOP2 0x2e-0x31) shift-then-add with wrapping arithmetic, edge values incl. sign bit. Encoding and formula match the ISA. Windows-only execution. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p <crate> --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.

**@⁠catminou4** on GitHub · 2026-11-24 17:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1362#pullrequestreview-6044387714) · **approved these changes** Hardware test only: s_lshl{1..4}_add_u32 (SOP2 0x2e-0x31) shift-then-add with wrapping arithmetic, edge values incl. sign bit. Encoding and formula match the ISA. Windows-only execution. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, `cargo test -p <crate> --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.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 20:50 UTC · original · approved these changes

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers structure/lowering unit tests.

Hardware test for s_lshl1..4_add_u32: s_lshl_add_shifts_the_first_operand_then_adds pins the shift-then-add semantics.

**@⁠catminou4** on GitHub · 2026-11-24 20:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/1362#pullrequestreview-6047176404) · **approved these changes** Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers structure/lowering unit tests. Hardware test for s_lshl1..4_add_u32: s_lshl_add_shifts_the_first_operand_then_adds pins the shift-then-add semantics.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 19:35 UTC · original · approved these changes

Looks good to me — clean hardware test pinning all four s_lshl{1..4}_add_u32 instructions across wrapping and high-bit shift edge cases.

Verified locally on Windows 11 with head ebf7ebeb cleanly merged onto main (63bcca43):

  • Audited s_lshl_add_shifts_the_first_operand_then_adds (crates/victory-shader/src/emit/valu_tests.rs:1313-1341): SOP2 0x2e..=0x31 match gfx10/opcodes.rs:71-74 and RDNA2 (src0 << n) + src1 across all 49 ordered edge pairs, consistent with lower.rs:3970-3975.
  • Formatting check (rustfmt --edition 2024 --config skip_children=true) shows no diffs on the added lines.
  • cargo run -p xtask -- policy (191 files ok) and cargo clippy --locked -p victory-shader --all-targets -- -D warnings (both default and --all-features) pass.
  • cargo test --locked -p victory-shader --lib s_lshl_add_shifts_the_first_operand_then_adds passes on both VICTORY_WARP=0 (RTX 5090, 9.66s) and VICTORY_WARP=1 (WARP, 0.18s): 1 passed; 0 failed (305 filtered out).

Minor non-blocking scope note: this checks the 32-bit wrapped sum in s6 without asserting SCC unsigned overflow (which lower.rs:3974 currently leaves as None).

**@⁠fuzeofficlal** on GitHub · 2026-11-26 19:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1362#pullrequestreview-6079607286) · **approved these changes** Looks good to me — clean hardware test pinning all four `s_lshl{1..4}_add_u32` instructions across wrapping and high-bit shift edge cases. Verified locally on Windows 11 with head `ebf7ebeb` cleanly merged onto `main` (`63bcca43`): - Audited `s_lshl_add_shifts_the_first_operand_then_adds` (`crates/victory-shader/src/emit/valu_tests.rs:1313-1341`): SOP2 `0x2e..=0x31` match `gfx10/opcodes.rs:71-74` and RDNA2 `(src0 << n) + src1` across all 49 ordered edge pairs, consistent with `lower.rs:3970-3975`. - Formatting check (`rustfmt --edition 2024 --config skip_children=true`) shows no diffs on the added lines. - `cargo run -p xtask -- policy` (`191 files ok`) and `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (both default and `--all-features`) pass. - `cargo test --locked -p victory-shader --lib s_lshl_add_shifts_the_first_operand_then_adds` passes on both `VICTORY_WARP=0` (RTX 5090, `9.66s`) and `VICTORY_WARP=1` (WARP, `0.18s`): `1 passed; 0 failed` (`305 filtered out`). Minor non-blocking scope note: this checks the 32-bit wrapped sum in `s6` without asserting `SCC` unsigned overflow (which `lower.rs:3974` currently leaves as `None`).
This pull request can be merged automatically.
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/1362/head:github-bot/gh-1362'
git switch 'github-bot/gh-1362'

Merge

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