shader: lower v_mad_u64_u32 and v_mad_i64_i32 without INT64 #1653
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1654"
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 geiyiliyabumo on 2026-11-24T20:30:50Z.
Summary
v_mad_u64_u32(0x176) andv_mad_i64_i32(0x177) incrates/victory-shader/src/emit/lower.rs(Lower::mad64+Lower::mad64_addend).UMul/IMul(dx.op.binaryWithTwoOuts.i32) and 32-bit carry propagation (add_sub_carry) so neither instruction sets theINT64DXIL capability flag (SFI0 & 0x8000 == 0).vdst[0:1]under the activeEXECguard.sdstviawrite_mask(v.carry.or(v.dst)): unsigned carry-out (bit 64) forv_mad_u64_u32, and bit 64 (sign of the exact 65-bit sum:mul_sign ^ add_sign ^ carry_hi) forv_mad_i64_i32.CLAMPsaturation (u64::MAXfor unsigned;i64::MIN/i64::MAXon 64-bit signed overflow).src2.Verification
cargo test -p victory-shader --lib: 124 passed, 0 failed, 1 ignored on both AMD Radeon RX 9060 XT (D3D12 hardware) and Microsoft Basic Render Driver (WARP), including 4 new regression tests (v_mad_u64_u32_writes_both_dwords_and_carry,v_mad_i64_i32_writes_both_dwords_and_bit_64,v_mad_64_respects_exec,v_mad_64_reads_scalar_pairs_and_expands_immediates— 41 synthetic GPU dispatches verifying low/high dwords,sdstmask readback,CLAMP,EXECmasking, andSFI0 & 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.
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T21:06:54Z.
Updated in
3a08221: replaceddx.op.binaryWithTwoOuts.i32(IMul/UMul) with pure 32-bit LLVM 16-bit partial-product wide multiplication (still zeroINT64flags inSFI0) so strictdxil.dllvalidation accepts the emitted DXIL. Re-verified withVICTORY_DXILactive on both AMD Radeon RX 9060 XT and WARP (17/17valu_testsPASS, clippy clean,cargo xtask policy154 files ok).AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:42:45Z.
Review: APPROVED
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows.v_mad_u64_u32/v_mad_i64_i32 lowered without INT64: mad64/mad64_addend/read_pair/write_mask helpers preserve the 64-bit pair semantics.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:23:35Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.v_mad_u64_u32/v_mad_i64_i32 without 64-bit integers. Main lowers both (lower.rs:5214-5244) with i64, which the translator uses in many other places, so avoiding the INT64 flag here buys nothing.
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.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:33:33Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
upstream-sync referenced this pull request2026-11-25 19:06:38 +00:00
Pull request closed