shader: lower v_mul_hi_i32_i24 and v_mul_hi_u32_u24 without INT64 #1647

Closed
github-bot wants to merge 1 commit from gh-pr/1647/head into gh-pr/1647/base
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 20:23 UTC · original
geiyiliyabumo:fix/shader-mul-hi-24 → main · +77 −0 · 2 files · 1 commits · closed without merging

Summary

  • Lowers RDNA2 v_mul_hi_i32_i24 (VOP2 0x00a / VOP3 0x10a) and v_mul_hi_u32_u24 (VOP2 0x00c / VOP3 0x10c) in crates/victory-shader/src/emit/lower.rs (mul_hi_24).
  • Matches AMD RDNA 2 ISA §12.7 (p. 132): ignores input bits [31:24], computes the exact 48-bit signed or unsigned product of bits [23:0], and returns (product >> 32) (bits [47:32], sign- or zero-extended to 32 bits).
  • Uses 16-bit + 8-bit partial products in pure i32 DXIL arithmetic so shaders using these instructions do not require the INT64 DXIL capability flag (SFI0 & 0x8000 == 0).

Verification

  • cargo test -p victory-shader --lib valu_tests: 14/14 PASS on both AMD Radeon RX 9060 XT (D3D12 hardware) and Microsoft Basic Render Driver (WARP) (mul_hi_24_signed_and_unsigned_match_rdna2 covers 36 synthetic cases across both VOP2 and VOP3 encodings and asserts SFI0 & 0x8000 == 0).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: pass (154 files).

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 20:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1647) `geiyiliyabumo:fix/shader-mul-hi-24` → `main` · +77 −0 · 2 files · 1 commits · closed without merging ## Summary - Lowers RDNA2 `v_mul_hi_i32_i24` (VOP2 `0x00a` / VOP3 `0x10a`) and `v_mul_hi_u32_u24` (VOP2 `0x00c` / VOP3 `0x10c`) in `crates/victory-shader/src/emit/lower.rs` (`mul_hi_24`). - Matches AMD RDNA 2 ISA §12.7 (p. 132): ignores input bits `[31:24]`, computes the exact 48-bit signed or unsigned product of bits `[23:0]`, and returns `(product >> 32)` (bits `[47:32]`, sign- or zero-extended to 32 bits). - Uses 16-bit + 8-bit partial products in pure `i32` DXIL arithmetic so shaders using these instructions do not require the `INT64` DXIL capability flag (`SFI0 & 0x8000 == 0`). ## Verification - `cargo test -p victory-shader --lib valu_tests`: **14/14 PASS** on both **AMD Radeon RX 9060 XT (D3D12 hardware)** and **Microsoft Basic Render Driver (WARP)** (`mul_hi_24_signed_and_unsigned_match_rdna2` covers 36 synthetic cases across both VOP2 and VOP3 encodings and asserts `SFI0 & 0x8000 == 0`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: pass (154 files). *AI-assisted; synthetic tests only, no game files.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:39:44 +00:00
github-bot closed this pull request 2026-11-26 04:39:44 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:22 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #156. Lowers v_mul_hi_i32_i24/v_mul_hi_u32_u24 like #156 (already picked for testing), but with 30 lines of 16/8-bit limb arithmetic only to avoid the INT64 flag main's mul_hi already sets. Its GPU value test (both encodings, 9 cases) is better than #156's and worth carrying over.

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.

**@⁠Marvisak** on GitHub · 2026-11-25 01:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1647#issuecomment-7149487900) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #156. Lowers v_mul_hi_i32_i24/v_mul_hi_u32_u24 like #156 (already picked for testing), but with 30 lines of 16/8-bit limb arithmetic only to avoid the INT64 flag main's mul_hi already sets. Its GPU value test (both encodings, 9 cases) is better than #156's and worth carrying over. 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

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