shader: lower v_mad_u64_u32 and v_mad_i64_i32 without INT64 #1654
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1654
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1654/head"
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?
@geiyiliyabumo on GitHub · 2026-11-24 20:30 UTC · original
geiyiliyabumo:fix/shader-mad-64-32→main· +285 −29 · 2 files · 2 commits · closed without mergingSummary
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.
@geiyiliyabumo on GitHub · 2026-11-24 21:06 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 01:23 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 01:33 UTC · original
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
Pull request closed