GPU: the DRED report reads only the breadcrumb history that is there #3268

Open
github-bot wants to merge 1 commit from github-bot/gh-3268 into main AGit
Owner

@⁠davesousa on GitHub · 2026-11-26 15:10 UTC · original
davesousa:dred-history → main · +113 −10 · 1 files · 1 commits · open

With VICTORY_D3D12_DRED, Host::removal_data makes a slice of BreadcrumbCount ops over each unfinished node's pCommandHistory and walks all of it. On an RTX 3070 Ti (driver 621.40, Windows 11 26200) one removal's report crashed VIctory instead: 0xc0000005 reading op 15,360 of a node's history, exactly 60 KiB in, where the memory was reserved but not committed. So that removal's report was lost. It was 1 of 3 DRED removals I have, in a VICTORY_GPU_TIMING=1 run (#2703 + #2841 on my NVIDIA stack). The other reports on this card read histories of 17,030 to 19,268 ops without trouble, so the history is not capped at 15,360; in that one, the runtime's count ran past the history it had committed.

This PR:

  • reads the history through the kernel (read, as the title-memory copies do), page by page, up to the first page that cannot be read;
  • names the op at the stop only when it is in that part, and adds but only its first N commands can be read when the history is cut short;
  • lists the commands in flight only when the stop is inside the readable part (the marker notes still pair up, since the readable part is the list's first commands).

Test: host::breadcrumbs::a_history_shorter_than_its_count_is_read_as_far_as_it_is_there makes a two-page reservation with only the first page committed, and a count of two pages. With the old read (from_raw_parts over the count) put back, the test process dies with 0xc0000005 STATUS_ACCESS_VIOLATION; with this PR it passes.

Checks on the RTX 3070 Ti: both clippy commands and cargo xtask policy pass. cargo test --workspace --locked --no-fail-fast gives the same results as main on this card (two victory-gpu view-heap-cap failures, dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views, and the victory-shader crash of #2571), plus the new test passing.

Not tested: a real removal with a cut-short history. That needs a GPU fault, and ID3D12Device5::RemoveDevice waits until the GPU is idle, so afterwards DRED lists no unfinished nodes (checked on this card). So there is no forced-removal test here.

Claimed on #1633. AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠davesousa** on GitHub · 2026-11-26 15:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3268) `davesousa:dred-history` → `main` · +113 −10 · 1 files · 1 commits · open With `VICTORY_D3D12_DRED`, `Host::removal_data` makes a slice of `BreadcrumbCount` ops over each unfinished node's `pCommandHistory` and walks all of it. On an RTX 3070 Ti (driver 621.40, Windows 11 26200) one removal's report crashed VIctory instead: `0xc0000005` reading op 15,360 of a node's history, exactly 60 KiB in, where the memory was reserved but not committed. So that removal's report was lost. It was 1 of 3 DRED removals I have, in a `VICTORY_GPU_TIMING=1` run (#2703 + #2841 on my NVIDIA stack). The other reports on this card read histories of 17,030 to 19,268 ops without trouble, so the history is not capped at 15,360; in that one, the runtime's count ran past the history it had committed. This PR: - reads the history through the kernel (`read`, as the title-memory copies do), page by page, up to the first page that cannot be read; - names the op at the stop only when it is in that part, and adds `but only its first N commands can be read` when the history is cut short; - lists the commands in flight only when the stop is inside the readable part (the marker notes still pair up, since the readable part is the list's first commands). Test: `host::breadcrumbs::a_history_shorter_than_its_count_is_read_as_far_as_it_is_there` makes a two-page reservation with only the first page committed, and a count of two pages. With the old read (`from_raw_parts` over the count) put back, the test process dies with `0xc0000005 STATUS_ACCESS_VIOLATION`; with this PR it passes. Checks on the RTX 3070 Ti: both clippy commands and `cargo xtask policy` pass. `cargo test --workspace --locked --no-fail-fast` gives the same results as `main` on this card (two `victory-gpu` view-heap-cap failures, `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`, and the `victory-shader` crash of #2571), plus the new test passing. Not tested: a real removal with a cut-short history. That needs a GPU fault, and `ID3D12Device5::RemoveDevice` waits until the GPU is idle, so afterwards DRED lists no unfinished nodes (checked on this card). So there is no forced-removal test here. Claimed on #1633. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A device-removed report read BreadcrumbCount ops from a node's
pCommandHistory; on an RTX 3070 Ti the runtime's count ran past the
history it had committed and the report crashed at op 15,360. Read the
history page by page through the kernel up to the first page that
cannot be read, and say when it is cut short.

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

@⁠Dukestar69 on GitHub · 2026-11-26 15:28 UTC · original · approved these changes

Reviewed the diff and verified locally on Windows 11 x64:

  • Reading DRED breadcrumb history page-by-page via ReadProcessMemory (readable_history) and bounds-checking done < history.len() in stopped_at / in_flight cleanly prevents access violations when BreadcrumbCount runs past committed pages.
  • cargo test -p victory-gpu --lib host::breadcrumbs:: -- --test-threads=1: 1 passed, 0 failed (a_history_shorter_than_its_count_is_read_as_far_as_it_is_there).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 15:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/3268#pullrequestreview-6076768935) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64: - Reading DRED breadcrumb history page-by-page via `ReadProcessMemory` (`readable_history`) and bounds-checking `done < history.len()` in `stopped_at` / `in_flight` cleanly prevents access violations when `BreadcrumbCount` runs past committed pages. - `cargo test -p victory-gpu --lib host::breadcrumbs:: -- --test-threads=1`: 1 passed, 0 failed (`a_history_shorter_than_its_count_is_read_as_far_as_it_is_there`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠oni-swr on GitHub · 2026-11-26 16:10 UTC · original

WARP verification report (test report only, no code changes)

  • PR head: 7cbb83ec
  • main: 63bcca43 (control); WARP software adapter forced with VICTORY_WARP=1 VICTORY_D3D12_WARP=1, --features diagnostics, d3d10warp.dll 10.0.26100.9818; dxil.dll 1.8.2502.11 (Windows Kit 10.0.26100.0, via VICTORY_DXIL).
  • Each new/changed test run in its own process (--exact), -j 4, synthetic tests only, no game data. Command: cargo test -p victory-gpu --lib --features diagnostics -j 4 -- --exact <test>.
  • New test host::breadcrumbs::a_history_shorter_than_its_count_is_read_as_far_as_it_is_there: passes on the PR (1 passed).
  • Control on main: the test needs readable_history and stopped_at from this PR, so I added the test to main with two shims that keep main's behaviour (read the runtime's whole count unchecked, index the history at done). The test crashes on main with STATUS_ACCESS_VIOLATION (0xc0000005) reading the uncommitted page, i.e. the fault the PR describes. That is a main-plus-shim control, not unmodified main.
  • victory-gpu lib suite: PR 247 passed, 0 failed, 1 ignored; main 246 passed, 0 failed, 1 ignored. No failures on either.
  • Not tested: physical GPU. The test exercises memory reads only, not a real device-removed report.

AI-assisted: verification by Claude Code (Claude Sonnet 5.5)

**@⁠oni-swr** on GitHub · 2026-11-26 16:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/3268#issuecomment-7197271139) WARP verification report (test report only, no code changes) - PR head: `7cbb83ec` - main: `63bcca43` (control); WARP software adapter forced with `VICTORY_WARP=1 VICTORY_D3D12_WARP=1`, `--features diagnostics`, d3d10warp.dll 10.0.26100.9818; dxil.dll 1.8.2502.11 (Windows Kit 10.0.26100.0, via `VICTORY_DXIL`). - Each new/changed test run in its own process (`--exact`), `-j 4`, synthetic tests only, no game data. Command: `cargo test -p victory-gpu --lib --features diagnostics -j 4 -- --exact <test>`. - New test `host::breadcrumbs::a_history_shorter_than_its_count_is_read_as_far_as_it_is_there`: **passes on the PR** (1 passed). - Control on main: the test needs `readable_history` and `stopped_at` from this PR, so I added the test to main with two shims that keep main's behaviour (read the runtime's whole count unchecked, index the history at `done`). The test **crashes on main** with `STATUS_ACCESS_VIOLATION` (0xc0000005) reading the uncommitted page, i.e. the fault the PR describes. That is a main-plus-shim control, not unmodified main. - `victory-gpu` lib suite: PR 247 passed, 0 failed, 1 ignored; main 246 passed, 0 failed, 1 ignored. No failures on either. - Not tested: physical GPU. The test exercises memory reads only, not a real device-removed report. AI-assisted: verification by Claude Code (Claude Sonnet 5.5)
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/3268/head:github-bot/gh-3268'
git switch 'github-bot/gh-3268'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3268'
git switch 'github-bot/gh-3268'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3268'
git switch 'github-bot/gh-3268'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3268'
git switch 'main'
git merge --squash 'github-bot/gh-3268'
git switch 'main'
git merge --ff-only 'github-bot/gh-3268'
git switch 'main'
git merge 'github-bot/gh-3268'
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!3268
No description provided.