Shaders: hardware test for the VOP2 shifts, min/max and logic ops #1874

Closed
LouisRiverstone wants to merge 1 commit from upstream-pr/1876 into main
LouisRiverstone commented 2026-11-24 23:58:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by LouisRiverstone on 2026-11-24T23:58:47Z.


v_min_i32, v_max_i32, v_min_u32, v_max_u32, v_lshrrev_b32, v_ashrrev_i32, v_or_b32, v_xor_b32 and v_xnor_b32 (VOP2 0x11..0x14, 0x16, 0x18, 0x1c..0x1e) are lowered in lower.rs, but no hardware test ran them. The reversed shifts take the amount from the first operand and mask it to five bits.

New test v_vop2_shifts_min_max_and_logic_match_rdna2 runs all 36 ordered pairs of {0, 1, 31, 32, 0x80000001, 0xFFFFFFFF} through each op, in its VOP3 form. Expected values come from plain Rust operators.

Test only, no production change.

Verify: cargo test -p victory-shader v_vop2_shifts (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:6593922711 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1876). Originally posted by [LouisRiverstone](https://github.com/LouisRiverstone) on 2026-11-24T23:58:47Z. --- `v_min_i32`, `v_max_i32`, `v_min_u32`, `v_max_u32`, `v_lshrrev_b32`, `v_ashrrev_i32`, `v_or_b32`, `v_xor_b32` and `v_xnor_b32` (VOP2 0x11..0x14, 0x16, 0x18, 0x1c..0x1e) are lowered in `lower.rs`, but no hardware test ran them. The reversed shifts take the amount from the first operand and mask it to five bits. New test `v_vop2_shifts_min_max_and_logic_match_rdna2` runs all 36 ordered pairs of `{0, 1, 31, 32, 0x80000001, 0xFFFFFFFF}` through each op, in its VOP3 form. Expected values come from plain Rust operators. Test only, no production change. **Verify:** `cargo test -p victory-shader v_vop2_shifts` (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-25 03:02:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:09:54Z.

Review: APPROVED


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 VOP2 shifts, min/max and logic ops: RDNA2-matched (Windows-gated).

<!-- greyfinch-sync:Marvisak/VIctory:review:6050605832 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1876#pullrequestreview-6050605832). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T02:09:54Z. **Review:** APPROVED --- 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 VOP2 shifts, min/max and logic ops: RDNA2-matched (Windows-gated).
Marvisak commented 2026-11-25 08:06:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T07:26:29Z.


Automated triage for the maintainers.

This is a test-only change: v_vop2_shifts_min_max_and_logic_match_rdna2 in crates/victory-shader/src/emit/valu_tests.rs runs v_min/max_i32/u32, v_lshrrev_b32, v_ashrrev_i32, v_or/xor/xnor_b32 in their VOP3 forms on hardware and WARP. I checked the GFX10 VOP2 opcodes (0x11 to 0x14, 0x16, 0x18, 0x1c to 0x1e, plus 0x100 for the VOP3 form). The reversed shifts take the amount from src0 masked to 5 bits and shift src1, which matches the ISA. The values include the shift amounts 32 and 0x80000001, which wrap.

This inserts at the same place in the file as #1874 and #1875, so whichever merges later needs a trivial rebase.

CI: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155862948 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1876#issuecomment-7155862948). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T07:26:29Z. --- <!-- victory-triage v1 head=136ecd52fd72b166412cc26ac1aa983a4289ffd1 verdict=merge-candidate at=2026-11-25T07:26:29Z --> Automated triage for the maintainers. This is a test-only change: `v_vop2_shifts_min_max_and_logic_match_rdna2` in `crates/victory-shader/src/emit/valu_tests.rs` runs `v_min/max_i32/u32`, `v_lshrrev_b32`, `v_ashrrev_i32`, `v_or/xor/xnor_b32` in their VOP3 forms on hardware and WARP. I checked the GFX10 VOP2 opcodes (0x11 to 0x14, 0x16, 0x18, 0x1c to 0x1e, plus 0x100 for the VOP3 form). The reversed shifts take the amount from src0 masked to 5 bits and shift src1, which matches the ISA. The values include the shift amounts 32 and 0x80000001, which wrap. This inserts at the same place in the file as #1874 and #1875, so whichever merges later needs a trivial rebase. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
sinan-cmyk commented 2026-11-25 12:03:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T12:01:17Z.


Offline measurement on a retail dump

Result: no count change against main.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161812967 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1876#issuecomment-7161812967). Originally posted by [sinan-cmyk](https://github.com/sinan-cmyk) on 2026-11-25T12:01:17Z. --- ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 136ecd52 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 commented 2026-11-25 22:04:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:03:27Z.


Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because almost all of it is already covered. Six of the nine operations are on main in integers_match_the_hardware with wider inputs, and v_or_b32 and v_xnor_b32 are in #2015. That leaves v_xor_b32, a single Bin::Xor in the lowering. The opcodes and the reversed-shift model 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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7175880173 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1876#issuecomment-7175880173). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:03:27Z. --- Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because almost all of it is already covered. Six of the nine operations are on `main` in `integers_match_the_hardware` with wider inputs, and `v_or_b32` and `v_xnor_b32` are in #2015. That leaves `v_xor_b32`, a single `Bin::Xor` in the lowering. The opcodes and the reversed-shift model 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.
upstream-sync closed this pull request 2026-11-25 23:03:18 +00:00

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!1874
No description provided.