Repository navigation
Conversation
A compute program whose HLSL is longer than 8 MB is compiled by DXC at -O0 (the safety net in dxc::compile_here), and the unoptimised DXIL is left for the driver to optimise. A retail title's fully unrolled screen-probe passes (up to 88 863 RDNA2 instructions: one block of ~27 repeated ~3 280 times) become 15 - 30 MB of HLSL. On an RTX 3090 the NVIDIA driver did not finish building one: on main 6987e49 the 30 MB one was stopped at 23 GB after 451 s, and the title ran the machine out of memory (40 GB working set) when it bound the pipeline. -O1 is no way out: 10.5 min of DXC, 5 GB, still 14.7 MB of DXIL. The direct DXIL translator (gpu::dxil::kernel, opt-in with XCL_DIRECT_DXIL) translates the same programs in seconds, and with the compact form of xcl-dev#2034 two of them shrink to under 0.5 MB: ActivateProbes HLSL 30.3 MB -> 473 KB, driver 11 s, 1.6 GB ActivateProbesTarget HLSL 30.2 MB -> 432 KB, driver 11 s, 1.5 GB ActivateRays HLSL 15.0 MB -> 3.8 MB (plain form), 21 min, 8.3 GB So a compute program whose HLSL would be compiled unoptimised (dxc::UNOPTIMISED_ABOVE, now shared with compile_here) is translated by the direct translator; where that fails, the HLSL path goes on as before. Its translation-cache entry is kept under its own identity, which follows what the direct translator's output depends on (its version and sources, a forced compact form, the per-lane form), since the HLSL path's identity does not hash the gpu/dxil sources. TRANSLATION_GLUE_REVISION is bumped: an HLSL-path entry of such a program cached before this change would otherwise still be found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NmY9ce9uQcXiFj5qSSBfmV
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Tested in the retail title on an RTX 3090 (driver 621.24, Ryzen 7 9800X3D, 62 GB):
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. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Overlap note: #1809 (open, by another author) routes the same programs through the same function. Its
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 |
|
Test report on Tested: tree What was measured: the reroute works — record Not tested: suite run on this tree; NVIDIA/other-AMD GPUs; finishing the AI use: Measured by an omp agent running DeepSeek v4.1 Flash; text drafted |
A 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:In 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. On 689f2db without 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 Recompiler: direct DXIL lowers a repeating compute program's blocks once #2034's compact form.Regression run
scripts/smoke.ps1 -Game <folder>, 60 s, main 6987e49 and this PR's head (no input given):Not tested
AI use
Assisted-by: Claude Code (Claude Opus 5.5)