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)
Lower add/subtract with carry or borrow using two i32 operations and unsigned comparisons. This removes unnecessary i64 widening and the Int64Ops feature from shaders that otherwise need only 32-bit arithmetic. Adapted from xcl-dev#2565. Upstream reports 573/573 DXIL validation and direct GPU parity across NVIDIA and AMD. Locally cross-checked only with the GNU Windows target; Windows GPU execution remains untested here. Part of xcl-dev#2508 Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
Lower add/subtract with carry or borrow using two i32 operations and unsigned comparisons. This removes unnecessary i64 widening and the Int64Ops feature from shaders that otherwise need only 32-bit arithmetic. Adapted from xcl-dev#2565. Upstream reports 573/573 DXIL validation and direct GPU parity across NVIDIA and AMD. Locally cross-checked only with the GNU Windows target; Windows GPU execution remains untested here. Part of xcl-dev#2508 Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
|
Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2565 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib valu_carry_ops_avoid_i64_and_match_gpu -- --nocapture (3 consecutive runs) |
1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.22s, 0.19s, 0.18s, 0 skipped — live Wave32 GPU parity on RTX 4060) |
cargo test --release -p xcl --lib gpu::dxil:: -- --test-threads=4 (3 consecutive runs) |
184 passed; 0 failed; 3 ignored; 1138 filtered out × 3 (3.61s, 3.89s, 3.62s; 183 executed + 1 expected Wave32-only skip dispatch_chain_native_wave64_builds_whole: no wave64) |
cargo build --release -p xcl |
Clean build (1m 07s, exit 0, 0 new warnings) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):
xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB
PR #2565 (97376ee13636653cf6d1853dd330fe0290285cab):
xcl-smoke v1
commit: 97376ee13636653cf6d1853dd330fe0290285cab
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1604 (PresentX 1605)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13983 MB
Runtime log observations (xcl.log)
9221log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19558 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13982 MB committed by the process; video memory 6115 MB local, 4651 MB non-local.
Limits of coverage
- 32-bit VALU add/sub carry lowering without
i64in direct DXIL was verified end-to-end on desktop Wave32-only NVIDIA RTX 4060 viavalu_carry_ops_avoid_i64_and_match_gpu(3/3,0skipped) andgpu::dxil::(183executed +1expectedno wave64skip × 3). - Native Wave64 GPU execution is not available on this Wave32-only RTX 4060, and the warm-cache 60 s retail smoke on
title: 29640639confirms zero runtime regression rather than re-compiling a coldXCL_DIRECT_DXIL=1shader set (frame-count delta vs. cached parent reflects single-run startup variance, not this PR).
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Lower add/subtract with carry or borrow using two i32 operations and unsigned comparisons. This removes unnecessary i64 widening and the Int64Ops feature from shaders that otherwise need only 32-bit arithmetic. Adapted from xcl-dev#2565. Upstream reports 573/573 DXIL validation and direct GPU parity across NVIDIA and AMD. Locally cross-checked only with the GNU Windows target; Windows GPU execution remains untested here. Part of xcl-dev#2508 Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
Lower add/subtract with carry or borrow using two i32 operations and unsigned comparisons. This removes unnecessary i64 widening and the Int64Ops feature from shaders that otherwise need only 32-bit arithmetic. Adapted from xcl-dev#2565. Upstream reports 573/573 DXIL validation and direct GPU parity across NVIDIA and AMD. Locally cross-checked only with the GNU Windows target; Windows GPU execution remains untested here. Part of xcl-dev#2508 Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
|
RX 9070 / RADV / Wine check of exact head Tested
Main fails the Int64 disassembly assertion before the original test dispatches. Head/integration pass both that check and the original 32-lane GPU results/masks. Additional owned filter
Inputs: all 24 × 24 boundary operand pairs, plus 448 deterministic overflow/borrow-threshold and mixed pairs, each with both carry-in values: 2,048 triples per program/backend/wave configuration. The first two programs execute every triple; the third applies the stated masks. Native-wave64 low/high input mask words differ, and output checks include both halves. Results and carry/borrow masks agree with an independent arbitrary-precision integer oracle on all sources. Captured data are byte-identical across all three sources and repeats. Main is functionally correct in this matrix too. The measured change is in the shader requirement: SFI0 Int64 bit Across both groups: 5,206 captured GPU dispatches, including 18 physical-width probes and 1,737 native-wave64 dispatches. Independent verification checks 7,752,780 words: results, all output-mask words, 16 SGPR and 16 VGPR guards, inactive lanes, unchanged SCC and the complete flat-memory readbacks. Shader metadata and physical widths match; original and owned programs were independently re-encoded from the public ISA tables. 0 ignored, 0 skipped, no device-removal markers. Inherited Not tested Full suite, split-wave64 or per-lane translation, guest Compute ABI integration, native Windows, other GPUs, retail workload, AI use OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the owned test-only matrix and captures, ran comparisons, independently verified integer results, masks, aliases, guards, wave widths, shader flags and source/executable provenance, and drafted this report. Publication authorized by the account owner. |
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