Shader tests: v_pk_mul_lo_u16 keeps each half to 16 bits #1289
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1289"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by bvtterbroot on 2026-11-24T17:09:17Z.
v_pk_mul_lo_u16has no test, and its lowering,(x * y) & 0xffffper half, is the case where an AMD driver has been seen to drop the 16-bit mask when the other half of the result is a constant 0. That was in another translator, on the Vulkan path (RDNA2 iGPU, driver 26.10.1,0x1234 * 0xaaaaread back as0x0c229e88instead of0x00009e88). This adds a test that would catch it here.What
v_pk_mul_lo_u16_keeps_each_half_to_16_bitsincrates/victory-shader/src/emit/valu_tests.rs, plus a smallvop3pencoder beside the existingvop1/vop3ones. All four forms take run-time operands from the root constants, so no compiler can fold them:v_pk_mul_lo_u16 v0, v1, 0xaaaa0000 op_sel:[0,1] op_sel_hi:[0,0](v1 =0x00011234)0x00009e88v_pk_mul_lo_u16 v0, s1, v3 op_sel_hi:[1,0](s1 =0x0003ffff, v3 =0x1234abcd)0x03675433v_pk_mul_lo_u16 v0, v4, 0x00050000(v4 =0x0007beef)0x00230000v_pk_mul_lo_u16 v0, v1, 7 op_sel_hi:[1,0]0x00077f6cThe expected words are the RDNA2 ISA rule (each half is the low 16 bits of the product of the selected source halves). The same four cases were measured on native RDNA2 hardware (gfx1036) in that other project. No translator change: the current lowering gets all four right.
Tested
Windows 11, Rust 1.98.1, at
ffe310e:cargo test -p victory-shader(121 passed). The test host picks the default adapter, so for this run I pointed it at the iGPU with a local, uncommitted change toHost::new.cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.rustfmt --checkon the file: clean.So the AMD D3D12 drivers here do not show the dropped mask. The test is a guard for when the lowering or a driver changes.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T17:34:53Z.
Independent verification of \�03944a\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200) / Rust 1.98.1 MSVC:
AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:21:22Z.
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main:mainhas moved since the last triage, and the branch now conflicts incrates/victory-shader/src/emit/valu_tests.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
Pull request closed