Skip to content

GPU diagnostics: a pipeline whose creation faults is refused and the title goes on (opt-in, on #491) - #2292

Open
desplmfao wants to merge 8 commits into
Marvisak:mainfrom
desplmfao:diag/pipeline-soft-crash
Open

desplmfao wants to merge 8 commits into
Marvisak:mainfrom
desplmfao:diag/pipeline-soft-crash

Conversation

@desplmfao

@desplmfao desplmfao commented Nov 25, 2026 •

Copy link
Copy Markdown

Stacked on #491 (the pipeline journal). Its commits come first here; the change is the last commit, a690518.

Problem

Under Wine/vkd3d-proton, creating a host pipeline runs dxil-spirv and then the driver's compiler inside the title's process. On some translated shaders, one of them faults. Examples here: dxil-spirv recursing about 100k frames on #439's loop shapes, and NVIDIA's compiler crashing on others. A single bad pipeline ends the run. #491 then refuses it from the next run on, but that is one restart per bad pipeline.

Change

Opt-in, with VICTORY_PIPELINE_SOFT_CRASH=1:

  • The guard. Pipeline creation on the pipeline workers runs inside a guard (pipeline/soft_crash.rs). That covers both Load*Pipeline and Create*PipelineState.
    • A vectored exception handler acts only on an armed worker that is inside the guarded call, and only for fault-kind exceptions: access violation, illegal instruction, stack overflow and the like. Software exceptions, heap corruption (0xC0000374) and stack-buffer overrun (0xC0000409) are left alone.
    • On a fault it resumes at a small assembly frame (with SEH unwind data) that saved the callee-saved registers, MXCSR and the x87 control word. The call then returns the exception code. Rust never "returns twice": only the frames below the assembly frame are abandoned. Panics are caught inside the guard and raised again after it.
  • A faulted pipeline is refused for the rest of the run, whether or not the journal is on. Its draws and dispatches are dropped. One error line gives its shader hashes, stages, the code and the address. With the journal on, it goes into crashed.txt immediately, in the existing format plus (fault 0x…), so later runs refuse it too.
  • The worker that faulted exits and a new one replaces it, since its stack may have lost its guard page. Armed workers call SetThreadStackGuarantee(64 KiB) so the handler has stack left after an overflow. Pipeline workers get a 256 MiB stack, which is reserved, not committed.
  • After 8 caught faults the guard stops catching. From then on a fault ends the process as before, and the journal names the pipeline at the next start.

Risks

This is why it is opt-in:

  • A lock held by vkd3d-proton or the driver at the fault stays held. Later creations that need it wait, and pipelines stop arriving while drawing goes on.
  • Memory allocated by the abandoned frames is leaked. A fault caused by an already corrupted heap leaves it corrupted.
  • The vectored handler runs before the host's own handlers, but only for an armed thread inside the guarded call.
  • Under Wine, an overflow that leaves too little stack to raise the exception is aborted by Wine itself (virtual_setup_exception stack overflow). The guard can't catch that one; the bigger stack makes it less likely.

Related

Tested

RTX 5080, Linux, Proton with vkd3d-proton 3.2.0:

  • cargo test -p victory-gpu --lib soft_crash: 6 passed. They cover an access violation (0xC0000005), an illegal instruction (0xC000001D), a deep-recursion stack overflow on a 1 MiB thread (0xC00000FD), values and panics passing through, threads that aren't armed staying unguarded, and the fault-kind filter.

  • cargo test -p victory-gpu --lib journal: 8 passed, including a_pipeline_whose_creation_faulted_is_refused_now_and_in_later_runs.

  • cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without --features diagnostics: clean.

  • In the title. The build was our stack with Shaders: one console wave sharing LDS runs in the console flow on 32-lane hosts #439 but without Shaders: one back edge per block, so vkd3d-proton converts #439's loops (stacked on #439) #2309. There, vkd3d-proton's dxil-spirv recurses until the stack runs out on two of Shaders: one console wave sharing LDS runs in the console flow on 32-lane hosts #439's programs, and before this change that ended the process. Run under Proton, with vkd3d-proton 3.2.0, VICTORY_PIPELINE_SOFT_CRASH=1 and VICTORY_PIPELINE_JOURNAL=1:

    WARN victory_gpu::pipeline::soft_crash: VICTORY_PIPELINE_SOFT_CRASH: a pipeline whose creation faults is refused and the run goes on; locks or memory the host held then may be lost limit=8
    ERROR victory_gpu::pipeline::journal: creating this host pipeline faulted; it is refused, its draws and dispatches dropped, and the run goes on pipeline="32ed072b9f845048" stages="compute-3360" code=0xc00000fd address=0x6ffff0a182f5 listed=true
    ERROR victory_gpu::pipeline::journal: creating this host pipeline faulted; it is refused, its draws and dispatches dropped, and the run goes on pipeline="fdd56d97a806bcca" stages="compute-8540" code=0xc00000fd address=0x6ffff09aa2b1 listed=true
    

    Both are stack overflows (0xc00000fd) inside vkd3d-proton under Wine, caught 10 s into the run. 383 more pipelines were created after the second one, so no host lock was lost. The title kept running until I stopped it 90 s later. crashed.txt lists both, each with a # compute-… (fault 0xc00000fd) comment.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

desplmfao and others added 7 commits November 23, 2026 23:02
Some host drivers crash while compiling a translated shader. Under Wine
the fault inside vkCreate*Pipelines ends the process with exit code 3
before any handler runs, so nothing names the shader and the same crash
comes back on every run.

With VICTORY_PIPELINE_JOURNAL=1, each host pipeline is noted in
pipeline-journal/pending/ while it is created, and the note is removed
when creation returns. A note left at the next start names the pipeline
that was being created when the process ended: it goes into
pipeline-journal/crashed.txt and is refused from then on, its draws and
dispatches dropped like those of any refused pipeline. Pipelines are
created one at a time while the journal is on, so a crash names only the
pipeline that caused it. Off by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A crash with one pipeline in creation names it (crashed.txt) as before. A
crash with several in creation makes them suspects (suspects.txt): they
are not refused, but each is created alone until its creation returns, so
a repeat crash leaves one note and names it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	README.md
#	crates/victory-gpu/src/pipeline/host.rs
…refused pipelines drop draws

Suggested by YaBulochka in Marvisak#491:

- A note in pending/ is named <key>@<stages and sizes>@<pid>-<n>, for
  example 4e296b1885c37b29@compute-2232@32-23, so pending/ can be read
  without the log. The same goes as a comment above the pipeline's line
  in crashed.txt.
- At start-up, the refused pipelines are listed with a warning that
  every draw and dispatch using one is dropped. How many is only known
  once the title asks for them; each is still logged once when first
  skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fromthemoonx found in Marvisak#491 that a second instance opening the journal
refused the pipeline the first one was creating. Notes name their
process id; one whose process is still running is now skipped and kept.
The README says how to undo the refusal a quit during creation causes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…(VICTORY_PIPELINE_SOFT_CRASH)

The pipeline journal learns of a pipeline that crashes the host's
compilers (dxil-spirv's deep recursion, the driver's compiler) only after
the process has died, one restart per pipeline. With
VICTORY_PIPELINE_SOFT_CRASH=1, pipeline workers survive such a fault:

- loads and creations in `library::pipeline` run through a small assembly
  frame (`soft_crash::guarded`) with unwind data. A vectored handler,
  on an armed thread inside such a call, points the faulting context back
  at that frame, which returns the exception code. Faults of the error
  kind only (not C++ or other software exceptions; not heap corruption);
- the pipeline is refused for the rest of the run and appended to the
  journal's crashed.txt at once (with its stages, sizes and the code),
  logged once with the code and address;
- the worker that faulted hands its place to a fresh thread (its stack may
  have lost its guard page);
- after 8 faults, faults are left alone and end the process as before.

Pipeline workers also get a 256 MiB stack (reserved only), and armed
threads keep 64 KiB for handling an overflow.

Nothing between the fault and the frame is unwound: locks and memory the
host held then are lost, which is why it is opt-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPU diagnostics: VICTORY_PIPELINE_JOURNAL crash journal — a pipeline whose creation faults is refused next run, suspects isolated one-by-one (+1034 incl. README). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Ambitious self-healing for driver crashes; the 'quit during single creation looks like a crash' caveat is honest. Windows-only path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 25, 2026
@desplmfao
desplmfao marked this pull request as ready for review November 25, 2026 11:21
@desplmfao

Copy link
Copy Markdown
Author

Out of draft: it has now caught real faults in the title. Our stack with #439 but without #2309 has two programs on which vkd3d-proton's dxil-spirv recurses until the stack runs out (32ed072b9f845048, fdd56d97a806bcca); before, the process ended there. With VICTORY_PIPELINE_SOFT_CRASH=1, both were caught as 0xc00000fd 10 s into the run, refused, and listed in crashed.txt. 383 more pipelines were created after them, so no lock was lost, and the title kept running until I stopped it. Log lines are in the description.

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