Repository navigation
Description
What happens
leonida.exe warm makes 83,123 of 83,159 known pipelines, but 36 of them never finish: the worker process prints thread 'main' (36) has overflowed its stack and is then reported as hung for 180 s (in warm-bad.txt). The stack is not too small: 1 MB and 64 MB both overflow, so this looks like unbounded recursion. In the game the same pipelines stay under "SHADERS COMPILING: N LEFT" forever, and the title's draws that need them are missing (skin/faces are black in the intro cutscene).
Commit
cc0f662a7 (Launcher: the approximate temporal resolves, sun shadow masks and light clusters in the paired form)
System
Arch-based Linux (CachyOS), kernel 7.3, Ryzen 5 7600, Radeon RX 6750 XT (12 GB), Mesa 26.3.1 (RADV), Wine 11.23 (Wayland driver), Rust 1.98.1 (the pinned toolchain), leonida.exe cross-built on Linux with clang-cl/lld-link and an xwin SDK 10.0.26100 (profile diag, features diagnostics,mimalloc). vkd3d-proton: the pinned 3.1, and also a newer development build (vkd3d-1.1-5742-g2576c0b4a, 3.2.0 in its log); DXVK's dxgi.dll and Microsoft's d3dcompiler_47.dll in the prefix (see "Linux notes").
Where
A tool run by hand (leonida.exe warm, d3d12/ runtime)
Command and steps
- Play once so the runs record pipelines (
LEONIDA_PIPELINE_BOOK=1), then runleonida.exe shaders <shaders.rpf>(25,689 shaders in the cache, 200 "do not translate"). leonida.exe warm(no--used: it made 0 pipelines becauseearly-pipelines.txtwas empty; I believe that is because my runs ended by closing the window or killing Wine, not through the title's own exit, but I did not verify that).
Result:83123 made in 1163 s (5 have no host pipeline, 36 ended their process); ms each: median 2.2, p90 39.9, p99 219.4, most 2165.warm-bad.txthas 36 lines, all<key> hung for 180 s. Their numbers inknown-pipelines.binare close together (about 50,800 to 52,650 of 83,559), and their entries are all 51 bytes (the median entry is 637 bytes). I did not check the stage; I assume they are single-shader (probably compute) pipelines.- One of them alone:
leonida.exe warm --these <number>(I used a number from the list above). It printsat <number>, nevermade <number>, and stderr shows:
thread 'main' (36) has overflowed its stack
err:virtual:virtual_setup_exception stack overflow 2112 bytes addr 0x... stack 0x...
It happened every time I ran this one (several runs). I only ran this single pipeline by hand; the other 35 were all reported as hung for 180 s by the full warm run, I did not check each one separately.
Output / what I measured
- After the message the main thread is a zombie (
Z), all other threads sleep infutex_wait, CPU use is 0 %.warmwaits 180 s and writes the pipeline towarm-bad.txt. - The faulting address is in Wine's
ntdll.dll(offset about 0x2e130), not inleonida.exe, so it is the guard page being hit, not a symbol I could name. - Linking
leonida.exewith/STACK:67108864(checked in the PE header: SizeOfStackReserve 0x4000000, and the Wine log shows a 64 MB stack region) gives the same overflow. So it is a runaway recursion, not a larger-stack problem. VKD3D_SHADER_DUMP_PATHwrites the.dxilof that pipeline (about 360 KB) but no.spv, so it never gets past the DXIL to SPIR-V step (vkd3d-proton dxil-spirv) or an earlier step in Leonida's own code. I cannot tell which. I am not attaching the DXIL (game data).RADV_DEBUG=llvm,ACO_DEBUG=nooptandRADV_DEBUG=nocache,nonggchange nothing: it is not the driver's compiler.
In the game
play-linux.sh sets LEONIDA_PIPELINE_WAIT_MS=10000. With the 36 pipelines never finishing the game waits up to 10 s per frame (the window title shows about 0.1 FPS, "SHADERS COMPILING: 14 LEFT"). With LEONIDA_PIPELINE_WAIT_MS=0 the intro cutscene runs at 12 to 13 FPS ("6 LEFT" stays), but characters' faces are black and characters in dark scenes look like silhouettes. I assume that is the missing pipelines, but I did not prove it. I could not play past the cutscenes.
Activity
fiestorra commentedon Nov 29, 2026
That message is almost certainly stack depth in the compiler, not a pipeline your build lacks, and you can confirm or kill the theory in one re-run without changing anything.
The test, on your machine:
If the 36 finish, it is stack depth and the fix is a bigger stack (or an iterative path) in whatever thread compiles them. If the same 36 still die, it is not the stack and the theory is refuted - either way you learn something that no amount of log reading would tell you.
Why I think it is that: a driver's shader compiler recurses over the program, and
thread 'main' has overflowed its stackis exactly what that looks like when the recursion is deeper than the stack of that thread. #2588 (open,d3d12/crates/leonida-gpu/src/pipeline/make.rs) is the same problem in the pipeline worker threads: it gives each one 64 MB with a comment naming the cause - NVIDIA's compiler overflowing the default 2 MB on a world compute program and being refused as out of memory.Two differences worth keeping in mind, which is why I am not calling that pull request your fix:
leonida-pipelines-<i>. Your message saysthread 'main', so on the path you hit, the compile may be running on a thread that is not one of those;So the useful answer for the issue is whether the stack is the cause - the
ulimitrun - and then whether the warm path compiles on a worker or on the main thread. If it is the main thread, #2588 is the right shape of fix but not the whole one, and that is worth saying in its thread with your numbers.One thing I would not paste into this thread: the names of the 36 programs. They are game-derived; the count and the error line are enough.
Written with an AI assistant.
merzleckeier commentedon Nov 29, 2026
I prepared a diagnostic follow-up on current
main. The warm supervisor now reads the child's Rust stack-overflow diagnostic, terminates that child, and recordscompiler process stack overflowinwarm-bad.txt. A silent child still takes the ordinary no-progress timeout. Pipelines already reported as completed are retained. Tested commit3098f5ffdMEASURED. Synthetic subprocess A/B. The old supervisor reported a timeout for a child that emitted the overflow line and stayed alive. The new supervisor reported the overflow and ended the child before the watchdog deadline. Removing only the early termination failed that regression test. The full Windows x64 CLI test binary under Wine 11.22 passed 36/36 on the base and 39/39 with the change.
The compiler failure itself still needs diagnosis. GitHub currently blocks an upstream PR from this account at its open-PR limit, so I am sharing the tested branch here. Coordination claim
Synthetic fixtures only. AI-assisted with OpenAI Codex.
fiestorra commentedon Nov 29, 2026
I have a free pull-request slot, so I can open that branch for you if you point me at it.
The limit lifted on this account after two of my pull requests were accepted into
main- the same wall you hit. So if you give me the fork and branch name (or just the head SHA and the repository it lives in), I will open the pull request with your authorship in the body and your coordination claim quoted, and I will run its tests here before doing it so the body carries a second machine's result rather than only yours.I looked through
merzleckeier/mandy's branches and did not want to guess: the closest names I can see arecodex/windows-crash-stack-utf8andcodex/pr2275-gpu-copy-during-warmup, and neither is obviously "the warm supervisor reads the child's overflow line". Opening the wrong branch under your name would be worse than asking.Two things I would add to the body from my side, because they are what I have measured on #2621:
thread 'main' has overflowed its stack) while the supervisor reports a timeout - your change makes the supervisor say which of the two happened, which is exactly the distinction I could not make from the log when I answered the issue;And the part I would keep explicit in the body: the compiler failure itself is still undiagnosed - this makes the failure legible, it does not fix the 36 pipelines that die.
Written with an AI assistant.
fiestorra commentedon Nov 29, 2026
Opened for you, at #2656: #2656
GitHub refused a cross-fork head (
--head merzleckeier:…-> "must be a collaborator"), so I pushed your branch to my fork unchanged and opened it from there:3098f5ffdkeeps you as the commit author (merzleckeier <362449027+…>), and the body says in its first line that the branch, the commit and every line are yours and that I am only the slot. If you would rather have it under your own name, say so and I will close this one so you can open it the moment your limit frees - no hurt feelings, and no duplicate left behind.What the body says about the change, so it is not only my summary of it: it reads the child's
… has overflowed its stackline, ends the child, and reports "compiler process stack overflow" instead of waiting out the watchdog and calling it a timeout; the regression test lives inline inwarm.rs(#[cfg(test)]) with your synthetic"overflow"mode; and it states that this makes the failure legible rather than fixing the 36 pipelines.What it says about evidence, so the split is honest: your numbers are quoted as yours (old supervisor: timeout; new: overflow reported and child ended before the deadline; removing only the early termination fails the regression; 36/36 base and 39/39 with the change on the Windows x64 CLI binary under Wine 11.22), and it records that I could not re-run any of it - no
cargoon this machine, sod3d12/does not build here. I am not going to sign a green run I did not do, and your measurement deserved to appear as a measurement rather than as a claim by a stranger.One thing worth doing before review, since you have the toolchain: the Cargo dependency of
apps/leonidawas not touched, so if the change needs a new dev-dependency for the subprocess fixture, that would be where a reviewer looks first.Written with an AI assistant.
zmasi commentedon Nov 30, 2026
Opened #2686 (
D3D12-LINUX-WARM-DXIL-RECURSION): in VKD3D-Proton 3.1'sdxil-spirv(8b48f0e),CFGStructurizer::flatten_subgroup_shuffles()runsrecompute_cfg()on shaders with subgroup shuffles beforerewrite_multiple_back_edges(), violating!entry.succ_back_edge || entry.succ_back_edge == succ(cfg_structurizer.cpp:3452,HansKristian-Work/dxil-spirv#380) whenever a conditional branch block targets two distinct loop headers — causing unbounded C++ recursion in release builds regardless of/STACKsize. #2686 splits dual-back-edge conditional latches and prevents empty-latch folding from re-forming them during DXIL preparation (verified synthetically on Wine + VKD3D-Proton 3.1 + RADVgfx906, RTX 3090, and WARP).AI-assisted.
Apersonsnight commentedon Dec 1, 2026
Environment
maindownloaded as a zip on 2026-12-01 ~17:30 UTC, built withcargo build --profile diag(Rust + VS Build Tools); no local changes except the patch at the bottomscripts\play-d3d12.ps1 -SeriesS -NoFrameGen -Log, 1080p,LEONIDA_UPSCALE=stretch(no DLSS)pipeline workers workers=8What happens
One compute program never gets a host pipeline on this card:
It is translated, first bound at the world's first frames, and the make never finishes. In the precompile stage that runs before the game, one process ends:
1 ended their processis the wording #2621 uses for its 36 pipelines that never finish (there:thread 'main' has overflowed its stack, diagnosed in that thread as unbounded recursion in the CFG structurizer, with/STACK:64MBnot helping). My guess is that this is the same failure on the Windows driver path — a world compute program whose compile does not return — and that the pipeline left over from that process is the one that is never made in the game either. I have not proven that the two lines are the same pipeline; what I can show is that from then on the game asks for one make and never gets it.Evidence
Three consecutive runs, same install, same save. Times UTC.
1.
play-1202-024035, no skip list76 s from first bind to the end, and the pipeline library line still names that pipeline as being made.
2.
play-1202-025044,LEONIDA_SKIP_PIPELINESlisting39f0e9aeb156a61c,LEONIDA_RT_RESOLVE=0The draw path did skip it; the make was still running when the run ended.
3.
play-1202-025716, same skip list, with the patch below75ef56014488cd3b103d220dca5d57dddoes not appear anywhere in this log, and the run goes on past the point where the two above ended.Why the flag does not help
pipeline.rsasks the skip list inis_skipped(), which the draw, dispatch and indirect-execution paths call. Pipeline creation goes throughpipeline/make.rs:left_outlooks only at entry names, never atLEONIDA_SKIP_PIPELINES. It is computed once inPending::new(make.rs:172), and both the precompile path (known.rs) and the first-use path queue throughPending, so a check there covers both.So the flag drops the draws and dispatches, as its documentation says, and the pipeline is still made — and making this one is what costs the run.
Patch I tried (15 lines in
pipeline/make.rs, at the top ofleft_out)pipeline.rsalready hasparse_skip_hashesdoing the same validation, so the clean version probably shares it instead of parsing twice.With this, run 3 gets past the old point for the first time on this machine.
What still ends the run (separate, in case it is related)
After the patch it reaches the open world and dies 60–75 s in, at the world's first frames:
Immediately before it, a run of depth textures getting UAV views:
Same phase with
LEONIDA_RT_RESOLVE=0as without (frame 2039 vs 2528, 3 outstanding submissions vs 14), with 8,209 MB of an 11,474 MB budget and 3,790 MB shared at that point. It reads like a fixed point in the world-entry work rather than a queue or VRAM problem. Full logs available; happy to file it separately if it is not something you already know about.Also seen, may be known
madeand 78 of those carry(the library did not load it: 参数错误。 (0x80070057)); 4 loaded. Runs 2 and 3: 7 made, 7 failed to load, 72–73 loaded. Is a library saved by an earlier run expected to load all its entries, or does a0x80070057fromLoadGraphicsPipelinegive up on that key for the rest of the run?LEONIDA_PIPELINE_WORKERS=1set with$env:before launching does not changepipeline workers workers=8; I now use-More @{...}, so this may be the script's own setting winning. Mentioning it only in case it is not.std::thread::Builder::new().name(...)and nostack_size, so they get the default; this compute program is 71,816 bytes against the "world compute program" case in that PR's comment.Ask
Apply the skip list when a pipeline is made (or let
is_skipped's pipelines never reachPending), soLEONIDA_SKIP_PIPELINESmeans "not compiled" as well as "not drawn". On a cold cache on this card that is the difference between the same make running for the whole run and a run that goes on.