Repository navigation
Shaders: prebuild split compute dispatch-chain pieces under --pipelines - #2338
ChalanaGimhanaX wants to merge 1 commit into
Conversation
When direct DXIL translation splits a large compute program into a dispatch chain (xcl-dev#2080, under XCL_DIRECT_DXIL=1 or automatically for enormous compute shaders), the runtime builds each piece under dispatch_chain_root_signature and caches its driver blob as .chain.pso. xcl shaders --precompile --pipelines ignored Compiled::dispatch_chain and instead built only the unsplit whole shader under abi_root_signature_with (.pso), which neither the split runtime path nor the Chain::whole() fallback loads. On two split retail compute shaders (RTX 3060, XCL_DIRECT_DXIL=1, XCL_PIPELINE_THREADS=4), prebuild wall time dropped from 117.0 s (0/16 .chain.pso blobs) to 9.2 s cold and 0.4 s warm (16/16 .chain.pso blobs reused). Part of xcl-dev#1833, xcl-dev#2088. Assisted-by: Google Antigravity (Gemini 4 Neon)
|
Ran the two new split-compute prebuild tests at System
Results
What this adds Not tested AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
|
AMD run with native wave64 (listed as untested), to go with the NVIDIA run above: the new prebuild test passes on an RX 9070 XT, so the AMD driver reuses the prebuilt split pieces in a second process too. Head
Not tested: a title, the full 744-program prebuild, Intel. |
|
RTX 4090 retail runtime check. On clean PR head
World loading. Both runs showed loading artwork and ended at the configured cutoff with exit code 0 and no logged device removal. No gameplay HUD or recognizable world geometry appeared in the captures. The first matched piece request came at 201.212 s on the parent and 196.818 s on the PR, well after the last active presentation interval in each. The driver times above sum overlapping calls. Both runs still built 789 pieces across 90 split programs in total. Method. RTX 4090 24 GB, NVIDIA 621.40, Ryzen 7 5800X3D, 32 GB RAM, Windows 11 build 26300, Rust 1.99.1 MSVC. Each clean tree was built with For each 300 s Follow-up on the last presents. I repeated the 300 s retail run twice on the same clean PR head (
All 74 calls completed without a retry in both runs. In the second run, the game kept presenting for another 58 s after the last selected call finished. Neither run resumed presenting by 300 s. The captures showed loading artwork and no gameplay HUD or recognizable world geometry. No compute driver call overlapped the last active interval in either run. The four graphics driver calls overlapping it in the second run each took at most 3 ms. This narrows the next trace to what the presentation thread was waiting for at the transition out of loading. The control ran first and NVIDIA's internal cache was uncontrolled. The 74 calls were already fast in the new control, so the difference in stop times cannot be attributed to the added files. Driver timings sum overlapping calls and exclude queue waits. AI assistance. OpenAI Codex (GPT-6) ran the comparison, checked the traces and captures, and drafted this update. What the presenting thread waited for on The coordinator (TID 263228) completed 81 waits and then waited on event The completed run used in-process tracepoints with the release PDB and exited normally at 300 s with 1,437 PresentX calls. A separate breakpoint-debugger attempt slowed presentation and was excluded. AI assistance. OpenAI Codex (GPT-6) ran the trace and verified the event sequence. |
|
Tested: current PR head merged onto current One red on this lane.
So the piece-prebuild path itself works in-process here, but the offline two-process reuse check does not complete under wine-11.0/vkd3d-proton. Note the child queries 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. |
|
Follow-up to my report above, now with the child failure pinned down. The silent exit 5 is an access violation inside the shim, not a hung or refused start. Re-ran with Control that keeps this on the PR: running the whole Also worth noting for whoever picks this up: the new AI use: same as above (Hermes agent, local Qwen-class, checked before posting). |
|
This runtime check matches what I see on an RTX 5080: the split pieces named in the offline cache are supplied (66/66 here, 86.2 s → 2.87 s), but the run still builds the other pieces (789 across 90 split programs above), and the world-load stop is unchanged. The missing part is the records that were never precompiled. On AI use: OpenCode, Claude Fable 5.2 compared this check with retail-run logs on this machine and wrote this. |
Follow-up to #2080 (
Part of #1833,Part of #2088):xcl shaders --precompile --pipelinesnow prebuilds and caches every piece of a split direct-DXIL compute program (.chain.pso) underdispatch_chain_root_signature, instead of compiling the unused unsplit whole container underabi_root_signature_with(.pso).When direct DXIL translation splits a large compute program into a
DispatchChain(underXCL_DIRECT_DXIL=1, or automatically forenormouscompute shaders on default settings), the runtime (dispatch_chain::build) builds each piece withdispatch_chain_root_signatureand looks up<hash>-<len>-<flags>.chain.psoon disk; even the lazyChain::whole()fallback useschained = true(.chain.pso). Previously,Pipelines::makeignoredCompiled::dispatch_chainand compiled onlyc.dxilto<whole>.pso, leaving 0.chain.psoblobs for the runtime and hitting the slow unsplit compile (orXCL_PIPELINE_MAX_KBcap) offline. On a local retail shader pack (XCL_DIRECT_DXIL=1, wave32), 744 of 2,080 translated compute programs split into 7,100 pieces.What is in it
crates/xcl/src/hle/d3d12x/real.rs: adddriver_cache::name_foranddriver_cache::path_forsoreal::compute_containerand offline precompile share the exact.pso/.chain.psonaming; extenddriver_cache::tests::a_file_is_named_after_its_dxil_and_flags.crates/xcl/src/shaders.rs: keyPipelines::signaturesby(chained, samplers)usingpso::dispatch_chain_root_signaturefor chained pieces; updatePipelines::make_with_cache_path/make_oneto build and cache each piece of a splitDispatchChain(pieces.len() >= 2) as.chain.psoacross up toXCL_PIPELINE_THREADSworkers with per-pieceXCL_PIPELINE_MAX_KBcapping; printsplit compute programs: N (M pieces)when non-zero; add GPU testsplit_compute_program_prebuilds_and_caches_chain_pieces(compilesspace2pieces that onlydispatch_chain_root_signatureaccepts, verifies.chain.psowrite/reuse, runtimeCreateComputePipelineStateacceptance, and per-piece cap enforcement).crates/xcl/tests/gpu_compute_e2e.rs: addoffline_split_compute_pipeline_is_reused_by_a_second_processexercisingxcl shaders --precompile --pipelinesend-to-end on a synthetic wave32 multi-block console CS container (XCL_DIRECT_DXIL=1,XCL_DIRECT_SPLIT_INSTRUCTIONS=12), verifying only.chain.psoblobs are written, warm reuse across processes, and recovery from a corrupted.chain.pso.Tested
32.0.16.1714, wave32 only), Intel Core i5-10400F, 15.9 GB RAM, Windows 11 Pro Build 26200, Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11(Windows SDK10.0.26100.0); debug for tests, release for precompile timing and smoke runs..\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4) on commit2228be7: 1274 passed, 0 failed, 46 ignored. Both new GPU tests (split_compute_program_prebuilds_and_caches_chain_piecesandoffline_split_compute_pipeline_is_reused_by_a_second_process) ran and passed on RTX 3060.SKIPPEDGPU tests (26 notices, unchanged frommain): 21 wave64/no-wave64 tests (dispatch_chain_native_wave64_builds_whole, 4lower::tests, 14lower_dxil::testswave64 cases,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware), 3 wave32 per-lane unsupported-op refusals inlower_dxil::tests(f16 arithmetic,f16 packed,f32 conversions),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows), andpso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache (Windows Developer Mode is required)).dca1b25b44878018: 1,231,896 B whole -> 14 pieces <= 156,380 B;77229ada81e6f03f: 88,704 B whole -> 2 pieces <= 89,940 B;xcl shaders <dir> --precompile --only cs --pipelines --windows 4,XCL_DIRECT_DXIL=1,XCL_PIPELINE_THREADS=4, freshXCL_DXIL_CACHE, NVIDIA implicit cache at OS default, measured on base06c9f55before rebasing onto0829441):main06c9f55:117.0 s(117.18 swall) —2unused unsplit.psofiles written,0 / 16.chain.psofiles.9.2 s(9.50 swall) —16 / 16.chain.psofiles written,0refused,0unsplit.psofiles.0.4 s(0.44 swall) —16 / 16loaded from the driver cache.Regression run
scripts/smoke.ps1 -Game <retail title> -Seconds 60, default settings, clean working trees, back-to-back on the same machine (main0829441then PR head2228be7):main:
PR:
Not tested
--pipelines).0829441(which wideneddispatch_chain_root_signatureroot constants from 4 to 8 dwords ine9ddf17; the unit and e2e GPU tests and smoke run above all ran on2228be7over0829441).XCL_HEAP_WINDOWS=1andXCL_SAMPLE_*test suites.AI use