Shaders: hardware test for s_min_i32/u32 and s_max_i32/u32 #1360

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

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


s_min_i32, s_min_u32, s_max_i32 and s_max_u32 (SOP2 0x06..0x09) are lowered in lower.rs but no hardware test ran them. Only the predicate (SLT/SGT against IULT/IUGT) separates the signed forms from the unsigned ones.

New test s_min_and_s_max_compare_signed_and_unsigned runs all 36 ordered pairs of {0, 1, 5, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF} through each opcode. The sign bit is set on some values so the signed and unsigned answers differ. Expected values come from min/max in Rust.

Test only, no production change.

Verify: cargo test -p victory-shader s_min_and_s_max (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:6587747410 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1360). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-11-24T17:36:00Z. --- `s_min_i32`, `s_min_u32`, `s_max_i32` and `s_max_u32` (SOP2 0x06..0x09) are lowered in `lower.rs` but no hardware test ran them. Only the predicate (`SLT`/`SGT` against `IULT`/`IUGT`) separates the signed forms from the unsigned ones. New test `s_min_and_s_max_compare_signed_and_unsigned` runs all 36 ordered pairs of `{0, 1, 5, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF}` through each opcode. The sign bit is set on some values so the signed and unsigned answers differ. Expected values come from `min`/`max` in Rust. Test only, no production change. **Verify:** `cargo test -p victory-shader s_min_and_s_max` (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:04:57 +00:00 (Migrated from github.com)

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

Review: APPROVED


Hardware test only: s_min/s_max i32/u32 across sign-bit values, SOP2 opcodes 0x06-0x09 match the ISA encoding, reference formulas are the obvious min/max. Runs on Windows hardware/WARP only; macOS just compiles it. 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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6044387506 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1360#pullrequestreview-6044387506). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T17:42:38Z. **Review:** APPROVED --- Hardware test only: s_min/s_max i32/u32 across sign-bit values, SOP2 opcodes 0x06-0x09 match the ISA encoding, reference formulas are the obvious min/max. Runs on Windows hardware/WARP only; macOS just compiles it. 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.
matheusfermiano-source commented 2026-11-24 19:04:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by matheusfermiano-source on 2026-11-24T18:08:35Z.


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

  • Head 0e24b79. 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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140218923 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1360#issuecomment-7140218923). Originally posted by [matheusfermiano-source](https://github.com/matheusfermiano-source) on 2026-11-24T18:08:35Z. --- First GPU run of this PR's test that I could find, on an AMD GPU under Proton on Linux: **`s_min_and_s_max_compare_signed_and_unsigned`: pass** on a Radeon 660M (RDNA2). - Head `0e24b79`. 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.
wwwwwwww3333333 commented 2026-11-24 20:03:03 +00:00 (Migrated from github.com)

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


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 0e24b79 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_min_and_s_max_compare_signed_and_unsigned 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:7141739556 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1360#issuecomment-7141739556). Originally posted by [wwwwwwww3333333](https://github.com/wwwwwwww3333333) on 2026-11-24T19:11:48Z. --- 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 0e24b79 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_min_and_s_max_compare_signed_and_unsigned` 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).
catminou4 commented 2026-11-24 21:02:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:10:04Z.

Review: APPROVED


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. Execution/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers lowering/structure/IR unit tests.

Hardware test for s_min/s_max i32/u32 (SOP2 0x06..0x09) over sign-bit-differing values on every backend including WARP. Runs on Windows only (valu_tests), like the rest of that harness.

<!-- greyfinch-sync:Marvisak/VIctory:review:6046561158 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1360#pullrequestreview-6046561158). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T20:10:04Z. **Review:** APPROVED --- 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. Execution/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers lowering/structure/IR unit tests. Hardware test for s_min/s_max i32/u32 (SOP2 0x06..0x09) over sign-bit-differing values on every backend including WARP. Runs on Windows only (valu_tests), like the rest of that harness.
upstream-sync closed this pull request 2026-11-25 01:06:20 +00:00
Marvisak commented 2026-11-25 01:08:10 +00:00 (Migrated from github.com)

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


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

s_min/s_max_i32/u32 are already probed in main: semantics_tests.rs scalar_probes runs SOP2 0x06-0x09 over 24x24 operand pairs, SCC 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:7148726077 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1360#issuecomment-7148726077). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:38:36Z. --- Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. s_min/s_max_i32/u32 are already probed in main: semantics_tests.rs `scalar_probes` runs SOP2 0x06-0x09 over 24x24 operand pairs, SCC 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!1360
No description provided.