Where shader compile time goes on NVIDIA: the driver takes ~100 s per 18k-instruction CS, whatever DXC's optimisation level #1096
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#1096
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@brothernog on GitHub · 2026-11-24 11:32 UTC · original
Measured on
main67a3735(+ #640, which touches no shader code), RTX 3050 (driver 610.88), DXC 1.9.2602.17, Windows 11. Retail shader pack 1.0.2.1, a seeded random sample of 1 in 40 records (646 records → 424 VS/PS/CS variants that translate completely), runtime options (4 memory windows, split wave64 for this 32-lane GPU). Only numbers below; no shader content.1. Translation is not the cost
xcl shaders --precompilehere.2. DXC is about 2 ms per console instruction, with no hot pass
pc ==) programs cost about the same per instruction as structured ones. They are just the big ones.-ftime-reporton an 18.7k-instruction CS at-O1(22 s) shows no pass above 9%. The top passes are Dxil Delete dead loops 8.7%, Jump Threading 7.3%, Dxil Conditional Mem2Reg 5.4%, InstCombine ×8 ~25%, and loop canonicalisation/LCSSA/IndVars together ~20%.3. The driver is the wall, and it does not care about DXC's optimisation
CreateComputePipelineStateon two other 18k-instruction CS (one structured, one guarded), same device, root signature and static samplers as the runtime. These were fresh compiles at levels the runtime never uses for them, so there were no driver-cache hits.-O0halves DXC's time. Thedxc.rsnote about a 1.6 MB-O0DXIL the driver could not compile dates from before branch-free emission. Here both 2.2 MB-O0programs were built.What this suggests
-O0for big programs (currently-O1from 1 MB,-O0from 8 MB), if an AMD driver shows the same independence. This would halve DXC time on the programs that hold 60% of it. It needs a run on RDNA, and it touches #559 (the cache key omits the level).XCL_PSO_WAIT_MSand the watchdog (#232, #505) run into. Cutting it means asking the driver for less: smaller programs per console instruction. DXC's optimiser does not do that for us.Tested on: RTX 3050 / 610.88 only. It is not checked on AMD, and nothing above is changed in code yet.
AI-assisted.
@Natakout on GitHub · 2026-11-24 13:38 UTC · original
Second card for these numbers: RTX 3060 12 GB, NVIDIA driver 621.14, DXC 1.9.2609.5, Windows 11 25H2,
main47efa2e. I compiled the 5 largest compute programs of the retail pack that the driver accepts (19.8k to 24.5k console instructions), cold, with the runtime's root signature, and timedCreateComputePipelineState. Only sizes and timings here.main: 50.5 s to 125.5 s per program. Guarded programs took about 50 % longer than structured ones of similar size.-O0makes the driver 20-40 % slower on this card, which fits point 3 above: the driver gains nothing from a smaller DXC input.CreateComputePipelineState. Nothing open addresses this as far as I can tell.Not tested: AMD GPUs, other NVIDIA drivers, repeated runs.
AI use: Claude Code (claude-opus-4-6) wrote the benchmark harness, ran it on the hardware above, and drafted this comment.
@Anon64 on GitHub · 2026-11-24 15:26 UTC · original
A world-loading data point for "the driver is the wall": on this machine, in the run that hits the title's watchdog, what the title waits on is a DXC compile, not the driver.
Setup: RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release build of #253's head
f67e35a(based onmain930e8b4, so with #9a272d4/ 25c6f7e's "a compile the title waits for goes on at once"; #253 only makes the dumps safe), retail title,XCL_PRESS_A_AT,XCL_THREAD_DUMP_ATevery 5 s from 70 s. Warm DXIL and driver caches from earlier runs; preload on (default).cl_set_pipeline_state→resolve_for_bind→resolve_wait, in every dump from 90 s to 105 s.xcl-pso-pre-0(whose last log line is at 4.8 s): inbuild_compute→dxc::compile→recvfor its DXC job, in every dump from 70 s to 100 s.xcl-dxc-0: insidedxcompiler.dllin every dump from 70 s to 100 s, the same thread id each time. The other 30 DXC workers idle, apart from one short compile now and then. No thread was insidenvgpucomp64.dllbuilding a pipeline in those dumps.+0x23cf683).So here one DXC compile ran for at least 30 s (70 → 100 s; the dumps start at 70 s, so it may be much longer), the bound pipeline waited for it, and the title's watchdog fired. That fits your suggestion 1 (
-O0for big programs) better than anything on the driver side; I have not measured which program it was or its size, and have not tried-O0.Written with Claude Code (Claude Opus 5.5) from a run on this machine.
@Dezmonius on GitHub · 2026-11-24 23:50 UTC · original
Related RTX 5070 / 610.88 observation on
689f2db4(with the #1464 DirectStorage patch and local logging, Windows 10 19045, i7-7700K, 32 GiB RAM, 24 GiB additional SSD page file). In two 420 s runs and a longer diagnostic run, the same 4,321,608-byte compute DXIL entered the driver's PSO compile without a cached driver blob and never logged a finish. In the long run it started about 190 s in. The host stopped the run at 885 s when available physical RAM reached 2.43 GiB (system commit headroom still 14.38 GiB). That gives roughly 11.5 minutes without a logged finish for the large compile. Peak process commit was 39,152 MB.Other compute PSOs continued to finish while the frame count was stalled, including individual driver times of 93.3, 95.3, 111.6, and 114.3 s. The last frame dump was black after the loading artwork, and no presents were recorded in the final 350 two-second samples. This is an in-title timing observation; it does not isolate the driver compile as the cause of the render stall. No shader identifiers, binaries, dumps or game assets included. AI-assisted (OpenAI Codex, GPT-6).
@brandostrong on GitHub · 2026-11-25 04:40 UTC · original
A 4090 data point for the same wall, plus two things this thread does not have yet: what a stalled run looks like frame by frame, and how the on-disk driver-blob cache behaves around it.
Setup: RTX 4090 (driver 32.0.16.1664), i9-13900K, Windows 11 26200, rustc 1.100.0, DXC 1.9.2602.17, release build.
maincbc296a, andb8e94b2(adds frame-gap percentiles to theXCL_ACTIVITYline, no behaviour change). Same title, same 180 s window, warm DXIL and driver-blob cache from earlier runs, heap windows off.1. While frames flow the run is healthy; the stall is total.
maincbc296a: 1 901 frames shown, 0 device removals, 0 crashes, peak commit 33 336 MB.b8e94b2: 1 737 frames, gaps between shown frames p50 33 ms, p95 76 ms, max 3 759 ms, 46 gaps over 100 ms. 48 of its 89 2 s buckets have 0 presents.2. What it waits on, and the cache cycle around it.
driver blob suppliedin run 2 (4 of 4, one sharedXCL_DXIL_CACHE).console CS … msline and no refusal — so no blob is ever written for them and they aredriver blob absentin every run. A compute program whose driver compile outlasts the run is never cached and is paid from scratch every run. That is the cycle #1871 breaks, and it is why "wait for it in the run" cannot work for these.3. Where the size comes from. These are the screen-probe compute records #1278 names. Their console code is small; the translation is not (
xcl shaders shaders.rpf --export-hlsl <dir> --record-hash <hex>, 4 memory windows, split wave64):56c0cd3b82a00c6e958400d2caf0724495cc13288a27a96eThe translated DXIL cached for these three runs 10 896 240 – 29 750 209 B. The two with the ~1 500× blow-up are the two the driver never finishes; the 214× one it builds in 67–82 s. Whatever expands those two is where the driver time is, and it is far past the ~230–290 B per console instruction of §2.
4. Heap windows on this machine.
XCL_HEAP_WINDOWS=1(withXCL_DXC_THREADS=8; cold for the new form): the largest driver compile in that run was 14.4 s, and the 0.80–0.94 MB programs took 12.1 s and 11.8 s, against 67–82 s for the 1.0–1.2 MB programs without it — the same order as the 78–82 % cut reported above. That run reached 174 s of its 180 s and ended with a device removal (0x887a0006), and the three screen-probe programs were never compiled at all (their HLSL is 15–31 MB and DXC had not finished them), so it says nothing about heap windows on the giants.Commands:
.\scripts\smoke.ps1 -Game <folder> -Seconds 180for the two runs;xcl shaders shaders.rpf --export-hlsl <dir> --record-hash <hex>for the sizes;cargo test -p xcl --lib hle::d3d12x::present: 7 passed, 0 failed, 0 ignored.Claude Code, Claude Fable 5 — the numbers are from runs made here.
@Dezmonius on GitHub · 2026-11-25 05:29 UTC · original
Follow-up on the RTX 5070 (610.88): two 300 s offline runs of
cbc296abwith the same local DirectStorage late-page wait and logging-only additions. Same profile, scripted input, direct DXIL, two DXC threads, PSO preload off, DRED on and shared warm cache. The 1000 ms limit ran second.XCL_PSO_WAIT_MS=1000pso_async::title_held()trueExecuteIndirecthook entriesThe limited run logged at least 129 expiry events. Both ended at the timer with exit 0, minimum 24.79 GiB system commit headroom and no new frames after world loading. Activity counters show calls/recording, not GPU completion, and
title_held()samples any waiting title thread; the measurements do not identify which PSO or caller blocks the next frame. The existing focusedasync_compute_pso_success_and_failure_in_dispatch_and_execute_indirectsynthetic test passed once on the logging build. No game data included. AI-assisted (OpenAI Codex, GPT-6).@Dezmonius on GitHub · 2026-11-25 06:07 UTC · original
Local wait-site follow-up on RTX 5070 / 610.88,
cbc296abwith the #1464 late-page adaptation. Same offline Series X setup and warm cache as my previous report. I sampled the oldest activeresolve_waitevery two seconds and joined its pipeline key to the driver's record using XCL's one-shadershaders_keycalculation.689f2db4.cl_set_pipeline_stateinreal.rs, where it callsresolve_for_bindbefore invoking the host D3D12SetPipelineState.The six focused
pso_asynctests passed with logging enabled. No shader identifiers, game assets, frame dumps or raw logs attached. AI-assisted (OpenAI Codex, GPT-6).