Skip to content

GPU: remember pipelines whose creation crashed the process (VICTORY_PIPELINE_JOURNAL) - #491

Open
desplmfao wants to merge 6 commits into
Marvisak:mainfrom
desplmfao:diag/pipeline-journal
Open

desplmfao wants to merge 6 commits into
Marvisak:mainfrom
desplmfao:diag/pipeline-journal

Conversation

@desplmfao

@desplmfao desplmfao commented Nov 24, 2026 •

Copy link
Copy Markdown

Problem

Some host drivers crash while compiling a translated shader. Under Wine (vkd3d-proton) the fault inside vkCreate*Pipelines ends the process with exit code 3 before any handler runs (err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call), so crashes.log stays empty, nothing names the shader, and the same crash comes back at the same point on every run (#144, #49).

Change

With VICTORY_PIPELINE_JOURNAL=1, each host pipeline is noted in pipeline-journal/pending/ (next to the pipeline cache) 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 is added to pipeline-journal/crashed.txt and refused from then on, its draws and dispatches dropped like those of any refused pipeline, and the log names it. Pipelines are still created in parallel. A crash that leaves one note names that pipeline. A crash that leaves several makes them suspects (pipeline-journal/suspects.txt): they are not refused, but each is created alone (the other workers wait) until its creation returns, so a repeat crash leaves one note and names it. Deleting a line from crashed.txt lets that pipeline be tried again. Off by default; nothing changes without it.

New pipeline/journal.rs; a hook at the start of host pipeline creation in pipeline/host.rs; the folder set next to the pipeline cache in pipeline.rs; a paragraph in the README.

Tested

RTX 5080, Linux (proton-cachyos, vkd3d-proton 3.2.0), Series X 1.0.2.1, this branch alone (main d2a4bae + this commit, without #259), its own cache folder:

  1. Run 1: vkCreateComputePipelines Exception 0xc0000005 while loading; one note left, pending/ef05293f6107fc99@32-67.
  2. Run 2: at start, the last run ended while creating these host pipelines; they are refused from now on pipelines=["ef05293f6107fc99"], and crashed.txt lists it. The title got past it to the next crash, again with one note: 9938c251a313fe28.

Both are compute programs whose pipeline creation crashes the NVIDIA driver, fixed in #259. Before pipelines were created one at a time, a crash left several notes and the others had to be removed by hand.

Update: the first version created all pipelines one at a time while the journal was on. With the wave64 programs of #233/#439, which take seconds each to compile, the pipeline backlog at the loading screen shrank by about 0.1 per second instead of about 5, with seven of the eight pipeline workers idle. afedb15 creates them in parallel again and only isolates suspects.

Four tests in journal.rs (no GPU): a note left by a crash refuses that pipeline on the next start and lists it; a pipeline whose line was removed is tried again; notes left by pipelines created together become suspects, a suspect is created alone and leaves the list when it succeeds, and a suspect that crashes alone is refused; ordinary pipelines are created together. They pass under Wine; cargo clippy and rustfmt report nothing new.

Related

AI-assisted (Claude Code).

🤖 Generated with Claude Code

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>
@fromthemoonx

Copy link
Copy Markdown

Tested 24c419b merged onto current main (ffe310e, merges cleanly) natively on Windows.

Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 x86_64-pc-windows-msvc.

CI's commands, on the merge: both clippy runs (-D warnings, with and without --all-features) clean; cargo test --workspace --locked: 344 passed, 0 failed, 6 ignored. The victory-gpu lib tests also pass with VICTORY_PIPELINE_JOURNAL=1 set (52 passed).

Two ways a pipeline gets refused without having crashed anything. A throwaway test (not pushed) runs the test binary again as a child process against a temporary journal folder:

scenario result
the child calls enter("eeee…") and then exits normally (std::process::exit(0), exit code 0) at the next Journal::open, eeee… is refused and written to crashed.txt
our process holds enter("ffff…") (a pipeline being created) while another process opens the same journal the other process refuses ffff… and writes it to crashed.txt
  • Exit during creation. pending/ can't tell a crash from any other way the process ends while a pipeline is being created. Closing the window while shaders compile, ExitProcess from the title, or a crash elsewhere on another thread all leave the note. With pipelines made by worker threads during loading, quitting mid-load would blacklist whichever pipeline was in flight, permanently and with a "creating it ended an earlier run" warning.
  • Two processes. A second process (two victory instances, or victory translate --pipelines next to a running title) finds the first one's in-flight note and lists it as crashed.

Possible ways to narrow it, none of them tested here:

  • In open, skip notes whose process id (already in the file name) is still running.
  • Remove notes on a clean shutdown, or have the crash reporter confirm the crash.
  • Refuse a pipeline only after its note has been left twice. One extra crash per bad pipeline, but no permanent false refusals.

Since the journal is opt-in and crashed.txt is editable, this is about how much to trust the list rather than a correctness problem for default runs.

Smaller note: the key string (hash+hash) is built for every host pipeline even with the journal off. It's cheap next to pipeline creation, but it could move behind the journal() check.

Not tested: a real driver crash during creation (none reproduces on this GPU), Wine/vkd3d-proton; no game data used.

AI-assisted (Claude Code) ran the checks and drafted this comment.

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested 24c419b on Windows 11, RTX 5070, MSVC: cargo test -p victory-gpu -- --test-threads=1 45 passed, including the journal tests. Clippy's 1 warning is the existing one in host.rs. I couldn't reproduce a driver crash here, so the "next run refuses it" path is covered by the unit tests only.

  • Off by default: with VICTORY_PIPELINE_JOURNAL unset, journal() is None, enter is a no-op and creation stays parallel. With it on, the one mutex serialises creation so a leftover note names only one pipeline. That's the right trade for a diagnostic.
  • Notes and crashed.txt live next to the pipeline cache, which already passes ensure_outside_repo, and they hold only shader hashes. No title bytes are written.
  • Small things:
    • A pending note is only turned into a crashed.txt line at the next start. If the user deletes the cache folder between runs, the knowledge is lost, which is acceptable but worth one README sentence.
    • The ? on journal::enter makes a refused pipeline fail like any other refusal, so the existing drop logging covers it.

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…n crashed the process (VICTORY_PIPELINE_JOURNAL)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao and others added 2 commits November 24, 2026 08:11
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>
@fromthemoonx

Copy link
Copy Markdown

Re-tested 027926b merged onto main ffe310e (same RTX 3060 machine). Running pipelines in parallel and isolating only suspects is a good change for loading time.

  • CI's commands, on the merge: both clippy runs (-D warnings, with and without --all-features) clean; cargo test --workspace --locked: 346 passed, 0 failed, 6 ignored. All four journal tests pass.

  • The two cases from my earlier comment, re-run with the same throwaway child-process test:

    scenario result on 027926b
    child calls enter("eeee…") and exits normally (exit code 0) eeee… is refused at the next start and written to crashed.txt
    another process opens the journal while ours is creating ffff… it refuses ffff… and writes it to crashed.txt

    A single note still means "refused", so both still blacklist a pipeline that didn't crash. The suspects path helps when a crash leaves several notes, but quitting during loading with exactly one pipeline in flight, or a second instance, still lands in crashed.txt. Treating a lone note as a suspect too (refusing only after it is left again while created alone), or skipping notes whose process id is still running, would cover both.

AI-assisted (Claude Code); synthetic tests only, no game data.

@YaBulochka

Copy link
Copy Markdown

Confirmed on Linux/RADV, and on this title it is the difference between a hard wall and reaching the intro. Build ffe310e + #994 + this PR; Wine 11.22 in a Proton 11.0 prefix (vkd3d-proton from Proton, DXVK dxgi), RADV from Mesa 26.3.1, RX 7600 XT, VICTORY_PIPELINE_JOURNAL=1.

Three runs of the retail title, cold shader cache:

run refused pending left mesh pipelines outcome
1 1 4e296b1885c37b29@32-23 3 died while creating that compute pipeline
2 2 5 (8bb272e763f76148@32-35 + suspects) 20 past both refused ones, died on the next compute pipeline, 6.8 fps
3 2 1 3 alive, the intro's title cards render, 0.6–1.6 fps, 7.7 GB VRAM

So the mechanics work exactly as described: the note names the pipeline that ended the process, it is refused on the next start, and each run buys one more shader. After two refusals the run no longer dies in vkCreate*Pipelines at all — the remaining stop is the title's own fault at +0x23cf683 during Prestream Metadata, and before that it plays the intro. The cost is visible and honest: 20 draws/dispatches dropped for the two refused pipelines, one line per pipeline in the log.

Two small suggestions, if you want them:

  • the note carries only <hash>@<something>; adding the stage and the container size to the file name (or a sidecar) would make pending/ readable without going back to the log;
  • when a pipeline is refused at start-up, it would help to say up front how many draws/dispatches will be dropped from then on (the run-time victory_gpu::draw line does that, the start-up line does not).

I can rerun with any build you want, or hand over the two hashes with their stage and container size if you'd like to look at the shaders themselves.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. This adds an opt-in diagnostic (VICTORY_PIPELINE_JOURNAL=1), new pipeline/journal.rs. HostPipeline::new in pipeline/host.rs writes a note in pipeline-journal/pending/ while it creates a pipeline. At the next start, a single leftover note refuses that pipeline (crashed.txt), several leftover notes become suspects that are created alone under a write lock, and notes of a process that is still running are skipped. I checked:

  • with the variable unset, enter returns an empty guard and nothing changes;
  • a refusal goes through the existing Option<HostPipeline> refusal path;
  • the new code needs nothing beyond what victory-gpu already depends on (windows-sys Threading/Foundation, tempfile for tests).

Two minor points, neither blocking: a reused process id can keep a stale note until that unrelated process exits, and the README paragraph could be shorter.

On your reply: skipping notes of a running process covers the second-instance case, as a_note_of_a_process_still_running_is_left_alone shows. Keeping a lone note as a refusal is a reasonable trade-off for an opt-in diagnostic, since the README documents quitting mid-creation and deleting the line undoes it.

CI: passing (check).


Generated by Claude Code

desplmfao and others added 2 commits November 24, 2026 22:38
# 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>
@desplmfao

desplmfao commented Nov 25, 2026 •

Copy link
Copy Markdown
Author

@YaBulochka thanks for the RADV runs. Both suggestions are in afb8752:

  • A note in pending/ is now named <key>@<stages and sizes>@<pid>-<n>, e.g. 4e296b1885c37b29@compute-2232@32-23. When it becomes a refusal, the same detail goes in as a comment above the pipeline's line in crashed.txt (# compute-2232).
  • At start-up, the refused pipelines are listed with a warning that every draw and dispatch using one is dropped. The count itself can't be known at start-up, since it depends on what the title asks for later. Each pipeline is still logged once when it is first skipped.

The branch is also merged with current main again (577052a), which resolves the pipeline/host.rs conflict from the triage. The journal tests pass: 5 of 5, including a new one for the named note.

@fromthemoonx thanks for the child-process tests. 8f070ad covers the second-instance case: notes carry their process id, and a note whose process is still running is now skipped and kept, so another instance no longer refuses what the first is creating (test: a_note_of_a_process_still_running_is_left_alone). For quitting while exactly one pipeline is in flight, I kept a lone note as a refusal. Making it a suspect first would cost every real crash a second run, which is exactly what a run like YaBulochka's pays for. The README now says to delete that line from crashed.txt to undo it. The comment above the line names the stages, so it's easy to find. Journal tests: 7 of 7 pass.

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>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 25, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
…standin-111a

HLE: title-window stand-in that always pumps messages (Marvisak#491)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants