Repository navigation
Recompiler: lower 32-bit VALU add/sub with carry without i64 in direct DXIL - #2565
ramon-victor wants to merge 1 commit into
Conversation
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! — Devin |
|
Wave64 run (listed as untested; the wave64 GPU tests skipped on the RTX 3070) on an AMD RX 9070 XT, plus an RTX 3060: the new test passes, and nothing else changes in the direct-DXIL GPU suite. Head
On both cards, the only result change against Not tested: Intel, a title. |
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
Integrates upstream amd-dev 9f02a3b (BVH null/OOB guard), b67375b (scratch SADDR 0x7F), 4ae5668/xcl-dev#2565 (32-bit VALU add/sub carry without i64), plus open PRs xcl-dev#2559 (bfm/ffbh_i), xcl-dev#2557 (known_nonzero_bits folding), xcl-dev#2552 (f16-to-f32 fold), xcl-dev#2568 (integer min/max range opt), and xcl-dev#2580 (empty DXC blob null slice). Assisted-by: Antigravity (Gemini 4 Neon)
Part of #1269.
Problem
In
crates/xcl/src/gpu/dxil/lower_valu.rs,v_add_co_ci_u32,v_sub_co_ci_u32, andv_subrev_co_ci_u32widened all three 32-bit operands (x,y,cin) toi64viazext64, performed 64-bitadd/sub, unpacked the 64-bit result (unpack64), and testedhi != 0for carry/borrow out.Every shader using 64-bit VALU address arithmetic (
v_add_co_u32+v_add_co_ci_u32) was therefore forced to emiti64instructions and declareFeature::Int64Opseven when no 64-bit integer operations were otherwise needed, andopt.rscould not fold or dead-code-eliminate thei64carry-out path (because 64-bit instructions are preserved to keepInt64Opsconsistent).Fix
v_add_co_ci_u32,v_sub_co_ci_u32, andv_subrev_co_ci_u32incrates/xcl/src/gpu/dxil/lower_valu.rsusing pure 32-bit carry/borrow arithmetic matchings_addc_u32/s_subb_u32inlower.rs:t0 = x + y,t = t0 + cin,carry = (t0 < x) | (t < t0).t0 = x - y,t = t0 - cin,borrow = (x < y) | (t0 < cin).lower_valu::valu_carry_tests::valu_carry_ops_avoid_i64_and_match_gpuverifying DXIL validation, disassembly (zero64-Bit integershader flag and zerozext i32), and wave32 RTX 3070 GPU parity across 32 boundary(x, y, cin)triples for all three opcodes (checking both 32-bitVDSToutputs and all 32 carry/borrow-out mask bits).Measured impact
573-program retail direct-DXIL validation sweep (
dxil.dll1.8.2502.11):6d12f58):573/573validated (val_fail=0),51,117,488total DXIL bytes (p50=22,865 us,p95=408,132 us).97376ee):573/573validated (val_fail=0),51,110,868total DXIL bytes (-6,620 B/-0.013%;p50=20,462 us,p95=403,273 us).Tested
cargo test --lib -p xcl valu_carry): 1 passed, 0 failed..\scripts\test.ps1, NVIDIA GeForce RTX 3070, Windows 11):1424 passed, 0 failed, 46 ignored.dxil.dllvalidation sweep:573/573passed,0failures.cargo build --release -p xcl) and 60 s retail smoke run (see below).Not tested
Regression run
Main (
f087b99):This PR (
97376ee):AI use