GPU: remember pipelines whose creation crashed the process (VICTORY_PIPELINE_JOURNAL) #491
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!491
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-491"
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?
@desplmfao on GitHub · 2026-11-24 04:03 UTC · original
desplmfao:diag/pipeline-journal→main· +776 −0 · 4 files · 11 commits · openProblem
Some host drivers crash while compiling a translated shader. Under Wine (vkd3d-proton) the fault inside
vkCreate*Pipelinesends the process with exit code 3 before any handler runs (err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call), socrashes.logstays 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 inpipeline-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 topipeline-journal/crashed.txtand 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 fromcrashed.txtlets 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 inpipeline/host.rs; the folder set next to the pipeline cache inpipeline.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 (
maind2a4bae+ this commit, without #259), its own cache folder:vkCreateComputePipelines Exception 0xc0000005while loading; one note left,pending/ef05293f6107fc99@32-67.the last run ended while creating these host pipelines; they are refused from now on pipelines=["ef05293f6107fc99"], andcrashed.txtlists 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.
afedb15creates 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 clippyandrustfmtreport nothing new.Related
VICTORY_SHADER_DUMPwrites the container and DXIL of a shader by the same hash, for looking at what the journal names.crashed.txtwould belong in one for a driver crash under Wine.AI-assisted (Claude Code).
🤖 Generated with Claude Code
@fromthemoonx on GitHub · 2026-11-24 11:09 UTC · original
Tested
24c419bmerged onto currentmain(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. Thevictory-gpulib tests also pass withVICTORY_PIPELINE_JOURNAL=1set (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:
enter("eeee…")and then exits normally (std::process::exit(0), exit code 0)Journal::open,eeee…is refused and written tocrashed.txtenter("ffff…")(a pipeline being created) while another process opens the same journalffff…and writes it tocrashed.txtpending/can't tell a crash from any other way the process ends while a pipeline is being created. Closing the window while shaders compile,ExitProcessfrom 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.victoryinstances, orvictory translate --pipelinesnext 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:
open, skip notes whose process id (already in the file name) is still running.Since the journal is opt-in and
crashed.txtis 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 thejournal()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.
@fromthemoonx on GitHub · 2026-11-24 13:34 UTC · original
Re-tested
027926bmerged ontomainffe310e(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 fourjournaltests pass.The two cases from my earlier comment, re-run with the same throwaway child-process test:
027926benter("eeee…")and exits normally (exit code 0)eeee…is refused at the next start and written tocrashed.txtffff…ffff…and writes it tocrashed.txtA 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 on GitHub · 2026-11-24 18:45 UTC · original
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, DXVKdxgi), RADV from Mesa 26.3.1, RX 7600 XT,VICTORY_PIPELINE_JOURNAL=1.Three runs of the retail title, cold shader cache:
4e296b1885c37b29@32-238bb272e763f76148@32-35+ suspects)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*Pipelinesat all — the remaining stop is the title's own fault at+0x23cf683duringPrestream 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:
<hash>@<something>; adding the stage and the container size to the file name (or a sidecar) would makepending/readable without going back to the log;victory_gpu::drawline 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.
@Marvisak on GitHub · 2026-11-25 00:21 UTC · original · edited 2026-11-25 18:41 UTC
Automated triage for the maintainers.
Merge candidate (re-checked on
16200ab). The PR adds an opt-in diagnostic,VICTORY_PIPELINE_JOURNAL=1, incrates/victory-gpu/src/pipeline/journal.rs. WhileHostPipeline::newcreates a pipeline, it writes a note inpipeline-journal/pending/. At the next start, a single leftover note refuses that pipeline: it goes intocrashed.txt, which is tied to the translator hash. Several leftover notes become suspects, and each suspect is created alone for at most 5 s. Notes from a process that is still running are skipped. With the variable unset, nothing changes. No dependencies change.New since the last review (
f4f3364): inJournal::release, only a suspect's own return restarts thealone_forwindow. Before, any shared pipeline returning restarted it. This closes the gap noted last time, where the 5 s bound could stretch while in-flight pipelines drain. The window is still set when a suspect starts waiting (take_alone). It is cleared when no suspect holds or waits.blocks/leftbound every wait. By my reading the gate logic intake_shared,take_aloneandreleaseis consistent. The new testa_waiting_suspect_does_not_restart_its_window_as_others_returnexercises the case.On your reply:
16200abaddresses the window restart as described.CI: passing (
check).Generated by Claude Code
@desplmfao on GitHub · 2026-11-25 03:53 UTC · original · edited 2026-11-25 03:54 UTC
@YaBulochka thanks for the RADV runs. Both suggestions are in
afb8752: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 incrashed.txt(# compute-2232).The branch is also merged with current
mainagain (577052a), which resolves thepipeline/host.rsconflict 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.
8f070adcovers 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 fromcrashed.txtto undo it. The comment above the line names the stages, so it's easy to find. Journal tests: 7 of 7 pass.@desplmfao on GitHub · 2026-11-25 13:35 UTC · original
Added
3d6521bafter finding a weakness of this PR in the title: entries incrashed.txtnever expired.What happened: under a build from this morning,
CS_Prop_BatchNoCullandCS_LaserLightShadowRaytracingoverflowed the stack while being made (Grand Theft Auto VI on Linux; the overflow was caught by #2292). The journal listed them, and from then on it skipped them in every run, including later builds where they are made without trouble. I checked that with a cold pipeline library, an empty vkd3d cache and the NVIDIA disk cache off. Their dispatches were dropped for hours for no reason. I only noticed because the frame lines kept naming the same two hashes asrefused.The change:
crashed.txtnow starts with# translator <hash>(victory_shader::SOURCE_HASH), naming the translator its pipelines crashed under.Three new tests cover these cases, and the existing ones now expect the header line.
cargo test -p victory-gpu --lib pipeline::journalgives 10 passed under Wine on an RTX 5080, and clippy is clean.The trade-off: a driver or vkd3d update doesn't change the translator hash, so it doesn't re-arm the list on its own. Deleting the line still does that, as before.
@desplmfao on GitHub · 2026-11-25 16:18 UTC · original
A bug fix found in the title, in
9bcd755: the gate could deadlock.Pipeline creation holds the gate until it returns. A pipeline made inside another pipeline's creation (a helper made on the same thread) took the gate a second time. If a suspect held it alone, the thread waited on itself. If the gate was held shared while a suspect waited to hold it alone, the second shared take waited behind the suspect, because SRW locks give a waiting writer priority. In Grand Theft Auto VI on Linux, pipeline creation stopped at 1,721 pipelines being made, at 0 % CPU, for minutes, with 9 suspects listed from runs stopped mid-creation.
A thread now takes the gate once. Nested creations are still noted, so a crash inside one is still named. The new test
a_nested_pipeline_does_not_take_the_gate_again(a suspect makes a helper pipeline) times out after 5 s without the fix and passes with it. The tests that simulate a crash withmem::forgetnow go through a smallcrash()helper that also clears the thread's hold, as a real crash ending the thread would.pipeline::journalgives 11 passed under Wine, and clippy is clean. #2292 has it merged.@desplmfao on GitHub · 2026-11-25 16:42 UTC · original
A second fix from the title, in
f4f3364: a suspect now holds other pipelines up for at most 5 s.A suspect is created alone, so a crash in it is pinned on it. But every other pipeline then waited for as long as that took. In Grand Theft Auto VI the title screen ran at 500 ms per frame, with 1,714 pipelines being made and none finishing. The journal's only note was a suspect (
compute-3360) pending since launch, at 0 % CPU: it was not compiling at all. Its creation was waiting on another thread that itself needed the gate, which is the cross-thread version of the deadlock fixed in9bcd755. Even without that, a large compute shader on a cold driver cache takes minutes, and the title waits for the pipelines queued behind it.The gate is now a mutex and condition variable instead of an
RwLock. A suspect holds it alone, or waits to, for at most 5 s, and then the others go ahead. If the run ends after that, the suspect is one of several pipelines being created and stays a suspect instead of being refused. The new testa_slow_suspect_holds_others_up_only_for_a_whilechecks the bound.pipeline::journalgives 12 passed under Wine, and clippy is clean. #2292 has it merged.@desplmfao on GitHub · 2026-11-25 16:51 UTC · original
A follow-up to
f4f3364, in16200ab: in the title, the 5 s window restarted every time an ordinary pipeline returned while a suspect was waiting. A suspect waiting behind a busy queue therefore held every pipeline up again and again. All 7 pipeline threads slept while 2,200 pipelines waited, and the queue drained at about 80 a minute.Now only the suspect's own return starts the next suspect's window. The new test
a_waiting_suspect_does_not_restart_its_window_as_others_returnholds six pipelines, lets a suspect wait, and returns the six one by one. Before this change a new pipeline waited 601 ms; now it waits under 500 ms (a 300 ms window plus scheduling).pipeline::journalgives 13 passed under Wine, and clippy is clean. #2292 has it merged.@fuzeofficlal on GitHub · 2026-11-26 01:27 UTC · original
Code review and RTX 5090 + WARP verification at head
16200aba750amerged cleanly ontomain(63bcca43c6a0):crates/victory-gpu/src/pipeline/journal.rs,pipeline/host.rs:464-474):pending/{key}@{detail}@{pid}-{next}file (zero cross-thread file contention), andJournal::openskips live sibling processes (OpenProcess+STILL_ACTIVE).crashed.txttagged with# translator {SOURCE_HASH}(auto-demoting to suspects if the translator changes); multiple leftover notes move tosuspects.txtand serialize underGatewith a 5salone_fortimeout and thread-localHOLDS_GATEreentrancy guard to prevent deadlocks.VICTORY_D3D12_DEBUG=1, Rust 1.98.1):cargo xtask policy:192 files ok;cargo clippy -p victory-gpu --all-targets -- -D warnings(default +--features diagnostics): 0 warningsvictory-gpu --lib -- pipeline::: 36/36 passed on RTX 5090 (default) and 39/39 passed on WARP (--features diagnostics), including all 11 new journal tests.LGTM.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.