Recompiler: enormous compute programs take the direct DXIL translator #2120
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!2120
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2120/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?
@petmav on GitHub · 2026-11-25 05:05 UTC · original
petmav:recompiler/direct-dxil-enormous-compute→main· +143 −11 · 3 files · 1 commits · merged 2026-11-25 10:49 UTCA compute program whose HLSL is over 8 MB is compiled by DXC at -O0, and the driver gets the unoptimised DXIL. A retail title's fully unrolled screen-probe passes (
indirect_diffuse_lighting:CS_ScreenProbes_ActivateProbes/…ActivateProbesTarget/…ActivateRays, up to 88 863 RDNA2 instructions: one ~27-instruction block repeated ~3 280 times) become 15–30 MB of HLSL. On an RTX 3090 the NVIDIA driver never finished building one, and the title ran the machine out of memory (40 GB working set) when it bound the pipeline. These programs now go through the direct DXIL translator, which with #2034's compact form makes two of them about 0.5 MB. Where the direct translator fails, the HLSL path runs as before.Part of #1269.
What is in it
crates/xcl/src/gpu/recomp/pso.rs:compile_console_shadersends compute HLSL abovedxc::UNOPTIMISED_ABOVEtodirect_compute(respectingdxc::defer()). A rerouted result's translation-cache entry lives under its own identity, which follows the direct translator's version, sources, compact mode and per-lane form (translated::direct_output). The HLSL path's identity does not hashgpu/dxil.crates/xcl/src/gpu/recomp/dxc.rs: the 8 MB -O0 threshold becomes the sharedUNOPTIMISED_ABOVE(no change in behaviour).crates/xcl/build.rs:TRANSLATION_GLUE_REVISIONbumped, so an HLSL-path entry of such a program cached before this change is not found again. Every program is translated once more after updating.only_enormous_compute_hlsl_is_rerouted,rerouted_disk_entries_follow_the_direct_translator.Tested
RTX 3090 (Windows driver 32.0.16.1088), Ryzen 9 7950X3D, 64 GB, Windows 11 Pro build 26200, rustc 1.99.1, release build for the measurements.
cargo test --workspace -- --test-threads=4: 1156 passed, 0 failed, 46 ignored.SKIPPED on this adapter (no wave64): 7 ×
no wave64, plus the wave64 variants of f32 arithmetic / compares / conversions / rounding / transcendentals / three-source, f16 arithmetic / packed, f64, integer arithmetic / carries, const_mask, mask_ff0_flbit. Alsono heap windows, and the per-lane f16 arithmetic / f16 packed / f32 conversions tests (refused by the per-lane form).Driver builds of the three programs.
xcl shaders <dir> --precompile --pipelineswith one program andXCL_PIPELINE_THREADS=1; main with--measure-pso(driver cache off). Peak working set sampled every 2 s:6987e49689f2dbstopped at 12 GB after 309 s, unfinished689f2dbstopped by a 600 s limit, unfinishedIn the title, with this change on
689f2db(before the rebase): after--precompile --pipelinesof the three programs, the title's pipelines for them were made from the stored blobs (driver blob supplied, 4 321 608 / 3 914 652 B DXIL). In two runs of 6 and 8 min the title did not run out of memory. On689f2dbwithout the change it reached a 40 GB working set (76 GB commit) building the 29 MB DXIL and was stopped. The direct DXIL sizes here are from before #2034's compact form.Regression run
scripts/smoke.ps1 -Game <folder>, 60 s, main6987e49and this PR's head (no input given):Not tested
AI use
Assisted-by: Claude Code (Claude Opus 5.5)
@futurepro62 on GitHub · 2026-11-25 05:19 UTC · original · edited 2026-11-25 05:28 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
8dcc56d(on its base6987e49).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1144 passed, 0 failed, 44 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.only_enormous_compute_hlsl_is_rerouted,rerouted_disk_entries_follow_the_direct_translator.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1155 passed, 0 failed, 46 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main6020a33too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@PracticalStudios on GitHub · 2026-11-25 06:10 UTC · original
Tested in the retail title on an RTX 3090 (driver 621.24, Ryzen 7 9800X3D, 62 GB):
maincbc296a+ #684 + this PR (8dcc56d), release, one 300 s run from a warm cache, no input.56c0cd3b82a00c6egoes to direct DXIL (473 KB instead of 30 MB of HLSL) and its driver compile now finishes in 8.2 s.prod=qNone, cells fe58 / fe10 / fee8) at 76.7 s. Not investigated further.resolve_wait):95cc13288a27a96e: 15 MB of HLSL, sent to direct DXIL (3.8 MB). Started at 88 s and still compiling at 300 s.590cef5cfe51c7ac(1.2 MB of DXIL): 89 s.b8755fc12d3163fc(1.0 MB): 53 s.b7a408ccdd229979(1.1 MB): unfinished.So, on this machine, this PR is not enough to get in game. The next blockers are these larger compute pipelines, which compile on the title's threads.
@DavidM1911 on GitHub · 2026-11-25 06:17 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!
@upipibi on GitHub · 2026-11-25 06:53 UTC · original
Overlap note: #1809 (open, by another author) routes the same programs through the same function. Its
compile_console_shadersends a compute program todirect_computewithoutXCL_DIRECT_DXILwhen the direct container is at least 64 KiB (XCL_DIRECT_HUGE), and falls back to HLSL otherwise. The two PRs conflict inpso.rs(git merge-treeof8dcc56dandf090104).dxc::UNOPTIMISED_ABOVE, 8 MB). Every program this PR measured (0.5 MB containers in the compact form) is above #1809's threshold. So with #1809 merged, this PR reroutes nothing more, unlessXCL_DIRECT_HUGE=0is set or the threshold is raised above the container size.Backend::HlslHugeDirect(min), this PRrerouted_identity/direct_output). Only one of them should land, or one PR should build on the other.Either PR could keep the cheaper HLSL-size check as a first filter in front of #1809's container-size rule. I haven't run the two together.
AI-assisted (Claude Code); source read and
git merge-treeonly.@iggyvilla on GitHub · 2026-11-25 08:03 UTC · original
Test report on
8dcc56d(merged with #1435 onmain cbc296aasb5c481f;cargo build --release -p xcl,XCL_DIRECT_DXILunset), 2 world-load walks onRX 6650 XT 8 GB (RDNA2) / Adrenalin 32.0.21045.29003 / 32 GB RAM, commit limit
44 GB.
Tested: tree
b5c481f(=cbc296a+ #2120 + #1435), 330 s-FromSavewalks(cold and warm DXIL cache),
PRELOAD=0,XCL_PSO_WAIT_MS=2000, commit stop at37.8 GB.
What was measured: the reroute works — record
56c0cd3b82a00c6e(17 025 432 B DXIL on main) translates from 30 264 KB HLSL to 446 812 B
direct DXIL, and record
95cc13288a27a96e(10 896 240 B on main) from15 008 KB HLSL to 3 916 120 B, each logged once per walk. But on this card
neither driver build finished: started 128.2–137.0 s, both still building
when the commit stop fired 9–18 s later (commit climbing ~1 GB/s from 128 s,
peak process private 40.4 / 40.7 GB). 0 presents after 130 s in both walks, no
world. A third fresh 1.29 MB compile (
84eee477d68b6fdf, under the 8 MiB HLSLthreshold so not rerouted) ran in the same window. Note: the stop is our local
safety limit (37.8 GB of a 44 GB commit limit), not an OOM — the builds might
finish with more headroom, but not in the ~20 s this window allows.
Not tested: suite run on this tree; NVIDIA/other-AMD GPUs; finishing the
two direct-DXIL builds past the commit stop.
AI use: Measured by an omp agent running DeepSeek v4.1 Flash; text drafted
by Muse Spark 1.3; checked and posted by Claude Code (Claude Opus 5.5) on my
behalf; I did not run the tests or write the text.
@ettehn on GitHub · 2026-11-25 10:01 UTC · original
Windows CPU-only check on exact head
8dcc56d, using only record56c0cd3b82a00c6e. WithXCL_DIRECT_DXILandXCL_DIRECT_COMPACTunset, four switch windows and split wave64, a fresh translation cache produced the explicit “30308 KB of HLSL would compile unoptimised – direct DXIL instead” message and a new 484,508-byte direct dump.--precompiletook 3.1 s, peak Windows job commit 177.9 MiB. A second process with the same translation cache but a fresh dump directory took 0.3 s, peaked at 29.2 MiB, and emitted neither a reroute message nor a fresh dump. The translation-cache directory contained one entry. Both processes exited 0 under a 2 GiB commit cap. The compute summary printedcompiled 1, already cached 0in both processes, so that counter alone did not distinguish the warm path in this check.No PSO creation or title execution. Separate CPU comparison of the same record against bounded DXC is at #2088, here.
AI use — OpenAI Codex (GPT-6) built the exact head, ran the checks and reviewed the logs.
@ettehn on GitHub · 2026-11-25 10:26 UTC · original
Follow-up to the #1809 overlap note with a bounded Windows CPU-only comparison on exact heads
f090104and8dcc56d. Each run used an empty XCL cache, one compute record,--split 1 --windows 4, and a 2 GiB job limit. No driver PSOs were created.777348c43857fdd2(~429 KiB HLSL): #1809 selected 75,172 B direct DXIL (0.1 s precompile, 13.5 MiB peak job commit). SettingXCL_DIRECT_HUGE=0on that same head took the HLSL/DXC path (109,820 B, 1.0 s, 76.6 MiB). #2120 also took HLSL/DXC (109,904 B, 1.0 s, 77.7 MiB). This is one concrete record a strict 8 MiB HLSL prefilter would leave on DXC.56c0cd3b82a00c6e: both defaults chose direct DXIL. The #1809 head predates #2034 and emitted ~4.12 MiB. #2120 emitted 473 KiB in 3.1 s; turning off compact generation on that same head still rerouted but emitted ~4.13 MiB in 7.5 s. The size difference is therefore mostly the compact form in this sample. Forcing the direct path on #2120 with compact at its default also emitted the 473 KiB result, in 1.5 s (51.7 MiB peak job commit versus 177.6 MiB for automatic routing).Single runs per setting, for route distinction and translation cost only. No GPU timing or correctness claims.
AI use — OpenAI Codex (GPT-6.2 Sol) ran the checks and wrote this report.
@ettehn on GitHub · 2026-11-25 10:46 UTC · original
Compatibility check: exact #2120 head
8dcc56dand #2076 head14ae010merge cleanly (merge treeb895b666). On that tree I calledconsole_to_dxil_infor95cc13288a27a96e, four switch windows, withXCL_DIRECT_DXILandXCL_DIRECT_COMPACTunset. Windows CPU-only; no D3D12 device was opened.This checks composition at the production translation entry point. Driver build, dispatch, and the title were not tested.
AI use — OpenAI Codex (GPT-6.2 Sol) ran the checks and wrote this report.
@Kalmarv on GitHub · 2026-11-25 11:00 UTC · original
Heads-up: on
main5478c4a7, this PR'sshader_cache_tests::rerouted_disk_entries_follow_the_direct_translatorfails (cargo test -p xcl --lib --release -- gpu::recomp::pso::: 19 passed, 1 failed). It reads the marker from.dxil[0], but #2064 (merged just before) changed the test helpercompiled(marker)to build a valid container withsynthetic_dxil, which putsDXBCat byte 0 and the marker at byte 67. #2064's own tests read.dxil[67], so switching this test's reads to[67]should be all it needs; I haven't made that change.This is the second unit test failing on
main. The other is in #1991's thread.AI use: Claude Code (Claude Opus 5.5) found the failure, ran the tests and wrote this note.