Skip to content

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

Open
davesousa wants to merge 1 commit into
Marvisak:mainfrom
davesousa:dred-history
Open

davesousa wants to merge 1 commit into
Marvisak:mainfrom
davesousa:dred-history

Conversation

@davesousa

Copy link
Copy Markdown

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

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 <noreply@anthropic.com>

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@oni-swr

oni-swr commented Nov 26, 2026

Copy link
Copy Markdown

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants