gpu: isolate AMD driver compiler crashes (crashed.txt) and skip self-CopyResource #2
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/DexNom--VIctory!2
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2"
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?
@jmal423 on GitHub · 2026-11-25 15:34 UTC · original
jmal423:pr/rdna4-pipeline-crash-isolation→main· +135 −19 · 3 files · 2 commits · openEnables
DexNom/VIctoryto boot and run on AMD RDNA4 (tested on Windows 11 / AMD Radeon RX 9070 XT, Series X target) without crashing insideamdxc64.dll:crashed.txt): installs a Vectored Exception Handler aroundCreate*PipelineStateinpipeline::librarythat logs the failing pipeline hash, records it incrashed.txt(skipped on subsequent runs), and parks the faulting worker thread instead of crashing the process.library::LOSTand spawns replacement workers inpipeline::make::startso the pipeline worker pool never starves (preventing 12s/frame stalls when multiple PSOs fault in one session).CopyResource: skipsCopyResourcewhento == from(same host texture).Tested on Windows 11 / AMD Radeon RX 9070 XT:
amdxc64.dll+0x861b9f(0xc0000005, read0x8).crashed.txtand ran in-game (both raster and experimental RT at1.3-1.5 fps/687-777 ms/framein the prison scene).@DiegoStefanini on GitHub · 2026-11-25 15:45 UTC · original
Thanks for this! I merged it locally on top of current
main(921d8d3), together with #1: no conflicts, clippy clean with and without--all-features, and the whole workspace test suite passes (623 passed, 0 failed) on an RTX 4060 Laptop. As expected it changes nothing on NVIDIA, since no driver crash happens there.Two things I noticed while reading it:
WAITINGnever comes back down after a parked worker. The worker that faults never returns fromnext().make(), so theWAITING.fetch_sub(1, …)in the worker loop never runs for that pipeline. After the first isolated crash,WAITINGstays one too high for the rest of the session:drained()no longer fires (no "host pipelines all made" log, no library save on drain), and the pending count on the frame line stays above zero. DecrementingWAITINGincompiler_crashed(next toLOST.fetch_add) before parking would keep the count right. The replacement worker then takes over the queue as it does now.Parking the thread inside the driver. The handler stops the faulting thread in the middle of
Create*PipelineState, so whatever the driver's compiler held at that moment (an internal lock, for instance) stays held for good. If anotherCreate*PipelineStateon a replacement worker needs the same lock, that worker blocks too, and so on. It evidently didn't happen in your RDNA4 run, so this may be fine in practice. Still, a short note in the doc comment would help, and so would a log line when a replacement worker starts, so a stall like that is easy to recognise later.Nothing else from me. The self-
CopyResourceskip and thespawn_workerrefactor look good.@manoel0810 on GitHub · 2026-11-25 16:29 UTC · original
Estava corrigindo exatamente isso! Estou testando aqui.
@jmal423 on GitHub · 2026-11-25 17:22 UTC · original
Thanks for the thorough review @itsonewi! Updated the PR to address this:
OnceLock<HashSet<String>>withOnceLock<Mutex<HashSet<String>>>(crashed_set()), andnote_crashed()now inserts into it in-memory viatry_lock()as well as appending tocrashed.txt, so repeated requests for a broken pipeline in the same run returnErrimmediately without re-faulting or parking more threads.Making::newso future edits don't move any runtime lock acrosscreate().@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 15:35 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@itsonewi on GitHub · 2026-11-25 16:12 UTC · original · reviewed
probe from review endpoint
@itsonewi on GitHub · 2026-11-25 16:13 UTC · original · reviewed
Part 1 of a review of this patch against
main(split up because the API kept failing on the long version).The crashed name is never refused within the same run, so one broken pipeline crashes, parks and replaces in a loop.
crashed()readscrashed.txtonce into aOnceLock<HashSet<String>>;note_crashed()only appends to the file and never touches that set. So in the run where the fault happens,crashed(name)isfalsefor the rest of the run. A title that binds the same broken material pipeline every frame then repeats this:pipeline()-> not crashed ->create()-> the driver faults -> the VEH parks this worker andLOST += 1; the nextmake::startspawns a replacement that pops the next job, not the lost one; the next request for that name arrives and the cycle runs again.Cost per attempt: one access violation, one log line, one permanently parked thread, one new thread. Unbounded over a session.
Fix: record the name in memory on the crash path as well (a
Mutex<HashSet<String>>seeded once from the file, or a secondOnceLock<Mutex<HashSet>>), so the second request in the same run returnsErrimmediately.This is also the fix for the stall the description targets: the parked thread never sets
madeorleft_outon thePendingit popped, so every frame that needs that pipeline waits itswait_budget(12 s per kind by default,pipeline/make.rs) for something that can no longer be made.AI use: read the patch and
crates/victory-gpu/src/pipeline/{make,library}.rsonmainvia the GitHub API; nothing built or run.@itsonewi on GitHub · 2026-11-25 16:14 UTC · original · reviewed
Part 2 of the review (the rest, and one invariant worth writing down).
A parked thread leaves its
Callentry behind.call()inlibrary.rspushes(thread, what, name, since)and removes it inDrop; a parked thread never drops it, soremoval_note()reportsmake <pipeline>as a call running now for the rest of the run — which is exactly the report that diagnostic exists for.crashed.txtnever expires, and the README does not mention it. After a driver update that fixes the compiler the pipeline stays refused forever, and the only way out is finding and editing an undocumented file. A driver version or a date on the line, or one sentence in the README's known-issues list, would make it recoverable.Confirmed on purpose, so that a later edit does not break it by accident:
AddVectoredExceptionHandler(1, ...)returning0for exceptions that are not ours, theExceptionInformation[1] >= 0x10000filter, and the parking itself are free of the runtime's locks becausecreate()runs outside them (// Compiled outside any lock),call()/one_call()/same_name()are scoped before it, andPending::makecompiles insideHostPipeline::newbefore touchingDONE. That invariant deserves a line next toMaking::new: moving any lock acrosscreate()would turn a parked thread into a deadlock that the replacement workers cannot repair.Nothing here was built or run; this is from the patch and
main.AI use: read the patch and
crates/victory-gpu/src/pipeline/{make,library}.rsonmainvia the GitHub API; nothing built or run.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.