Skip to content

Shaders: hardware test for the 24-bit v_mul and v_mad forms - #1377

Closed
LouisRiverstone wants to merge 1 commit into
Marvisak:mainfrom
LouisRiverstone:shaders/v-mul24-test
Closed

LouisRiverstone wants to merge 1 commit into
Marvisak:mainfrom
LouisRiverstone:shaders/v-mul24-test

Conversation

@LouisRiverstone

Copy link
Copy Markdown
Contributor

v_mul_u32_u24, v_mul_i32_i24, v_mad_u32_u24 and v_mad_i32_i24 use only the low 24 bits of each factor (zero- or sign-extended). They are lowered in lower.rs with a shift pair per operand, but no hardware test ran them.

New test v_mul_and_v_mad_24_bit_forms_match_rdna2 runs seven values around the 24-bit boundaries (0x7FFFFF, 0x800000, 0xFFFFFF, 0x1000001, all-ones) as both factors, with addends 0 and 7 for the mad forms. Expected values come from masking and sign-extending in Rust.

Test only, no production change.

Verify: cargo test -p victory-shader v_mul_and_v_mad_24 (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

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardware test only: v_mul/v_mad 24-bit forms (VOP2 0x0b/0x09, VOP3 0x10b/0x109, mad 0x143/0x142). The i24 sign-extension ((a << 8) as i32) >> 8 matches the ISA's sign-extend-from-bit-23, and the u24 mask is correct; 49-case sweep covers the 0x80_0000/0xFF_FFFF edges. Windows-only execution. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p victory-shader --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

Copy link
Copy Markdown

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

  • Head c6ce95a. 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 xtask: wine-test runs the Windows tests on a Linux host under Wine #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

Copy link
Copy Markdown
Contributor

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 c6ce95a on main ffe310e (clean merge).

cargo test -p victory-shader --lib -- --test-threads=1: 121 passed, 0 failed, 1 ignored (main alone: 120 passed). v_mul_and_v_mad_24_bit_forms_match_rdna2 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).

@Marvisak

Copy link
Copy Markdown
Owner

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

The 24-bit multiplies are already probed in main: semantics_tests.rs integer_probes runs v_mul_u32_u24, v_mul_i32_i24, v_mad_u32_u24 and v_mad_i32_i24 over 34x34(x5) edge inputs.

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 Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants