Shader tests: run v_mul_hi_u32 and v_mul_hi_i32 on the GPU #1811

Closed
n-romanovich wants to merge 1 commit from upstream-pr/1812 into main
n-romanovich commented 2026-11-24 22:56:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by n-romanovich on 2026-11-24T22:56:36Z.


Adds an end-to-end synthetic GPU/WARP execution test (v_mul_hi_u32_and_i32_match_rdna2) in crates/victory-shader/src/emit/valu_tests.rs covering unsigned and signed 32x32->high-32 multiplication (0x16a / 0x16c) across 0, u32::MAX, i32::MIN, i32::MAX, and cross-32-bit carry boundaries.

AI-assisted; verified with cargo test -p victory-shader --locked -- v_mul_hi_u32_and_i32_match_rdna2 and cargo clippy -p victory-shader --all-targets --locked on Windows 11 / RTX 5060 Ti + WARP, plus independent subagent review.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6593077836 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812). Originally posted by [n-romanovich](https://github.com/n-romanovich) on 2026-11-24T22:56:36Z. --- Adds an end-to-end synthetic GPU/WARP execution test (`v_mul_hi_u32_and_i32_match_rdna2`) in `crates/victory-shader/src/emit/valu_tests.rs` covering unsigned and signed 32x32->high-32 multiplication (`0x16a` / `0x16c`) across `0`, `u32::MAX`, `i32::MIN`, `i32::MAX`, and cross-32-bit carry boundaries. AI-assisted; verified with `cargo test -p victory-shader --locked -- v_mul_hi_u32_and_i32_match_rdna2` and `cargo clippy -p victory-shader --all-targets --locked` on Windows 11 / RTX 5060 Ti + WARP, plus independent subagent review.
catminou4 commented 2026-11-24 23:05:37 +00:00 (Migrated from github.com)

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

Review: APPROVED


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

GPU test: v_mul_hi_u32/v_mul_hi_i32 match_rdna2 — Windows-gated.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048811036 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812#pullrequestreview-6048811036). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:04:23Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests. GPU test: v_mul_hi_u32/v_mul_hi_i32 match_rdna2 — Windows-gated.
DesertGamer commented 2026-11-24 23:06:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-24T22:57:16Z.


VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146839672 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812#issuecomment-7146839672). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-24T22:57:16Z. --- ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Melow-code commented 2026-11-25 00:06:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-24T23:07:05Z.

Review: APPROVED


The ten input pairs cover the cases where unsigned and signed high-32 diverge: 1×MAX, 0x10000², MIN², the MIN/MAX crosses, and opposite-sign low bits. Each pair runs on hardware and WARP independently through run_cases, so a WARP-only lowering bug cannot hide.

Minor note: vop3(0x16a, 0, vgpr(1), vgpr(2), 0) leaves src2 = s0 — v_mul_hi_u32 is two-operand, the third source is ignored. A one-line comment would help the next reader, but it is not blocking.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048839173 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812#pullrequestreview-6048839173). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-24T23:07:05Z. **Review:** APPROVED --- The ten input pairs cover the cases where unsigned and signed high-32 diverge: 1×MAX, 0x10000², MIN², the MIN/MAX crosses, and opposite-sign low bits. Each pair runs on hardware and WARP independently through run_cases, so a WARP-only lowering bug cannot hide. Minor note: `vop3(0x16a, 0, vgpr(1), vgpr(2), 0)` leaves src2 = s0 — v_mul_hi_u32 is two-operand, the third source is ignored. A one-line comment would help the next reader, but it is not blocking.
upipibi commented 2026-11-25 00:06:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:11:06Z.


NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, 99ae318 (on main 70564ae). v_mul_hi_u32_and_i32_match_rdna2 passes, as on the RTX 5060.

AI-assisted (Claude Code). Synthetic tests only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147110780 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812#issuecomment-7147110780). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T23:11:06Z. --- NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, `99ae318` (on `main` `70564ae`). `v_mul_hi_u32_and_i32_match_rdna2` passes, as on the RTX 5060. AI-assisted (Claude Code). Synthetic tests only.
Headache3318 commented 2026-11-25 02:06:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Headache3318 on 2026-11-25T01:55:21Z.


Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head 7ec1e45 applied cleanly onto current main ccfb029.

  • cargo test -p victory-shader --locked: 144 passed, 0 failed, 2 ignored. All tests pass. The new v_mul_hi_u32_and_i32_match_rdna2 test is GPU-specific (requires dxil.dll/WARP) and is skipped on Linux.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 4 pre-existing errors in test code (fail identically on main ccfb029). The PR introduces no new clippy warnings.

Not tested: Windows MSVC build, the title itself. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150114868 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812#issuecomment-7150114868). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-25T01:55:21Z. --- Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head `7ec1e45` applied cleanly onto current `main` `ccfb029`. - `cargo test -p victory-shader --locked`: 144 passed, 0 failed, 2 ignored. All tests pass. The new `v_mul_hi_u32_and_i32_match_rdna2` test is GPU-specific (requires dxil.dll/WARP) and is skipped on Linux. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 4 pre-existing errors in test code (fail identically on main `ccfb029`). The PR introduces no new clippy warnings. Not tested: Windows MSVC build, the title itself. AI-assisted.
Marvisak commented 2026-11-25 07:03:16 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

Merge candidate. v_mul_hi_u32_and_i32_match_rdna2 in crates/victory-shader/src/emit/valu_tests.rs runs v_mul_hi_u32 (0x16a) and v_mul_hi_i32 (0x16c) on the host GPU and WARP. It compares them against the high 32 bits of the 64-bit unsigned or signed product. The opcodes match gfx10/opcodes.rs, and the cases include the i32::MIN/u32::MAX corners where signed and unsigned results differ.

Appends to the same file as #1804, #1810 and #1811; trivial rebase after the first one lands.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154809568 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812#issuecomment-7154809568). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T06:27:27Z. --- <!-- victory-triage v1 head=7ec1e45647442f804680584a6b1fcb60ef903db6 verdict=merge-candidate at=2026-11-25T07:05:00Z --> Automated triage for the maintainers. **Merge candidate.** `v_mul_hi_u32_and_i32_match_rdna2` in `crates/victory-shader/src/emit/valu_tests.rs` runs `v_mul_hi_u32` (0x16a) and `v_mul_hi_i32` (0x16c) on the host GPU and WARP. It compares them against the high 32 bits of the 64-bit unsigned or signed product. The opcodes match `gfx10/opcodes.rs`, and the cases include the `i32::MIN`/`u32::MAX` corners where signed and unsigned results differ. Appends to the same file as #1804, #1810 and #1811; trivial rebase after the first one lands. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Melow-code commented 2026-11-25 12:02:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-25T11:54:13Z.

Review: APPROVED


Review: PR #1812 — GPU test for v_mul_hi_u32 / v_mul_hi_i32

Author: n-romanovich. One test in valu_tests.rs, 38 lines. Fetch: git fetch upstream pull/1812/head:pr1812.

Verdict: mergeable as is

The opcodes check against the tree: v_mul_hi_u32 = 0x16a, v_mul_hi_i32 = 0x16c (gfx10/opcodes.rs 699, 701). The expected values are computed the way the ISA defines the instructions:

  • unsigned: high 32 bits of the full 64-bit product — ((x as u64 * y as u64) >> 32) as u32;
  • signed: high 32 bits of the product of the sign-extended operands — arithmetic shift on the i64 product.

The ten input pairs cover the shapes that separate the two semantics: 0 × 0, 1 × u32::MAX (the unsigned high of a wrap), 0x10000² (the unsigned high 0x0 vs the signed high — MIN as i32 would differ), u32::MAX², i32::MIN², the MIN/MAX cross pairs where the two instructions disagree the most, two mixed values, and a pair with opposite signs in the low bits. Each pair is asserted independently on hardware and on WARP through run_cases, so a WARP-only lowering bug cannot hide.

Notes (non-blocking)

  1. vop3(0x16a, 0, vgpr(1), vgpr(2), 0) leaves src2 = SGPR s0: v_mul_hi_u32 takes two operands, the third source is ignored. A comment would say so for the next reader, but the lowering never reads it.
  2. The tests run one thread, wave32, like the rest of valu_tests.rs. A wave64 run would also cover the fork's wave handling of these instructions, but that is scope creep for this PR.
  3. Style matches the module: build_valu_cs, run_cases, the same formatting of want/got in the message. Good to merge.
<!-- greyfinch-sync:Marvisak/VIctory:review:6057119181 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812#pullrequestreview-6057119181). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-25T11:54:13Z. **Review:** APPROVED --- # Review: PR #1812 — GPU test for v_mul_hi_u32 / v_mul_hi_i32 Author: n-romanovich. One test in valu_tests.rs, 38 lines. Fetch: `git fetch upstream pull/1812/head:pr1812`. ## Verdict: mergeable as is The opcodes check against the tree: `v_mul_hi_u32` = 0x16a, `v_mul_hi_i32` = 0x16c (gfx10/opcodes.rs 699, 701). The expected values are computed the way the ISA defines the instructions: - unsigned: high 32 bits of the full 64-bit product — `((x as u64 * y as u64) >> 32) as u32`; - signed: high 32 bits of the product of the sign-extended operands — arithmetic shift on the i64 product. The ten input pairs cover the shapes that separate the two semantics: 0 × 0, 1 × u32::MAX (the unsigned high of a wrap), 0x10000² (the unsigned high 0x0 vs the signed high — MIN as i32 would differ), u32::MAX², i32::MIN², the MIN/MAX cross pairs where the two instructions disagree the most, two mixed values, and a pair with opposite signs in the low bits. Each pair is asserted independently on hardware and on WARP through run_cases, so a WARP-only lowering bug cannot hide. ## Notes (non-blocking) 1. `vop3(0x16a, 0, vgpr(1), vgpr(2), 0)` leaves src2 = SGPR s0: `v_mul_hi_u32` takes two operands, the third source is ignored. A comment would say so for the next reader, but the lowering never reads it. 2. The tests run one thread, wave32, like the rest of valu_tests.rs. A wave64 run would also cover the fork's wave handling of these instructions, but that is scope creep for this PR. 3. Style matches the module: build_valu_cs, run_cases, the same formatting of want/got in the message. Good to merge.
Marvisak commented 2026-11-25 22:04:43 +00:00 (Migrated from github.com)

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


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

Closing because main already tests these with more inputs. integers_match_the_hardware in emit/semantics_tests.rs runs both opcodes over 34x34 edge pairs (0, 1, 0x7FFF_FFFF, 0x8000_0000, 0xFFFF_FFFF and mixed values) with the same 64-bit model, on hardware and WARP. Every pair here is covered. The expected values 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:7175868013 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1812#issuecomment-7175868013). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:02:52Z. --- Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because `main` already tests these with more inputs. `integers_match_the_hardware` in `emit/semantics_tests.rs` runs both opcodes over 34x34 edge pairs (0, 1, 0x7FFF_FFFF, 0x8000_0000, 0xFFFF_FFFF and mixed values) with the same 64-bit model, on hardware and WARP. Every pair here is covered. The expected values 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:11 +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!1811
No description provided.