Shaders: hardware test for the s_cmpk_* scalar comparisons #1046

Merged
LouisRiverstone merged 1 commit from upstream-pr/1046 into main 2026-11-25 21:49:52 +00:00
LouisRiverstone commented 2026-11-24 15:16:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LouisRiverstone on 2026-11-24T15:16:07Z.


Fixes #867.

The twelve s_cmpk_* compares (SOPK 0x003..0x00e) share a branch with s_cmp_* in lower.rs, but nothing ran them. The signed forms sign-extend the 16-bit immediate and the unsigned forms zero-extend it, which is the part worth pinning.

New test s_cmpk_compares_against_the_extended_immediate: for each condition (eq, lg, gt, ge, lt, le) in both types, with immediates 0x0005 and 0x8000, it runs nine operands around the sign boundaries (0, 4..6, 0x7FFF, 0x8000, 0xFFFF8000, 0xFFFFFFFF, 0x80000000). SCC is read back with s_cselect_b32, and the expected value comes from comparing i64s in Rust. Adds a small sopk encoder next to sop2.

Test only, no production change.

Verify: cargo test -p victory-shader s_cmpk (Windows, hardware GPU or WARP). I could not run it locally: the shader test module is Windows-only.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6585062755 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1046). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-11-24T15:16:07Z. --- Fixes #867. The twelve `s_cmpk_*` compares (SOPK 0x003..0x00e) share a branch with `s_cmp_*` in `lower.rs`, but nothing ran them. The signed forms sign-extend the 16-bit immediate and the unsigned forms zero-extend it, which is the part worth pinning. New test `s_cmpk_compares_against_the_extended_immediate`: for each condition (eq, lg, gt, ge, lt, le) in both types, with immediates `0x0005` and `0x8000`, it runs nine operands around the sign boundaries (0, 4..6, 0x7FFF, 0x8000, 0xFFFF8000, 0xFFFFFFFF, 0x80000000). SCC is read back with `s_cselect_b32`, and the expected value comes from comparing `i64`s in Rust. Adds a small `sopk` encoder next to `sop2`. Test only, no production change. **Verify:** `cargo test -p victory-shader s_cmpk` (Windows, hardware GPU or WARP). I could not run it locally: the shader test module is Windows-only. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ThomasHFWright commented 2026-11-24 16:05:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ThomasHFWright on 2026-11-24T15:27:15Z.


Independent Linux/Wine hardware run of 5f9a0d247df7644c7779a1a6ef8eea65f7bd7d5a on base ffe310e: the changed regression passes, exercising 216 comparisons across all twelve s_cmpk forms, two immediates and nine operands. Built and run from this PR alone, without instrumentation changes.

Rust 1.98.1, Windows MSVC target, Wine 11.22, RTX 5090 / NVIDIA 620.73.04, vkd3d-proton 30b0eb9bc12dc9f. Both requested backend paths completed, but this Wine/DXVK setup is not evidence of genuine Windows WARP coverage. No device/backend skip was reported. These are dispatch/readback checks.

Separately, I combined #1046, #1048, #1050, #1052 and #1053 (all patches applied cleanly) and ran all 14 generated workspace unit/integration test executables with all features. Combined: 345 passed, 5 failed, 6 ignored; matched baseline: 341 passed, 5 failed, 6 ignored. This full-suite result belongs to the combined tree. The five failures match baseline: empty pipeline library (#347), Wine Winsock export (#217), checksum-rejection expectation, nested Cargo fixture build, and Windows xtask launching host Git. Native Linux checks of that tree pass: shader 96 passed / 1 ignored, xtask 4 passed, asset policy clean.

Windows-target shader Clippy with all targets/features and -D warnings passes on this PR alone. Combined workspace Clippy finds a type-complexity warning in #1052, reported there.

Offline and offscreen; no game data, gameplay, native Windows or Wine doctests. Native d3dcompiler_47 supplied for full-suite GPU fixtures. Aggregate counts include existing early-return tests without optional console compilers/DXIL validator; these changed GPU tests executed. Coverage overlaps #1045, but its exact head was not tested here.

AI-assisted testing with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136052396 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1046#issuecomment-7136052396). Originally posted by [ThomasHFWright](https://github.com/ThomasHFWright) on 2026-11-24T15:27:15Z. --- Independent Linux/Wine hardware run of `5f9a0d247df7644c7779a1a6ef8eea65f7bd7d5a` on base `ffe310e`: **the changed regression passes**, exercising 216 comparisons across all twelve s_cmpk forms, two immediates and nine operands. Built and run from this PR alone, without instrumentation changes. Rust 1.98.1, Windows MSVC target, Wine 11.22, RTX 5090 / NVIDIA 620.73.04, vkd3d-proton `30b0eb9bc12dc9f`. Both requested backend paths completed, but this Wine/DXVK setup is not evidence of genuine Windows WARP coverage. No device/backend skip was reported. These are dispatch/readback checks. Separately, I combined #1046, #1048, #1050, #1052 and #1053 (all patches applied cleanly) and ran all 14 generated workspace unit/integration test executables with all features. **Combined: 345 passed, 5 failed, 6 ignored; matched baseline: 341 passed, 5 failed, 6 ignored.** This full-suite result belongs to the combined tree. The five failures match baseline: empty pipeline library (#347), Wine Winsock export (#217), checksum-rejection expectation, nested Cargo fixture build, and Windows xtask launching host Git. Native Linux checks of that tree pass: shader 96 passed / 1 ignored, xtask 4 passed, asset policy clean. Windows-target shader Clippy with all targets/features and `-D warnings` passes on this PR alone. Combined workspace Clippy finds a type-complexity warning in #1052, reported there. Offline and offscreen; no game data, gameplay, native Windows or Wine doctests. Native `d3dcompiler_47` supplied for full-suite GPU fixtures. Aggregate counts include existing early-return tests without optional console compilers/DXIL validator; these changed GPU tests executed. Coverage overlaps #1045, but its exact head was not tested here. AI-assisted testing with Codex.
Zipettte commented 2026-11-24 17:04:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T16:30:19Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 5f9a0d2: cargo test -p victory-shader passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7137769197 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1046#issuecomment-7137769197). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T16:30:19Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 5f9a0d2: `cargo test -p victory-shader` passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
DeerSilver commented 2026-11-24 19:04:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DeerSilver on 2026-11-24T18:39:29Z.


Tested head 5f9a0d2 merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1: pass. No game files: the test suite only.

  • The new test passes on both the RTX 5060 (hardware) and WARP, with no no SM 6.6 skip:
    • s_cmpk_compares_against_the_extended_immediate
  • With the D3D12 debug layer on (Graphics Tools; --all-features so victory-gpu enables it, plus a local, uncommitted EnableDebugLayer in emit::host::Host::new for the shader tests), the run logs no debug-layer message that main doesn't log too.
  • cargo test --workspace --all-features --locked: 347 passed, 0 failed, 6 ignored (main with all features: 346 / 6).
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7140953146 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1046#issuecomment-7140953146). Originally posted by [DeerSilver](https://github.com/DeerSilver) on 2026-11-24T18:39:29Z. --- Tested head `5f9a0d2` merged onto `main` `ffe310e` (clean merge) on **NVIDIA GeForce RTX 5060 Laptop GPU** (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1: **pass.** No game files: the test suite only. - The new test passes on both the RTX 5060 (hardware) and WARP, with no `no SM 6.6` skip: - `s_cmpk_compares_against_the_extended_immediate` - **With the D3D12 debug layer on** (Graphics Tools; `--all-features` so `victory-gpu` enables it, plus a local, uncommitted `EnableDebugLayer` in `emit::host::Host::new` for the shader tests), the run logs no debug-layer message that `main` doesn't log too. - `cargo test --workspace --all-features --locked`: **347 passed, 0 failed, 6 ignored** (`main` with all features: 346 / 6). - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. AI-assisted (Claude Code).
mercuryVM commented 2026-11-24 21:27:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T21:13:29Z.

Review: COMMENTED


Read only, not built. It conflicts in valu_tests.rs once #1050 and #1048 are applied (all three append at the same spot), so I couldn't merge it into our fork. Please rebase once either of those lands.

From reading: the immediates 0x0005 and 0x8000, against operands around both extension points (0x7fff/0x8000, 0xffff8000/0xffffffff), are what tell the sign-extended forms from the zero-extended ones. s_cselect_b32 on SCC is a clean way to read the result.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6047505756 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1046#pullrequestreview-6047505756). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T21:13:29Z. **Review:** COMMENTED --- Read only, not built. It conflicts in `valu_tests.rs` once #1050 and #1048 are applied (all three append at the same spot), so I couldn't merge it into our fork. Please rebase once either of those lands. From reading: the immediates `0x0005` and `0x8000`, against operands around both extension points (`0x7fff`/`0x8000`, `0xffff8000`/`0xffffffff`), are what tell the sign-extended forms from the zero-extended ones. `s_cselect_b32` on SCC is a clean way to read the result. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 03:03:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:33:15Z.


Automated triage for the maintainers. Recommended for a maintainer's look. This adds a test-only hardware/WARP check, s_cmpk_compares_against_the_extended_immediate in crates/victory-shader/src/emit/valu_tests.rs, for all twelve s_cmpk_* compares that lower.rs handles together with s_cmp_*. I checked the SOPK encoder and opcodes 0x03..0x0e against the RDNA2 ISA, and the expected results come from i64 comparisons with sign- or zero-extended immediates, so the test checks the right behaviour rather than repeating the code. No production change. CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150870868 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1046#issuecomment-7150870868). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T02:33:15Z. --- <!-- victory-triage v1 head=006290bb08b69590137a0b078890ce3d7707a198 verdict=merge-candidate at=2026-11-25T02:20:29Z --> Automated triage for the maintainers. Recommended for a maintainer's look. This adds a test-only hardware/WARP check, `s_cmpk_compares_against_the_extended_immediate` in `crates/victory-shader/src/emit/valu_tests.rs`, for all twelve `s_cmpk_*` compares that `lower.rs` handles together with `s_cmp_*`. I checked the SOPK encoder and opcodes 0x03..0x0e against the RDNA2 ISA, and the expected results come from i64 comparisons with sign- or zero-extended immediates, so the test checks the right behaviour rather than repeating the code. No production change. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
catminou4 commented 2026-11-25 04:04:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T03:56:31Z.

Review: APPROVED


Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

144 passed / 0 failed / 2 ignored. Hardware test for the s_cmpk_* scalar comparisons — RDNA2-matched encoding checks; Windows-gated execution, macOS compile green.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051643447 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1046#pullrequestreview-6051643447). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T03:56:31Z. **Review:** APPROVED --- Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 144 passed / 0 failed / 2 ignored. Hardware test for the s_cmpk_* scalar comparisons — RDNA2-matched encoding checks; Windows-gated execution, macOS compile green.
upstream-sync closed this pull request 2026-11-25 22:02:47 +00:00
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!1046
No description provided.