d3d12: 522 host pipelines still made during play freeze the picture 1 to 2.6 s each (RTX 5080, Series S), with shaders and warm --used already complete #3103
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?
Imported from ubiquitarianism/leonida. Originally posted by ldx-007 on 2026-12-02T11:02:18Z.
What happens
Even with every shader of the title coming out of the translation cache in 1 s and
warm --useddone, an 8 1/2 minute run still makes 522 host pipelines while the title plays
(
host pipeline library saved ... made=522 loaded=2814), and each of the big ones freezes thepicture for 1 to 2.6 s while
SHADERS COMPILING: n LEFTstands next to the frame rate.Commit
30742ccb1of my forkldx-007/mandy, which is upstreammainat393901a5bplus two.github/workflows/commits only (no runtime file touched). The exe is that workflow's build ofthe
diagprofile,built-with.txt=diagnostics,dlss,mimalloc.System
Windows 11 Insider build 26300 x64, Ryzen 7 9800X3D, 64 GB, RTX 5080 16 GB (driver 32.0.16.2124),
HAGS on. Xbox Series package 1.0.2.1, Series S profile, DLSS on.
Where
pipelines
Command and steps
Started through
scripts/play-d3d12.ps1 -Game <the title's folder> -Data <a folder outside the checkout>.leonida shaders <the title's folder>\shaders.rpf, run from a window holding exactly theLEONIDA_*settings that same play start uses (taken fromplay-nvidia.ps1 -DryRun):25687 shaders in the cache, 202 do not translate, 1 s.leonida warm --used:83576 pipelines known, 2966 made before (06d3d9d172e378a7), 0 bad; 0 to make, 10 processesthen
2966 of 2966 in the pipeline library, written in 4 s.Every time the top-left line shows
SHADERS COMPILING: n LEFTthe picture stops for one to threeseconds. Every run: yes. Every run also adds a few hundred pipeline keys the next run then has to
make or load.
Output
start:
end of the same run:
Gaps between two log records of more than 0.5 s: 63, 69.1 s of a 514 s run (13 %). 36 of them
(45.9 s) are closed by a host-pipeline-made line, 19 of those for a compute pipeline. The ten
largest gaps are all of that shape:
(12 other gaps sit exactly at 1.00 s and are most likely the once-a-second reporter, so the count
above only takes what the log can attribute.)
The layer's own counts, the worst five seconds of the run:
Adding
frames x ms waiting for pipelinesover all 95 five-second samples of the run:267 thread-seconds waited for pipelines. The fps line goes from 60.1 (menus, loading) down to
0.2, 1.0 and 1.2 in those moments. Over the run
slow-pipelines.txtgrew 449 to 473 lines andearly-pipelines.txt3136 to 3704, while only 36 shader files were written to the cache duringthe whole run - so the translation is not what costs here, making the host pipeline is.
What I would like to ask
warmwithout--used(the 83576 known pipelines) the intended way to reach the steadystate? The launcher only ever runs
warm --used, so a run keeps meeting pipelines that werewritten down but never made; 2966 of them go through in 4 s, so the whole set does not look
unreasonable, but nothing says how long it takes or that it is expected.
slow-pipelines.txtalready knows which keys took over a second.Queue::push_asputs those inthe
slowdeque, which only orders what is queued already, andmake::early()starts one aheadof time only when
wanted_early(key)holds -used(), orLEONIDA_EARLY_ALL=1. Could the keysrecorded as slow join the early-start set when the device is made, so a pipeline that has blocked
a frame once is never awaited again?
LEONIDA_EARLY_ALL=1is what I would try next for a second and later visit of the same ground.Is that the expected way, or does it cost too much at start-up to be more than a debugging step?
Two warnings of the same log, both already reported
Only as another data point, not a new report: #3016 (
LOCAL dynamic descriptor slots on a capped view heap slots=499999 title_in_place=500000andhost view heap capped at 1000000; views past it read a null slot count=1245184) and #2831 (therenderer port 2: a view record in the title's heap that no store told offallback, 8683 lines of it in this log).One more observation, and a different topic (I will open its own issue if you prefer)
In the same windows, the recording threads alone spend 662 to 839 ms a frame on list calls while
the same line says
0.0 on the GPU, at a median of 4086 draws a frame (max 7195). So in the worldthe run looks bound by recording rather than by the card, and a lower render height does not help
that part; I have the 95 samples of
fps,ms/frame,list callsandwaiting for pipelinesifa separate report is wanted.
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T14:35:08Z.
finding: code walkthrough answering the three questions in #3103 (inspected against
main69cd4106c):Is
warmwithout--used(-PrecompileAll) the intended way to reach steady state?Yes.
warm --usedonly precompiles the keys already recorded inearly-pipelines.txt(3136at start ->3704at exit in your log,+568newly seen keys matchingmade=522). Any new area, LOD, or target/sampler variant encountered during play still has to be compiled on demand until it entersearly-pipelines.txtor the driver cache.Running
-PrecompileAll(leonida warmwithout--used) compiles all known keys fromknown-pipelines.binahead of time into the driver's on-disk cache. Noted3d12/apps/leonida/src/warm.rs:162-173(into_library): even with-PrecompileAll, onlyearly-pipelines.txtkeys are packed intohost-pipelines.bin(never-drawn keys are intentionally left in the driver's own disk cache because packing ~85k entries intohost-pipelines.bincausedDEVICE_REMOVEDon burst loads). Once a newly met key is in the driver cache, its firstCreate*PipelineStateduring play hits the driver cache rather than doing a 1-2.6 s cold DXIL->SASS compile.One extra caveat (
warm.rs:179-189,driver_mark): NVIDIA keys its shader cache by executable filename, so if Smooth Motion is active on your launch (leonida_sm.exe), runningleonida.exe warmmanually populatesleonida.exe's driver cache rather thanleonida_sm.exe's; launching with-PrecompileAllthrough the script keeps them aligned.Should
slow-pipelines.txtjoin the early-start set?Yes -- open PR #3132 (
D3D12-PIPELINE-WAIT-AND-SLOW-EARLY) directly implements this alongside per-pipeline waiter wakeups and priority donation for live draw/dispatch waiters over background early compiles.Should
LEONIDA_EARLY_ALL=1be used for normal play?No -- as noted in
d3d12/crates/leonida-gpu/src/pipeline/known.rs:10-13, starting all ~84k pipelines in-process inside the running game has crashed inside the driver compiler and causes heavy startup CPU/RAM contention. Out-of-processleonida warm(-PrecompileAll) is the intended path because a hanging or crashing driver compile only kills one child worker and records that key inwarm-bad.txt.On the extra observation (
list calls 839.3 ms ... 723.5 ms waiting for pipelines; 0.0 on the GPU):In those windows,
list callsis summed across all recording threads and includes the723.5 msblocked on those synchronous pipeline compiles; while recording threads stall on compiles, the GPU queue drains to0.0 ms. Checking a steady-state 5 s window wherewaiting for pipelinesis0.0 mswill separate real recording-thread overhead from compile-wait inflation (if you still see high recording ms with0.0 mspipeline wait, a separate issue with those steady-state samples would be useful).AI-assisted: yes (Antigravity).
Imported from ubiquitarianism/leonida. Originally posted by daxtron2 on 2026-12-03T03:54:55Z.
Another data point, with
-PrecompileAll(the launcher's default, which precompiles every known pipeline) instead ofwarm --used. Pipelines thatwarmhad precompiled still got compiled again in play, so on my setup the driver's disk cache isn't keeping whatwarmputs into it. That also bears on question 1 above:-PrecompileAlldidn't get me to a steady state.Setup:
mainat2791b7756,diagbuild (diagnostics,dlss,mimalloc), started throughLauncher.batandplay-nvidia.ps1with Series S and DLSS. There's noleonida_sm.exein the build folder, so precompile and the game both ran asleonida.exe. RTX 5080 16 GB, driver 621.47, Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 26200. Shader Cache Size is Unlimited in the NVIDIA control panel. I may have changed that while run 2 was still going; it was set before run 3 started.I played the same save three times in one evening, from the intro cutscene into the prison prologue. Run 1 had no log, so the table covers runs 2 and 3.
warmhad recorded as made (warm-done.txt)host pipeline library loadedlibrary savedat the endTo check whether the slow ones had been precompiled, I compared keys across the cache files (counts only):
early-pipelines.txtwent from 2,600 to 3,360). 709 of them were inwarm-done.txtfrom that run's own precompile, including both pipelinesslow-pipelines.txtgained in run 3, at 1.9 s and 2.5 s to make.slow-pipelines.txt(median 1.8 s, p90 4.2 s, max 19.8 s) were inwarm-done.txt. That file includes earlier runs, so I'd weigh it less than the run 3 numbers.warmmarked them done without building them, or it built them and the game asks for something that doesn't match. I don't have that run'sN made in X ssummary line to tell which. I'll grab it next run.#3132 (starting slow keys early) and #3150 (building drawn pipelines straight into the library) would cover pipelines that have been drawn before. Neither helps a precompiled pipeline that has never been drawn and misses the driver cache the first time it's used.
AI-assisted (Claude Code). Numbers come from my own logs and cache files; no game data.
Imported from ubiquitarianism/leonida. Originally posted by kaoru-maki on 2026-12-03T05:28:28Z.
With #3172, full warm-up attempts every PSO key recorded before warm-up. Could the first-use report show whether the key was in the warm-up snapshot, what happened during warm-up, and whether the runtime loaded or compiled it? It would also help to record how long the first caller waited.
Synthetic test. A is warmed and ready at first use. B is a new render-target-format variant that is first compiled on demand. C is warmed, then its runtime library lookup is forced to miss and it is compiled again. The report should distinguish all three cases.
Imported from ubiquitarianism/leonida. Originally posted by kaoru-maki on 2026-12-03T05:28:31Z.
A shutdown and reload test would help document
LEONIDA_LIBRARY_PLAY_SAVE_MB. The threshold applies to writes during a run. A library above that threshold should be saved on clean exit and available for the next launch.Synthetic test. Use an isolated cache directory and set the in-session write limit to zero. Create one synthetic PSO, exit through the normal shutdown path, and wait for shutdown to finish. Restart on the same device and assert that the PSO loads from the saved library.
Imported from ubiquitarianism/leonida. Originally posted by sdpiter on 2026-12-03T08:44:17Z.
Another data point after a full
warm(no--used), plus a same-machine control from another runtime of the same title.Machine. Windows 11 26H2 (26300.9974), Ryzen 7 5700G, 32 GB RAM, RTX 4070 Ti 12 GB, driver 621.40. NVIDIA Shader Cache Size = Unlimited (set before the warm).
Build. Upstream
maind9b618f10150f275c30088e4769c1acbf1d8d689(includes #3154 and #3230), built from source withd3d12/scripts/build-nvidia.ps1:diagprofile,built-with.txt=diagnostics,dlss,mimalloc, its own cache folder.Steps.
leonida shaders <the title's folder>:25783 shaders in the cache, 202 do not translate, 131 s.leonida warm(full):83553 pipelines known, 0 made before, 0 bad; 83553 to make, 8 processes83553 made in 1978 s (7 have no host pipeline, 0 ended their process); ms each: median 2.2, p90 284.1, p99 4775.3, most 23778.leonida.exe run <title> --execute --console series-x; Series X profile, 2560x1440 output, the title's own dynamic resolution from 0.75,LEONIDA_FRAME_GEN=0(frame generation off), DLSS not used,LEONIDA_THIN=1on 6 threads. 13:02, closed withWM_CLOSE, exit0x00000000.What the run still made. At exit:
host pipeline library saved bytes=296114760 early=3059 made=493 loaded=2595 started_early=2393— 493 host pipelines made while the title played, after the full warm and with the driver cache Unlimited.
Freezes. 129 periodic in-world frame lines (more than 1000 draws): 18 frames over 500 ms, worst 6.3 s; in-world median 56.7 ms at 5.0–7.5k draws. The runtime's own summary in one window:
frame times over 13.0 s, 96 frames: median 48.6 ms, 95th percentile 64.9, 99th 8241.8, longest 8241.8; 1 over 100 ms, 1 over 1 s.Two examples, with the lines around them:
08:06:54.829 4738 ms, 4454 drawsand08:07:05.017 5094 ms, 4458 draws— the twelve lines before each are the runtime's periodic reports only, no pipeline line among them.08:13:01.207 first bind pipeline=... stage="compute"→08:13:01.482 host pipeline shaders=[compute b01e713adfd1b66a]→08:13:05.195 host pipeline shaders=[compute 592680ab38031b20]: one compute build spans about 3.7 s of log.08:13:10.774 host mesh pipeline shaders=[mesh 8a1dba33b00fc298, pixel 428832e0a62f137f masked]— a masked variant built during the same stretch, which matches the masked-twin finding in #3105 (and #3200).Control: another runtime of the same title, same PC, same day. Darner
v2026.12.02.02(fa84f7e6, built from source), DLSS off, frame generation off, its ownwarm(73536 pipelines known,66596 made in 950 s), 12:50 in the world, exit 0. There: 2 frames over 500 ms, worst 1.0 s (host pipelines all made made=78 loaded=2239 started_early=3911), and the two stalls reada pass over the screen was waited for (DARNER_SCREEN_WAIT_MS=0: dropped past half a second a frame) ms=4828 made=true.Caveats. The two runtimes were not on the same camera/scene, so this is not a speed A/B. Mandy drops about 210 draws a frame on purpose in this configuration (skip list and the structure builder off), Darner drops 0, so equal draw counts are not equal work. Card use: Mandy 9.7 of a 10.7 GB budget; Darner 11.7 of 10.9 GB plus 5.1 GB shared.
What I take from it. A full
warmdid not reach a steady state here either, and the freezes that remain line up with #3103's on-demand host pipelines and with #3105/#3200's masked twins. The sibling runtime, whose warm also fills its own pipeline library and which builds 78 host pipelines during the run, does not show them — so it looks less like the driver cache and more like where and when the pipeline is built. Happy to run a build with #3200 or any diagnostic switch you point at (stall timeline,LEONIDA_PIPELINE_WAIT_MS) and report the same numbers.