Recompiler: prune unreferenced memory accessors and prelude helpers #1043
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!1043
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1043"
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?
@Lum7nt on GitHub · 2026-11-24 10:48 UTC · original
Lum7nt:feat/recomp-prune-helpers→main· +89 −15 · 2 files · 1 commits · openPrune unreferenced HLSL prelude helpers (
bvh_intersect,FMT_INFO,st_bytes,dst_sel,ld_raw) and memory accessors (xcl_loadx4,xcl_mStore*,xcl_mInterlocked*) when translating shaders.Previously,
PRELUDE_MEMand the entiremem_accessorsswitch-case ladder were emitted unconditionally, bloating the emitted HLSL and increasing DXC compile times for shaders that only perform simple loads or do not use raytracing BVH or packed buffer formatting.What is in it
crates/xcl/src/gpu/recomp/emit.rs: conditionally emit HLSL prelude helpers and memory accessors based on shader body usage.crates/xcl/src/gpu/recomp/tests.rs: addunreferenced_helpers_and_accessors_are_prunedunit test verifying that unreferenced helpers and accessors are omitted from emitted HLSL and that resulting shaders compile cleanly with DXC.Tested
cargo test --workspace -- --test-threads=4: 736 passed, 0 failed, 41 ignored.gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64unreferenced_helpers_and_accessors_are_prunedwith DXC compilation.Regression run
We have no retail title; this changes
crates/xcl/src/gpu/recomp/emit.rs, so it needs one. Could someone with a title post thexcl-smokeblocks formainand this head?main:
PR:
Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 11:12 UTC · original
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X Radeon iGPU (gfx1036 RDNA2, native wave64) + RTX 3060 Ti; Rust stable MSVC, debug.
XCL_ADAPTER=radeon cargo test -p xcl --lib recomp -- --test-threads=4: 189 passed, 0 failed, 18 ignored — includes the newunreferenced_helpers_and_accessors_are_pruned; all GPU wave64 tests ran on the Radeon (backend 'real' – AMD Radeon(TM) Graphics).AI use: test runs by Devin (Cognition, SWE-2); no code changes.
@AlexandreSchuelter on GitHub · 2026-11-24 11:26 UTC · original
Test report on AMD wave64 hardware (RX 6900 XT, RDNA2): no new failures, and the wave64 GPU tests that were SKIPPED on the RTX 3060 run and pass here.
Tested
stable-x86_64-pc-windows-msvc, debug; DXC 1.9.2602.17;XCL_NETWORK=0,XCL_REQUIRE_GPU=wave64; no SKIPPED testscargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4:main47efa2e4dfed79) merged onto47efa2emain: the RDNA2 packed-mip failure inplaced_title_textures_share_vram_and_preserve_pixels(fixed by #470 / #1028) and its twoPoisonErrorcascades.unreferenced_helpers_and_accessors_are_prunedpasses; allgpu_*wave64*/gpu_split_wave64_*/gpu_wave32_program_in_wave64_hardwaretests run and pass.Not tested
scripts/smoke.ps1(no game here), release build, other GPUsmain)AI use: Claude Code (Claude Opus 5.5) fetched the branch, ran the suites and wrote this report; the runs are real, on the hardware above.
@thehollowedone on GitHub · 2026-11-24 11:51 UTC · original
Synthetic DXC comparison on Windows 11, Ryzen 7 9800X3D, Rust 1.99.1 MSVC release, DXC 1.8.2502.11. I compared 4dfed79 with its actual parent 67a3735, using the same scratch harness for both. The workspace build and stock pruning test passed.
The harness compiled 36
cs_6_6cases covering ALU, scalar loads, and buffer stores with 1, 2, or 4 memory windows. Summed in-process DXC time, excluding one warm-up and file output, was 322 and 328 ms on the parent and 243 and 240 ms on the PR (parent / PR / PR / parent). HLSL fell from 1,294,743 to 767,007 bytes. All 36 DXIL blobs were byte-identical across all four runs.This measures small synthetic compute shaders only. AI-assisted. Codex (GPT-6) wrote and ran the scratch harness.
@eizispark on GitHub · 2026-11-24 11:54 UTC · original
Hardware test report — commit
4dfed79Verified clean merge with
main(47efa2e) on4dfed793ed75b372a91d7c9ae076b92e73803ceb: pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace --no-fail-fast -- --test-threads=4:736 passed, 0 failed, 41 ignored(GPU tests skipped on this adapter:none), includinggpu::recomp::tests::unreferenced_helpers_and_accessors_are_prunedRegression run
main(47efa2e):PR (
4dfed79):Not tested
XCL_D3D12_DEBUG=1; gameplay past the menusAI use: Antigravity (Google DeepMind), Gemini (exact version string not exposed in runtime environment) — ran the workspace test suite and 60 s retail smoke check on the hardware above and formatted this report.
@dervoxx on GitHub · 2026-11-24 14:47 UTC · original
Tested
RTX 5080 (driver 32.0.16.2101), Ryzen 9 9900X3D, Windows 11 build 26300, Rust 1.100.0 MSVC release, DXC 1.8.2502.11. Compared the clean PR head with its exact parent.
From a retail shader pack, sampled complete translations by name hash (1 in 50, four memory windows), then used seed 1043 to select 20 VS and 20 PS from those with baseline HLSL at or below 128 KiB. Three interleaved cold DXC CLI rounds at
-O3 -HV 2021(240/240 successful). Median HLSL shrank 34.8% for VS and 33.7% for PS. All 40 shaders produced byte-identical DXIL. Total DXC process CPU time was 7.734 → 7.625 s and wall time was 7.834 → 7.722 s. Both timings include process startup, varied between rounds, and overlapped the smoke benchmarking. The observed timing differences are inconclusive.Regression run
Exact parent
67a3735PR head
4dfed79Head reached 62.7% of the parent's frames and failed our 80% comparison threshold. The overlapping benchmark and single smoke run per build prevent attributing the lower frame count to the patch.
Not tested
Isolated smoke repeats, current
mainas a separate control, driver PSO compile timing, compute shaders, or the full workspace GPU suite in this comparison.AI use
Codex (GPT-6.2-Sol) ran and analyzed the measurements and drafted this report.
@Curry-976 on GitHub · 2026-11-24 17:16 UTC · original
Smoke runs for this PR's head
4dfed793ed75b372a91d7c9ae076b92e73803ceband its base onmain,67a3735177f42cf8e5c886e67a974da7f87541b3, taken back to back on a second GPU.Tested
stable-x86_64-pc-windows-msvc.cargo build --release -p xcl, thenscripts/smoke.ps1 -Game <retail title folder> -Seconds 60. Each run had its own emptyXCL_DXIL_CACHE, so neither run reused shaders that the other had translated.mainran first, and the PR ran immediately after it. Nothing else was running on the machine.main:
PR:
The PR reached 83.4 % of
main's frames and 102.8 % of its peak commit, with no device removal and no crash. On this laptop the frame rate drops as the machine heats up: an earliermainrun of the same commit gave 554 frames, and another gave 393. The PR ran second, so part of the gap may come from heat rather than from the change. These are one run per commit.Not tested
main, so it will need new smoke runs after the rebase.AI use
@Retried on GitHub · 2026-11-24 18:10 UTC · original
Test report for #1043 on NVIDIA Windows. The suite passes. On a random retail sample, compile time does not change.
Tested
4dfed79:cargo build --workspace && cargo test --workspace -- --test-threads=4(debug,XCL_SAMPLE_RPFset): 736 passed, 0 failed, 41 ignored. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64).4dfed79onmainb7aa9f3againstb7aa9f3itself, both release builds, retailshaders.rpf. The two builds were run alternately, two rounds each. The cherry-pick conflicts only intests.rs, where both sides append tests; I kept both.retail_translation_survey(seed 1269, 63 programs, DXC in process): total DXC 61 / 61 s → 61 / 61 s; median 0.24 s both; p90 2.59–2.61 → 2.61–2.62 s; max 9.4 s both. All 63 compile.The pruned helpers are cheap for DXC: an unused function costs it little. The HLSL is shorter, but compile time does not change. With
XCL_RECOMP_WINDOWS> 1 (more accessor switches) it may matter more; that case was not measured here.Not tested
Measured and written with Claude Code (Claude Opus 5.5).
@Retried on GitHub · 2026-11-24 18:50 UTC · original
Smoke blocks for this PR, as asked in the description. Same title, same 60 s, RTX 2070 SUPER (621.35), Windows 10.0.26300. Both runs used a clean checkout, an empty
XCL_DXIL_CACHEandXCL_TRANSLATED_CACHE=0;mainran first. They go under Regression run in the description:PR checksreads the description, not comments.This PR: 99 % of main's frames, 100.6 % of its peak commit, no device removal or crash.
Run by Claude Code (Claude Opus 5.5).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.