GPU diagnostics: breadcrumbs name the command a hung submission is stuck in (VICTORY_GPU_BREADCRUMBS) #2310

Open
github-bot wants to merge 11 commits from github-bot/gh-2310 into main AGit
Owner

@⁠desplmfao on GitHub · 2026-11-25 10:19 UTC · original
desplmfao:diag/gpu-breadcrumbs-main → main · +595 −35 · 10 files · 11 commits · open

Problem

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's VKD3D_CONFIG=breadcrumbs printed nothing on NVIDIA here. Bisecting the submission's pipelines with VICTORY_SKIP_PIPELINES found 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: WriteBufferImmediate writes 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:

    • each list's state (done, waiting, stuck);
    • for a stuck list, the first command that started but didn't finish, and the three before it.

    Lines stay under 900 bytes, because Wine aborts longer log lines.

  • The buffer is skipped with a warning if the device lacks WriteBufferImmediate on 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:

GPU breadcrumbs (still running after 9 s, submission 2657): list 521 (1 of 1) started #38248 finished #38219 of 7031 commands; first not finished: #38220 dispatch [compute 28918b7150a7aad5] frame 880 (command 3648 of the list, 29 started); ...

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: Box32Rehydration 28918b7150a7aad5, Box16Rehydration caa78b8ca62bc3d6 and DecompressHeader 4ddd6f9702fab2a7. 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:

  1. The BVH list. With #2167 (guarded dirty-mark atomics) merged on our stack, the same list finishes. The breadcrumbs stopped pointing at those passes, so the change could be confirmed in the title (reported on #2167).
  2. A real hang in the hair system. The GPU's "finished" id stood still for 3, 6 and 9 s on a dispatch of smh_pose_1:CS_UpdatePosePosition d3e44e754b3eb6aa. Skipping that pass moved the stuck point to smh_pose_1:CS_PreSkinSimNodes 0e45e59e93b736e4 (the first command of its list), and then to smh_pose_0:CS_UpdatePosePosition da1656ad2910e4c7. So it was the whole strand-hair family, not one program. With vkd3d-proton's VK_NV_raw_access_chains disabled, all of them run, and the title went 10 minutes with no timeout. Bisecting by VICTORY_SKIP_PIPELINES without 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, on main (940d32f).
  • In the title: the run above, on our stack with #439. This commit is that one, ported to main; the only conflicts were with #158 and #67 code, which main doesn'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 10:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310) `desplmfao:diag/gpu-breadcrumbs-main` → `main` · +595 −35 · 10 files · 11 commits · open ## Problem 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's `VKD3D_CONFIG=breadcrumbs` printed nothing on NVIDIA here. Bisecting the submission's pipelines with `VICTORY_SKIP_PIPELINES` found 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:** `WriteBufferImmediate` writes 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: - each list's state (done, waiting, stuck); - for a stuck list, the first command that started but didn't finish, and the three before it. Lines stay under 900 bytes, because Wine aborts longer log lines. - The buffer is skipped with a warning if the device lacks `WriteBufferImmediate` on 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: ``` GPU breadcrumbs (still running after 9 s, submission 2657): list 521 (1 of 1) started #38248 finished #38219 of 7031 commands; first not finished: #38220 dispatch [compute 28918b7150a7aad5] frame 880 (command 3648 of the list, 29 started); ... ``` 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: `Box32Rehydration` `28918b7150a7aad5`, `Box16Rehydration` `caa78b8ca62bc3d6` and `DecompressHeader` `4ddd6f9702fab2a7`. 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: 1. **The BVH list.** With #2167 (guarded dirty-mark atomics) merged on our stack, the same list finishes. The breadcrumbs stopped pointing at those passes, so the change could be confirmed in the title (reported on #2167). 2. **A real hang in the hair system.** The GPU's "finished" id stood still for 3, 6 and 9 s on a dispatch of `smh_pose_1:CS_UpdatePosePosition` `d3e44e754b3eb6aa`. Skipping that pass moved the stuck point to `smh_pose_1:CS_PreSkinSimNodes` `0e45e59e93b736e4` (the first command of its list), and then to `smh_pose_0:CS_UpdatePosePosition` `da1656ad2910e4c7`. So it was the whole strand-hair family, not one program. With vkd3d-proton's `VK_NV_raw_access_chains` disabled, all of them run, and the title went 10 minutes with no timeout. Bisecting by `VICTORY_SKIP_PIPELINES` without 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, on `main` (`940d32f`). - In the title: the run above, on our stack with #439. This commit is that one, ported to `main`; the only conflicts were with #158 and #67 code, which `main` doesn'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](https://claude.com/claude-code)
Diagnostics builds, VICTORY_GPU_BREADCRUMBS=1. Each draw, dispatch,
mesh dispatch, ExecuteIndirect, copy, clear and resolve recorded on a
host list gets an id, kept on the CPU with its kind, the bound
pipeline's shaders and the frame. Around it the list writes the id into
its slot of a mapped read-back buffer with WriteBufferImmediate
(MARKER_IN before, MARKER_OUT after). A submission still running after
3 s, or a removed device, logs per list the last started and finished
ids and the first command started but not finished, with the three
before it. Off: no writes, one flag load per command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
What was wrong: `descriptor::host::tests::WHILE_PREPARING`, the hook that
runs work while a view's texture is prepared, was one global for the
test process. Every test that binds a view prepares one, and the suite
runs tests in parallel, so the hook ran in whichever test prepared
first, or another test replaced it before its own test's prepare ran.
`a_slot_rewritten_while_its_view_is_prepared_views_the_new_record` then
failed with "the slot views the record written last" (the rewrite never
happened) and `views_bound_while_another_slot_gets_its_texture_do_not_wait`
with "both made" (the other slot was never bound).

What changed: the hook is thread-local. `prepare` runs on the thread
that binds the view (`HostHeap::mirror`), so a test's hook runs in its
own prepare and in no other test's. Test code only.

Evidence: the full `cargo test -p victory-gpu --lib` binary, 200 runs
each on Windows 10 (19045) and an RTX 3080: main 67e8ae1 had a failure
of one of the two in 22 runs (13 and 11); with this change, none.
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	README.md
#	crates/victory-gpu/src/host.rs
Two descriptor tests set a global hook that runs while a view's texture
is prepared, and any test preparing a view took it. With tests running in
parallel, one test could take or replace the other's hook: the work then
never ran where it was meant to, and views_bound_while_another_slot_gets_
its_texture_do_not_wait failed with "both made". It failed that way in CI
on three unrelated pull requests (#2310 and two others) within a day. The
hook is now thread-local: set and taken on the test's own thread.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This reverts commit 51f0e57faa, reversing
changes made to 9c9d507eb7.
The CI test race fix this branch hit; it replaces #2946, which duplicated it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:01:53 +00:00
Author
Owner

@⁠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's VK_NV_raw_access_chains on NVIDIA. Bisecting with VICTORY_SKIP_PIPELINES alone gave a wrong answer for the earlier hang, so these would have been hard to find without it.

**@⁠desplmfao** on GitHub · 2026-11-25 11:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#issuecomment-7161196066) 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's `VK_NV_raw_access_chains` on NVIDIA. Bisecting with `VICTORY_SKIP_PIPELINES` alone gave a wrong answer for the earlier hang, so these would have been hard to find without it.
Author
Owner

@⁠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.rs changed: the merge of #2946 was reverted and the branch now carries #2585's per-thread WHILE_PREPARING hook. The breadcrumbs code (crumbs.rs, wait_crumbed, report_crumbs, HostList::crumbed) is unchanged and stays off unless VICTORY_GPU_BREADCRUMBS is set. This PR and #2585 carry the same test-only commit, so whichever lands second drops it.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#issuecomment-7166740250) · edited 2026-11-26 04:22 UTC <!-- victory-triage v1 head=9ac4093444effc080023f2c602fec44223af8683 verdict=merge-candidate at=2026-11-26T04:22:17Z --> Automated triage for the maintainers. **Merge candidate.** Since the last review only the tests in `descriptor/host.rs` changed: the merge of #2946 was reverted and the branch now carries #2585's per-thread `WHILE_PREPARING` hook. The breadcrumbs code (`crumbs.rs`, `wait_crumbed`, `report_crumbs`, `HostList::crumbed`) is unchanged and stays off unless `VICTORY_GPU_BREADCRUMBS` is set. This PR and #2585 carry the same test-only commit, so whichever lands second drops it. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠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 in main's tests, not this branch, which doesn't touch descriptor/. 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. 51f0e57 merges #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 in main.

**@⁠desplmfao** on GitHub · 2026-11-26 01:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#issuecomment-7179611151) The red CI run (`views_bound_while_another_slot_gets_its_texture_do_not_wait`, "both made") was a race in `main`'s tests, not this branch, which doesn't touch `descriptor/`. 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. `51f0e57` merges #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 in `main`.
Author
Owner

@⁠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 51f0e57 merge here carries the same change, and it goes away once #2585 is in main.

**@⁠desplmfao** on GitHub · 2026-11-26 03:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#issuecomment-7181690733) Correction to the note above: the test-race fix is #2585, which came first. #2946 duplicated it and is closed. The `51f0e57` merge here carries the same change, and it goes away once #2585 is in `main`.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 10:22 UTC · original · approved these changes

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Clean, feature-gated (diagnostics) GPU breadcrumb implementation (crumbs.rs) with WriteBufferImmediate markers around draws, dispatches, copies, resolves, and clears, plus structured hang reporting.
  • cargo test -p victory-gpu --features diagnostics crumbs::: 8/8 passed on RTX 5090, 8/8 passed on WARP (including live GPU execution test executed_list_writes_its_slot).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (both default and --features diagnostics): 0 warnings.
  • cargo xtask policy: 184 files ok.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 10:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#pullrequestreview-6055761616) · **approved these changes** Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Clean, feature-gated (`diagnostics`) GPU breadcrumb implementation (`crumbs.rs`) with `WriteBufferImmediate` markers around draws, dispatches, copies, resolves, and clears, plus structured hang reporting. - `cargo test -p victory-gpu --features diagnostics crumbs::`: 8/8 passed on RTX 5090, 8/8 passed on WARP (including live GPU execution test `executed_list_writes_its_slot`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (both default and `--features diagnostics`): 0 warnings. - `cargo xtask policy`: 184 files ok. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 10:54 UTC · original · reviewed

GPU breadcrumbs (new crumbs.rs, 411 lines): WriteBufferImmediate markers around each command, per-list progress dumped when a submission runs 3s+ or the device is lost. 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. Well-designed hang-diagnosis tool; README documents the perf cost honestly.

**@⁠catminou4** on GitHub · 2026-11-25 10:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#pullrequestreview-6056242847) · **reviewed** GPU breadcrumbs (new crumbs.rs, 411 lines): WriteBufferImmediate markers around each command, per-list progress dumped when a submission runs 3s+ or the device is lost. 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. Well-designed hang-diagnosis tool; README documents the perf cost honestly.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 12:54 UTC · original · requested changes

Reviewed and verified 9ac40934 (based on origin/main 63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll; synthetic tests only, no game files).

Verification

  • cargo xtask policy: 192 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): 0 warnings; cargo check --locked --release -p victory-gpu (non-diagnostics): clean.
  • RTX 5090 & WARP (VICTORY_D3D12_DEBUG=1, --features diagnostics): crumbs::tests 8/8 passed, and with VICTORY_GPU_BREADCRUMBS=1, crumbs::tests + draw::tests 28/28 passed on both adapters.
  • Drained D3D12 InfoQueue probe around make(&host.device) and WriteBufferImmediate (MARKER_IN / MARKER_OUT): 0 Debug Layer warnings/errors on both RTX 5090 and WARP.

Blocking Issue: Out-of-bounds panic in progress() / report_list() when finished > last

In crates/victory-gpu/src/crumbs.rs:256-270:

    if finished == last {
        return Progress::Done;
    }
    if started < first || started > last {
        return Progress::NotStarted;
    }
    // The first not finished: after `finished` if it is one of ours.
    let first = if finished >= first { ids.partition_point(|&id| id <= finished) } else { 0 };

Line 267 checks finished >= first without checking finished < last.

Because list slots alias modulo SLOTS = 16384 (crates/victory-gpu/src/crumbs.rs:115), if a long-lived list A (for example p.copy or an older reused list) shares slot = id % 16384 with a newer list B (id + 16384), and A records/executes a higher command id a1 > B.last after B was recorded (writing (a1, a1) to the slot), then when B starts executing and hangs inside its first command before MARKER_OUT runs, the slot holds (started = B.first, finished = a1 > B.last) (the same condition can also occur across u32 id wraparound).

In that state:

  1. finished >= first is true, so ids.partition_point(|&id| id <= finished) returns ids.len().
  2. progress() returns Progress::Stuck { first: ids.len(), in_flight: 0 }.
  3. report_list() (crates/victory-gpu/src/crumbs.rs:309) indexes &trail.entries[first], panicking with index out of bounds right inside report_crumbs — before fail(...) (crates/victory-gpu/src/host.rs:1350) can even emit the DRED/device-removal report.

Live GPU reproduction (RTX 5090 and WARP):
Using two real command lists sharing slot 7777 via WriteBufferImmediate (list_b with ids = [1, 2] recording only MARKER_IN(1); list_a recording MARKER_IN(3) + MARKER_OUT(3) and executing first, followed by list_b):

  • Slot readback on both RTX 5090 and WARP: ids=[1, 2] started=1 finished=3
  • progress(&ids, 1, 3) returned Stuck { first: 2, in_flight: 0 } with entries.len() == 2
  • report_list(...) panicked at crates/victory-gpu/src/crumbs.rs:309:31: index out of bounds: the len is 2 but the index is 2

Fix: constrain crates/victory-gpu/src/crumbs.rs:267 to if finished >= first && finished < last (matching the comment on line 266) and add a unit test covering finished > last (e.g. progress(&[10, 12, 15], 10, 20) == Progress::Stuck { first: 0, in_flight: 1 }).

Non-blocking Notes

  • crates/victory-gpu/src/crumbs.rs:232-233: make() calls std::ptr::write_bytes on a D3D12_HEAP_TYPE_READBACK mapping. Although D3D12 Debug Layer reported no messages on RTX 5090 or WARP, CPU writes to READBACK heaps are disallowed by the D3D12 specification and unnecessary because CreateCommittedResource zero-initializes committed buffers. Removing the write_bytes call is cleaner and avoids dirty cache-line writeback hazards.
  • crates/victory-gpu/src/host.rs:1350 / crates/victory-gpu/src/crumbs.rs:312: if Signal/SetEventOnCompletion fails on an already-lost device and wait_crumbed is skipped, trail.submission still holds its previous submission number; passing submission from report_crumbs into report_list would keep the logged submission id accurate in that path too.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 12:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#pullrequestreview-6074471491) · **requested changes** Reviewed and verified `9ac40934` (based on `origin/main` `63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust `1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`; synthetic tests only, no game files). ### Verification - `cargo xtask policy`: `192 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): 0 warnings; `cargo check --locked --release -p victory-gpu` (non-`diagnostics`): clean. - **RTX 5090 & WARP (`VICTORY_D3D12_DEBUG=1`, `--features diagnostics`):** `crumbs::tests` **8/8 passed**, and with `VICTORY_GPU_BREADCRUMBS=1`, `crumbs::tests` + `draw::tests` **28/28 passed** on both adapters. - Drained D3D12 InfoQueue probe around `make(&host.device)` and `WriteBufferImmediate` (`MARKER_IN` / `MARKER_OUT`): 0 Debug Layer warnings/errors on both RTX 5090 and WARP. ### Blocking Issue: Out-of-bounds panic in `progress()` / `report_list()` when `finished > last` In `crates/victory-gpu/src/crumbs.rs:256-270`: ```rust if finished == last { return Progress::Done; } if started < first || started > last { return Progress::NotStarted; } // The first not finished: after `finished` if it is one of ours. let first = if finished >= first { ids.partition_point(|&id| id <= finished) } else { 0 }; ``` Line 267 checks `finished >= first` without checking `finished < last`. Because list slots alias modulo `SLOTS = 16384` (`crates/victory-gpu/src/crumbs.rs:115`), if a long-lived list `A` (for example `p.copy` or an older reused list) shares `slot = id % 16384` with a newer list `B` (`id + 16384`), and `A` records/executes a higher command id `a1 > B.last` after `B` was recorded (writing `(a1, a1)` to the slot), then when `B` starts executing and hangs inside its first command before `MARKER_OUT` runs, the slot holds `(started = B.first, finished = a1 > B.last)` (the same condition can also occur across `u32` id wraparound). In that state: 1. `finished >= first` is `true`, so `ids.partition_point(|&id| id <= finished)` returns `ids.len()`. 2. `progress()` returns `Progress::Stuck { first: ids.len(), in_flight: 0 }`. 3. `report_list()` (`crates/victory-gpu/src/crumbs.rs:309`) indexes `&trail.entries[first]`, panicking with `index out of bounds` right inside `report_crumbs` — before `fail(...)` (`crates/victory-gpu/src/host.rs:1350`) can even emit the DRED/device-removal report. **Live GPU reproduction (RTX 5090 and WARP):** Using two real command lists sharing slot `7777` via `WriteBufferImmediate` (`list_b` with `ids = [1, 2]` recording only `MARKER_IN(1)`; `list_a` recording `MARKER_IN(3)` + `MARKER_OUT(3)` and executing first, followed by `list_b`): - Slot readback on both RTX 5090 and WARP: `ids=[1, 2] started=1 finished=3` - `progress(&ids, 1, 3)` returned `Stuck { first: 2, in_flight: 0 }` with `entries.len() == 2` - `report_list(...)` panicked at `crates/victory-gpu/src/crumbs.rs:309:31`: `index out of bounds: the len is 2 but the index is 2` **Fix:** constrain `crates/victory-gpu/src/crumbs.rs:267` to `if finished >= first && finished < last` (matching the comment on line 266) and add a unit test covering `finished > last` (e.g. `progress(&[10, 12, 15], 10, 20) == Progress::Stuck { first: 0, in_flight: 1 }`). ### Non-blocking Notes - `crates/victory-gpu/src/crumbs.rs:232-233`: `make()` calls `std::ptr::write_bytes` on a `D3D12_HEAP_TYPE_READBACK` mapping. Although D3D12 Debug Layer reported no messages on RTX 5090 or WARP, CPU writes to `READBACK` heaps are disallowed by the D3D12 specification and unnecessary because `CreateCommittedResource` zero-initializes committed buffers. Removing the `write_bytes` call is cleaner and avoids dirty cache-line writeback hazards. - `crates/victory-gpu/src/host.rs:1350` / `crates/victory-gpu/src/crumbs.rs:312`: if `Signal`/`SetEventOnCompletion` fails on an already-lost device and `wait_crumbed` is skipped, `trail.submission` still holds its previous submission number; passing `submission` from `report_crumbs` into `report_list` would keep the logged submission id accurate in that path too.
Author
Owner

@⁠desplmfao on GitHub · 2026-11-26 13:01 UTC · original

@⁠fuzeofficlal thanks, that's a real one, and the live repro with two lists sharing a slot makes it clear. Fixed in f55f635 as you suggested: progress() takes finished as this list's only when finished >= first && finished < last. Otherwise nothing of the list counts as finished, and the first command is the stuck one. The new test a_finished_word_past_the_last_id_is_not_ours covers your case (progress(&[10, 12, 15], 10, 20) is Stuck { first: 0, in_flight: 1 }) and the slot-7777 shape (&[1, 2], 1, 3). It fails with the old condition and passes now. crumbs:: gives 9 passed under Wine with --features diagnostics, and clippy is clean with and without diagnostics.

**@⁠desplmfao** on GitHub · 2026-11-26 13:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#issuecomment-7192777898) @⁠fuzeofficlal thanks, that's a real one, and the live repro with two lists sharing a slot makes it clear. Fixed in `f55f635` as you suggested: `progress()` takes `finished` as this list's only when `finished >= first && finished < last`. Otherwise nothing of the list counts as finished, and the first command is the stuck one. The new test `a_finished_word_past_the_last_id_is_not_ours` covers your case (`progress(&[10, 12, 15], 10, 20)` is `Stuck { first: 0, in_flight: 1 }`) and the slot-7777 shape (`&[1, 2], 1, 3`). It fails with the old condition and passes now. `crumbs::` gives 9 passed under Wine with `--features diagnostics`, and clippy is clean with and without diagnostics.
progress() took any finished word at or after the list's first id as one
of its own. Slots repeat every SLOTS ids, so a long-lived list sharing the
slot (or ids that wrapped) can leave a finished word past this list's last
id; then the first unfinished command was ids.len(), and report_list
indexed past the entries and panicked before the device-removal report.
Now such a word counts as nothing of this list finished.

Found and reproduced by fuzeofficlal's review of #2310 (RTX 5090 and WARP,
two lists sharing slot 7777).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 13:18 UTC · original · approved these changes

Re-reviewed and re-verified f55f6355 (based on origin/main 63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll; synthetic tests only, no game files).

The out-of-bounds panic in progress() / report_list() is cleanly resolved:

  • crates/victory-gpu/src/crumbs.rs:270 now checks finished >= first && finished < last, guaranteeing first < ids.len() for every Progress::Stuck result so report_list() (crates/victory-gpu/src/crumbs.rs:312) cannot index past trail.entries.
  • Live GPU slot-collision reproducer re-run (RTX 5090 & WARP, VICTORY_D3D12_DEBUG=1): two real command lists sharing slot 7777 via WriteBufferImmediate (ids=[1, 2], started=1, finished=3) no longer panic on either adapter; report_list() returns Progress::Stuck { first: 0, in_flight: 1 } and logs command #1 (list_b_cmd_1) cleanly.
  • New unit test a_finished_word_past_the_last_id_is_not_ours (crates/victory-gpu/src/crumbs.rs:364-367) covers both cases.

Verification

  • cargo xtask policy: 192 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): 0 warnings; cargo check --locked --release -p victory-gpu (non-diagnostics): clean.
  • RTX 5090 & WARP (VICTORY_D3D12_DEBUG=1, --features diagnostics): crumbs::tests 9/9 passed, and with VICTORY_GPU_BREADCRUMBS=1, crumbs::tests + draw::tests 29/29 passed on both adapters.

Approved.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 13:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2310#pullrequestreview-6074797541) · **approved these changes** Re-reviewed and re-verified `f55f6355` (based on `origin/main` `63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust `1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`; synthetic tests only, no game files). The out-of-bounds panic in `progress()` / `report_list()` is cleanly resolved: - `crates/victory-gpu/src/crumbs.rs:270` now checks `finished >= first && finished < last`, guaranteeing `first < ids.len()` for every `Progress::Stuck` result so `report_list()` (`crates/victory-gpu/src/crumbs.rs:312`) cannot index past `trail.entries`. - **Live GPU slot-collision reproducer re-run (RTX 5090 & WARP, `VICTORY_D3D12_DEBUG=1`):** two real command lists sharing slot `7777` via `WriteBufferImmediate` (`ids=[1, 2]`, `started=1`, `finished=3`) no longer panic on either adapter; `report_list()` returns `Progress::Stuck { first: 0, in_flight: 1 }` and logs command `#1` (`list_b_cmd_1`) cleanly. - New unit test `a_finished_word_past_the_last_id_is_not_ours` (`crates/victory-gpu/src/crumbs.rs:364-367`) covers both cases. ### Verification - `cargo xtask policy`: `192 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): 0 warnings; `cargo check --locked --release -p victory-gpu` (non-`diagnostics`): clean. - **RTX 5090 & WARP (`VICTORY_D3D12_DEBUG=1`, `--features diagnostics`):** `crumbs::tests` **9/9 passed**, and with `VICTORY_GPU_BREADCRUMBS=1`, `crumbs::tests` + `draw::tests` **29/29 passed** on both adapters. Approved.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2310/head:github-bot/gh-2310'
git switch 'github-bot/gh-2310'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2310'
git switch 'github-bot/gh-2310'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2310'
git switch 'github-bot/gh-2310'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2310'
git switch 'main'
git merge --squash 'github-bot/gh-2310'
git switch 'main'
git merge --ff-only 'github-bot/gh-2310'
git switch 'main'
git merge 'github-bot/gh-2310'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2310
No description provided.