GPU diagnostics: breadcrumbs name the command a hung submission is stuck in (VICTORY_GPU_BREADCRUMBS) #2310
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!2310
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2310"
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-25 10:19 UTC · original
desplmfao:diag/gpu-breadcrumbs-main→main· +582 −35 · 10 files · 10 commits · openProblem
When a submission hangs the GPU (on NVIDIA:
Xid 109 CTX SWITCH TIMEOUT, then device removed), VIctory can say which submission it was and list every pipeline in it, but not which command the GPU was running. vkd3d-proton'sVKD3D_CONFIG=breadcrumbsprinted nothing on NVIDIA here. Bisecting the submission's pipelines withVICTORY_SKIP_PIPELINESfound nothing, because three of them were involved together.Change
Diagnostics feature only. Opt-in with
VICTORY_GPU_BREADCRUMBS=1. When the switch is off, the cost is one flag load per command and no GPU writes.Recording: each draw, dispatch,
ExecuteIndirect, copy, clear, resolve and texture upload VIctory records gets a sequence id. Our own commands (indirect clamp, depth twins, present) get one too. On the CPU each list keeps the id, the kind of command, the frame and the bound pipeline's shaders.GPU markers:
WriteBufferImmediatewrites the id before the command (MARKER_IN) and after it (MARKER_OUT) into the list's slot of a mapped READBACK buffer (16384 slots of 8 bytes). The buffer can still be read after the device is lost.When it reports: a submission still running after 3 s logs at 3, 6, 9 and 12 s while the GPU is busy. On device removal it logs once, before the existing error. The report gives:
Lines stay under 900 bytes, because Wine aborts longer log lines.
The buffer is skipped with a warning if the device lacks
WriteBufferImmediateon the direct queue.What it found
In Grand Theft Auto VI on an RTX 5080 (Linux, Proton, vkd3d-proton 3.2.0), the "hang" at world load turned out to be no hang at all. It is one list of 7,031 commands that the GPU works through steadily:
At 3, 6, 9 and 12 s the list had reached commands 2,502, 3,035, 3,648 and 4,305. Almost all are direct dispatches of three programs from Microsoft's
XboxBvhBuilder.dll(shipped with the title), which rehydrate streamed ray-tracing acceleration structures:Box32Rehydration28918b7150a7aad5,Box16Rehydrationcaa78b8ca62bc3d6andDecompressHeader4ddd6f9702fab2a7. The submission takes longer than the driver allows. With those three skipped, the run goes 5 minutes in the world without a timeout. Why they are this slow under VIctory is the next question.Since then it located two more problems, and each led to a fix:
smh_pose_1:CS_UpdatePosePositiond3e44e754b3eb6aa. Skipping that pass moved the stuck point tosmh_pose_1:CS_PreSkinSimNodes0e45e59e93b736e4(the first command of its list), and then tosmh_pose_0:CS_UpdatePosePositionda1656ad2910e4c7. So it was the whole strand-hair family, not one program. With vkd3d-proton'sVK_NV_raw_access_chainsdisabled, all of them run, and the title went 10 minutes with no timeout. Bisecting byVICTORY_SKIP_PIPELINESwithout the breadcrumbs had given a wrong answer for the earlier hang, because several programs were involved.Each marker after a command waits for that command to finish, so the GPU is serialised while this is on. That slows it down, and could in principle hide a timing-dependent hang. It is a tool for finding a hang, not for playing.
Tested
cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without--features diagnostics: clean, onmain(940d32f).main; the only conflicts were with #158 and #67 code, whichmaindoesn't have.cargo test -p victory-gpu --lib --features diagnostics crumbs, Windows build under Proton on the RTX 5080: 8 passed. They cover the stuck, done and stale states, ids round-tripping, line splitting, and a list executed on the device writing its slot.AI-assisted (Claude Code).
🤖 Generated with Claude Code
@desplmfao on GitHub · 2026-11-25 11:33 UTC · original
Added to the description: since opening this, the breadcrumbs have located two more problems in the title, and each led to a fix. They confirmed that #2167 clears the BVH rehydration list. They also found a real hang across the strand-hair passes (
smh_pose_*, the "finished" id frozen for 3/6/9 s), which turned out to be vkd3d-proton'sVK_NV_raw_access_chainson NVIDIA. Bisecting withVICTORY_SKIP_PIPELINESalone gave a wrong answer for the earlier hang, so these would have been hard to find without it.@Marvisak on GitHub · 2026-11-25 15:22 UTC · original · edited 2026-11-26 04:22 UTC
Automated triage for the maintainers.
Merge candidate. Since the last review only the tests in
descriptor/host.rschanged: the merge of #2946 was reverted and the branch now carries #2585's per-threadWHILE_PREPARINGhook. The breadcrumbs code (crumbs.rs,wait_crumbed,report_crumbs,HostList::crumbed) is unchanged and stays off unlessVICTORY_GPU_BREADCRUMBSis set. This PR and #2585 carry the same test-only commit, so whichever lands second drops it.CI: passing.
Generated by Claude Code
@desplmfao on GitHub · 2026-11-26 01:16 UTC · original
The red CI run (
views_bound_while_another_slot_gets_its_texture_do_not_wait, "both made") was a race inmain's tests, not this branch, which doesn't touchdescriptor/. Two descriptor tests share a global hook that any test running in parallel can take, and it failed the same way on two unrelated branches the same day. #2946 makes the hook per thread.51f0e57merges #2946 here so CI runs with it; this PR is stacked on #2946 for that one test-only commit, and drops it once #2946 is inmain.@desplmfao on GitHub · 2026-11-26 03:24 UTC · original
Correction to the note above: the test-race fix is #2585, which came first. #2946 duplicated it and is closed. The
51f0e57merge here carries the same change, and it goes away once #2585 is inmain.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.