Skip to content

GPU: a stuck pipeline is not waited for, and pipeline workers get a 64 MB stack - #37

Open
LloydNicholson wants to merge 1 commit into
DexNom:mainfrom
LloydNicholson:dexnom/stuck-pipelines
Open

LloydNicholson wants to merge 1 commit into
DexNom:mainfrom
LloydNicholson:dexnom/stuck-pipelines

Conversation

@LloydNicholson

Copy link
Copy Markdown

A pipeline whose compile never comes back is no longer waited for.

Under Proton, three of the title's compute programs overflowed their worker's stack inside vkd3d-proton's DXIL to SPIR-V conversion. The worker was gone, the pipeline stayed "being made", and every frame then spent its whole 12 s budget on it.

  • A pipeline in the making for longer than VICTORY_PIPELINE_STUCK_S (15 s by default) is logged once, not waited for, and one worker is started in place of its own. A compile that is only slow is still used once it is made.
  • Pipeline workers get a 64 MB stack. This part is by Peppacodes (co-author).

Related: #28 lowers the wait to 500 ms per frame under Wine for the same symptom. This does it per pipeline, on every system, and leaves the budget for other pipelines alone. The companion PR on loop back edges removes the cause for the three programs seen here.

Worth a look in review: this changes Windows too. A compile slower than 15 s is not waited for there any more either, and each such compile starts one extra worker.

Tested on Linux: Radeon RX 9060 XT (RADV), CachyOS Proton.

  • New test a_stuck_pipeline_is_not_waited_for_and_its_worker_is_replaced.
  • victory-gpu unit tests under Proton: main 187 passed, 1 failed; with this change 188 passed and the same 1 failed (a_rejected_blob_gives_an_empty_library, an older Proton problem with a PR of its own).
  • Run in the game as part of a larger Linux branch on 921d8d3; frame rate was not measured for this change alone.

Not tested: Windows (no run and no build there; it was cross-built for x86_64-pc-windows-msvc from Linux), NVIDIA.

cargo clippy --workspace --all-targets --locked -- -D warnings, the same with --all-features, and cargo xtask policy are clean. No game data. AI-assisted.

🤖 Generated with Claude Code

A pipeline in the making for longer than VICTORY_PIPELINE_STUCK_S (15 s) is
not waited for and its worker is replaced. Three compute programs overflowed
their workers' stacks under Proton and every frame then waited its whole 12 s
on them. Ported from victory-fork 36a8541; the stack from a240d4b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Peppacodes <360593343+Peppacodes@users.noreply.github.com>
clquwu added a commit to clquwu/leonida-ultimate that referenced this pull request Nov 25, 2026
… & stuck-PSO quarantine

- Align defer_free_slab() and non-host-import page-bitmap retirement with defer_destroy() at submitted_retire_ticket() + 1 and reclaim slabs in before_execute to eliminate image-memory UAF.
- Protect GpuPageBitmap reserved arena prefix [0, kArenaReserved) (pages 0x00..0x18), add verify_control_magic() clobber detection/restoration in before_execute and device-fault reporting, and print non-shader-VA guidance when fault addresses fall outside the arena and tracked buffers.
- Port DexNom/VIctory#37 (GPL-3.0): 64 MiB compile worker stack reserve, StuckPipelineTracker + LEONIDA_PIPELINE_STUCK_S (default 15 s, 0 disables) quarantine with bounded replacement worker spawning and seamless late-completion adoption across graphics/compute PSO paths, and cold-frame graphics compile wait headroom.
@andrewDoing

Copy link
Copy Markdown

I reproduced a remaining synchronous timeout gap on Windows at 16e7f81. A worker held the real Pending.made OnceLock initializer with its start time set. The first now() call entered before a 50 ms test threshold and remained blocked after 250 ms. At that point stuck(p) was true and a second now() returned promptly; the first returned only when the test released the worker.

make.rs:339–345 checks stuck once before entering p.make() / get_or_init, so a caller already waiting cannot recheck the timeout. builder_runs calls this while holding BUILDER (pipeline.rs:312–323), potentially blocking other builder operations as well. The existing test calls now() only after the threshold. A bounded or periodically rechecked wait when another worker owns initialization may be needed.

This is a controlled concurrency test, not a real driver hang or gameplay result. Verification was AI-assisted with GPT-6.2 Astra.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants