Recompiler: shadow v_writelane spill slots in split-wave64 #917
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!917
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-917"
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?
@zondy1i on GitHub · 2026-11-24 08:13 UTC · original
zondy1i:recomp/x64-writelane-shadows→main· +196 −3 · 4 files · 1 commits · open��In split-wave64 mode (two hardware wave32 halves per console wave64), SGPR spill reloads (
v_writelane_b32�!v_readlane_b32with a constant lane) previously went throughxcl_x_rla_uniformand emitted a full cross-half exchange (bounded spin loop, barriers, and atomics), even though both halves already hold identical SGPRs (x64_maskskeepsv_writelane_b32's scalar source whole-live).This adds a conservative forward must-analysis (
upper_lanes::analyze_spills) for split-wave64Kernel,Compute, andMeshprograms so constant-lane spill reloads read a scalar shadowxcl_sh<v>_<l>directly without exchanging across halves, reducing DXIL size and NVIDIA driver (nvgpucomp64.dll) pipeline compile time. Native wave64 HLSL is unchanged.What is in it
crates/xcl/src/gpu/recomp/upper_lanes.rs: addanalyze_spills(tracks constant-lanev_writelane_b32slots0..63across the CFG; invalidates on any VGPR write, dynamic-lanev_writelane_b32,v_movrel/v_swaprel,LOOP_GUARDexits, or indirect jumps) + unit tests.crates/xcl/src/gpu/recomp/mod.rs: runanalyze_spillsfor split-wave64Kernel/Compute/Meshprograms.crates/xcl/src/gpu/recomp/emit.rs: emit directxcl_sh<v>_<l>reads for shadowedv_readlane_b32inx64()mode without declaring VS/PS-onlyxcl_hw32.crates/xcl/src/gpu/recomp/tests.rs: addgpu_split_wave64_writelane_spill_shadowsGPU test covering lower- and upper-half spill reloads alongside a non-spill cross-half read.Measured on three spill-heavy retail wave64 compute shaders (RTX 3060 Ti, DXC 1.9.2609.5, before �! after):
rla_u259 �! 9, DXC 9231 �! 4869 ms, DXIL 394692 �! 293800 B (-25.6%), PSO 9118 �! 6334 ms (-30.5%)rla_u311 �! 17, DXC 14047 �! 7720 ms, DXIL 506376 �! 386384 B (-23.7%), PSO 11848 �! 9305 ms (-21.5%)rla_u506 �! 323, DXC 30955 �! 24472 ms, DXIL 1200072 �! 1113164 B (-7.2%), PSO 30468 �! 27233 ms (-10.6%)Tested
x86_64-pc-windows-msvc), debug + release.cargo test --workspace -- --test-threads=1: 718 passed, 0 failed, 41 ignored (2 SKIPPED GPU tests:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)).--test-threads=4on commit1ec4c98, pre-existinghle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsfailed intermittently (cascading 2PoisonErrors in unrelatedd3d12xtests); allrecomptests pass under both--test-threads=4and--test-threads=1.Regression run
main:
PR:
Not tested
split_wave64is false there so emitted HLSL is unchanged).CreateComputePipelineState).AI use
@IvyNotFound on GitHub · 2026-11-24 08:55 UTC · original
Tested on NVIDIA RTX 5080 (Blackwell, wave32) at
32976332072567e6fe9a7cc621e9cedce509ea2fTested
XCL_SAMPLE_RPF(retailshaders.rpf),XCL_SAMPLE_DLLS,XCL_SAMPLE_TTPF,XCL_SAMPLE_BVH4cargo build --workspace: succeeded (the existingfetch_updatedeprecation warning only)cargo test --workspace --no-fail-fast -- --test-threads=4: 715 passed, 3 failed, 41 ignored;SKIPPED(no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwaregpu_split_wave64_writelane_spill_shadows(ran, noSKIPPEDline),upper_lanes::tests::spill_slots_come_from_their_shadow,spills_follow_writelane_for_both_halves,spills_stay_conservative_across_overwrites_branches_and_loops; the existinggpu_wave64_vs_spill_slots_and_identityandgpu_wave64_ps_spill_slotspass toogpu_pso_e2ewith the pack: 7 passed (includingretail_es_gs_voxelize_geometry_modeand the retail mesh / GS pipelines)placed_title_textures_share_vram_and_preserve_pixels(cubemap extra_pages must be reused at same va), thentransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memoryon thePoisonError. The same three failed the same way onmain09940bbon this machine.cargo test -p xcl --lib -- --test-threads=4 title_textures::tests vram::testsat this head, three runs: 20 passed, 0 failed each time.Not tested
scripts/smoke.ps1/ the retail title, and the compile-time or DXIL-size numbers (not measured here)AI use
@Diskuss on GitHub · 2026-11-24 08:19 UTC · original · edited 2026-11-24 09:29 UTC
Tested on AMD Radeon RX 9070 XT (RDNA4) at
32976332072567e6fe9a7cc621e9cedce509ea2fHardware: RX 9070 XT (RDNA4, driver 32.0.32015.7029), Ryzen 7 5700X3D, 32 GB RAM, Windows 11 Pro build 26300.9974, Rust 1.100.0 x86_64-pc-windows-msvc, DXC 1.9.2602.17, debug build.
Tested
cargo build --workspace: succeeded (1 existing warning in thexcllib).cargo test --workspace --no-fail-fast -- --test-threads=4: 718 passed, 0 failed, 41 ignored (summed over alltest result:lines).gpu_split_wave64_writelane_spill_shadows: okspills_follow_writelane_for_both_halves: okspills_stay_conservative_across_overwrites_branches_and_loops: ok1ec4c98: 715 passed, 0 failed, 41 ignored, 0 SKIPPED): +3 passed, which matches the 3 new tests; failed and ignored are unchanged.Not tested: retail title /
scripts/smoke.ps1(no game files), release build, wave32-only GPUs.Report written by Claude Code (Claude Sonnet 5.5) from a real run on this machine.
Correction (hidden skips): "0 SKIPPED" above means no
SKIPPEDline appeared in the normal run. A later-- --nocapturerun on this machine shows that two tests skip silently, because the D3D12 debug layer is not installed (no Graphics Tools /d3d12SDKLayers.dll). libtest captures their output, so they show asok:e2e::test_title_draws_with_a_root_signature_under_the_debug_layerandtexture_states::uploads_start_from_each_subresources_state. Neither is related to this change, and all other GPU tests ran on the RX 9070 XT.@SlopTart on GitHub · 2026-11-24 10:37 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
3297633onto main6efdabc, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 723 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. writelane spill-slot shadowing in split-wave64 green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@zondy1i on GitHub · 2026-11-24 14:48 UTC · original
Thanks for the code review! Answering both questions:
gpu_split_wave64_writelane_spill_shadowscurrently tests vector invalidation onv11(not previously spilled), while VALU overwrite of a spilled VGPR is covered by the analysis unit tests inupper_lanes.rs. I left3297633untouched for now to avoid invalidating the existing independent hardware PASS runs on this head, but happy to add a spill-then-VALU-overwrite-then-read case directly to the GPU test if desired.xcl_x_rla_uniformcounts come from a one-off local Rust scan over all 10,490 wave64 CS/MS shaders in a retail shader corpus, callingrecomp::translatewith split-wave64 options and countingxcl_x_rla_uniform(occurrences before vs. after this PR.recomp::translate->dxc::compile->ID3D12Device::CreateComputePipelineState(withrecomp::pso::abi_root_signature_with) on a cold DXIL/PSO cache on Windows 11 + RTX 3060 Ti (single cold build per shader for base vs. PR).AI use: Antigravity (Gemini 4 Neon) helped draft this reply from the code and measurement logs.
@pvfreis on GitHub · 2026-11-24 14:57 UTC · original
Thanks. I'd add the spill, VALU overwrite, read case to the GPU test: it is the one way a stale shadow gives a wrong value without failing anything, and the analysis unit tests don't run the emitted HLSL. It changes only the test, so the existing runs stay meaningful for the code.
On the numbers: the scan and the benchmark could live in the tree as an
#[ignore]test that reads the shader pack from anXCL_SAMPLE_*variable, as the other game-data tests do (CONTRIBUTING, "Tests on game data"), so others can repeat them on their own GPUs.Reply by Claude Code (Claude Opus 5.5); checked by a person before posting.
@DarkPanda69 on GitHub · 2026-11-24 09:43 UTC · original · edited 2026-11-25 02:15 UTC
AMD run with native 64-lane waves, plus NVIDIA. Updated for head
709abd7(first run was on3297633, same result).Tested: pass, head
709abd7applied onmainaaa0936, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.cargo test -p xcl --lib -- gpu:: --test-threads=4:gpu_split_wave64_writelane_spill_shadowsok. The 2 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1and_3, which fail the same way onmainwithout this PR on this card.gpu_split_wave64_writelane_spill_shadowsok.Not tested: retail gameplay.
Note: these runs check that the translated HLSL matches the test's reference model, in 64-lane and in 32-lane waves. They cannot show that the model matches the hardware.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@DavidM1911 on GitHub · 2026-11-25 09:31 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@thehollowedone on GitHub · 2026-11-25 22:50 UTC · original
Independent RTX 3080 Ti check of #917 head
709abd7. Windows 11 build 26300, RTX 3080 Ti / driver 621.35, Ryzen 7 9800X3D, rustc 1.99.1, DXC 1.8.2502.11. The PR checkout was clean.cargo test --offline --locked -p xcl --lib gpu_split_wave64_writelane_spill_shadows -- --test-threads=1 --nocapture, withXCL_D3D12_DEBUG=1: 1 passed, 0 failed, no skip. This is the stock GPU regression containing the spill, vector overwrite, and reload case.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4on the exact head, without the optional debug setting: 1,105 passed, 0 failed, 46 ignored across 20 test binaries; 23 explicitSKIPPEDnotices (19 no native wave64, 3 unsupported f16 forms, 1 no heap windows). The spill-shadow GPU test ran and passed.I also made a clean, uncommitted merge of that same head into current
maine1d84b7in a disposable checkout. It merged without conflicts. The focused GPU test again passed 1/0 with no skip underXCL_D3D12_DEBUG=1. The full workspace suite on that merged tree passed 1,426/0/46 across 37 binaries, with 25 explicitSKIPPEDnotices (21 no native wave64, 3 unsupported f16 forms, 1 no heap windows). The merged-tree counts are integration evidence, not counts from the PR commit itself.Not tested: retail smoke on this machine, cold DXC/PSO compile-time improvement, or native AMD wave64. AI use: Codex (GPT-6; exact variant unavailable) ran the tests and drafted this report; GPT-6.2 Astra Low reviewed the current diff.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.