GPU: a removal report names the call that removed the device #3260

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

@⁠potatoe0100 on GitHub · 2026-11-26 14:51 UTC · original
potatoe0100:removal-names-its-trigger → main · +159 −6 · 1 files · 1 commits · open

What

With the D3D12 debug layer on, fail puts the debug layer's first error of the submission in the crash report. When the layer removed the device (RemoveDevice, ids 232/233), the report now leads with the errors of the call just before the removal, and keeps the first error after it when that was a different call. Without a removal message the text is the same as before.

Why

The first error is often not what removed the device. A small D3D12 program on an RTX 4060 (driver 621.14, Windows 11, with and without the debug layer) shows:

Call Result Device removed?
GetResourceAllocationInfo, B5G5R5A1_UNORM + unordered access size UINT64_MAX, error 599 no
CreateCommittedResource, B5G5R5A1_UNORM + unordered access E_INVALIDARG no
CreateCommittedResource, B4G4R4A4_UNORM render target + clear value E_INVALIDARG no
CreateUnorderedAccessView, typed B5G5R5A1_UNORM / B4G4R4A4_UNORM errors 342, 340, then 232 yes, 0x887A0001, also without the debug layer
CreateRenderTargetView, B4G4R4A4_UNORM errors 36, 42, then 232 yes, 0x887A0001, also without the debug layer

So in #3237 the 8 reports naming GetResourceAllocationInfo (599) or CreateCommittedResource3 (817) name a refused texture, which is only a failed call. The removal came from a view made later in the same submission (all of them predate #2462). With this change the report names that view.

How

  • log_messages collects the messages it logs and returns removal_cause(&seen).
  • removal_cause is a plain function, so the choice is unit tested without removing the shared test device: 4 tests in host::removal_cause_tests.

Tested (RTX 4060 8 GB, driver 621.14, Windows 11 26300)

  • cargo test -p victory-gpu --lib --locked -- --test-threads=1: 233 passed, 2 failed, 1 ignored. The 2 failures are the known NVIDIA heap-cap ones (dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views, #747), the same as on main 63bcca4.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without --features diagnostics: clean.
  • cargo run -p xtask -- policy --staged: ok. rustfmt: no diffs in the changed lines.
  • Not tested: a real device removal in VIctory (no game data used). The table is from a separate test program.

This touches log_messages only; #2559 (the no breadcrumbs wording) edits removal_data in the same file. Each merges onto main on its own.

AI-assisted (Claude)

**@⁠potatoe0100** on GitHub · 2026-11-26 14:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/3260) `potatoe0100:removal-names-its-trigger` → `main` · +159 −6 · 1 files · 1 commits · open ## What With the D3D12 debug layer on, `fail` puts the debug layer's **first** error of the submission in the crash report. When the layer removed the device (`RemoveDevice`, ids 232/233), the report now leads with the errors of the call just before the removal, and keeps the first error after it when that was a different call. Without a removal message the text is the same as before. ## Why The first error is often not what removed the device. A small D3D12 program on an RTX 4060 (driver 621.14, Windows 11, with and without the debug layer) shows: | Call | Result | Device removed? | | --- | --- | --- | | `GetResourceAllocationInfo`, `B5G5R5A1_UNORM` + unordered access | size `UINT64_MAX`, error 599 | no | | `CreateCommittedResource`, `B5G5R5A1_UNORM` + unordered access | `E_INVALIDARG` | no | | `CreateCommittedResource`, `B4G4R4A4_UNORM` render target + clear value | `E_INVALIDARG` | no | | `CreateUnorderedAccessView`, typed `B5G5R5A1_UNORM` / `B4G4R4A4_UNORM` | errors 342, 340, then 232 | yes, `0x887A0001`, also without the debug layer | | `CreateRenderTargetView`, `B4G4R4A4_UNORM` | errors 36, 42, then 232 | yes, `0x887A0001`, also without the debug layer | So in #3237 the 8 reports naming `GetResourceAllocationInfo` (599) or `CreateCommittedResource3` (817) name a refused texture, which is only a failed call. The removal came from a view made later in the same submission (all of them predate #2462). With this change the report names that view. ## How - `log_messages` collects the messages it logs and returns `removal_cause(&seen)`. - `removal_cause` is a plain function, so the choice is unit tested without removing the shared test device: 4 tests in `host::removal_cause_tests`. ## Tested (RTX 4060 8 GB, driver 621.14, Windows 11 26300) - `cargo test -p victory-gpu --lib --locked -- --test-threads=1`: 233 passed, 2 failed, 1 ignored. The 2 failures are the known NVIDIA heap-cap ones (`dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views`, #747), the same as on `main` `63bcca4`. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`, with and without `--features diagnostics`: clean. - `cargo run -p xtask -- policy --staged`: ok. rustfmt: no diffs in the changed lines. - Not tested: a real device removal in VIctory (no game data used). The table is from a separate test program. This touches `log_messages` only; #2559 (the `no breadcrumbs` wording) edits `removal_data` in the same file. Each merges onto `main` on its own. AI-assisted (Claude)
With the debug layer on, the crash report named the first error of the
submission. A removal often follows errors that do not remove it: on an
RTX 4060 (driver 621.14) a refused texture (CreateCommittedResource,
GetResourceAllocationInfo) is only an error and a failed call; the device
is removed by a view the host cannot make (CreateUnorderedAccessView 342,
CreateRenderTargetView 36), right before RemoveDevice (232). The report
now leads with the errors of the call just before the removal and keeps
the first error after it when that was another call (#3237).

AI-assisted (Claude)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:56:01 +00:00
Author
Owner

@⁠Bj0rnis on GitHub · 2026-11-26 14:58 UTC · original

Verified head bc19bdae on Windows 11 (x64, Rust 1.98.1, NVIDIA GeForce RTX 5070 Ti + WARP):

  • Merge check vs origin/main (63bcca43): clean
  • RTX 5070 Ti (cargo test -p victory-gpu --lib --features diagnostics): 248 passed, 2 failed, 1 ignored (2.95s) — the 2 failures are the pre-existing #1744 NVIDIA 1M view-heap cap failures on main (descriptor::host::tests::dynamic_slots_are_held_until_released, memory::tests::lists_share_a_table_and_copies_keep_their_views); no regressions and all 4 new tests pass on hardware
  • WARP (VICTORY_D3D12_WARP=1): 250 passed, 0 failed, 1 ignored (1.94s)
  • Clippy (-p victory-gpu --lib --tests --features diagnostics -- -D warnings): clean (0 warnings)
  • cargo xtask policy: 191 files ok

Not tested: live title workload / real device-removal fault under gameplay.

AI-assisted test run and summary.

**@⁠Bj0rnis** on GitHub · 2026-11-26 14:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/3260#issuecomment-7195599884) Verified head `bc19bdae` on Windows 11 (x64, Rust 1.98.1, NVIDIA GeForce RTX 5070 Ti + WARP): - **Merge check vs `origin/main` (`63bcca43`):** clean - **RTX 5070 Ti (`cargo test -p victory-gpu --lib --features diagnostics`):** **248 passed**, 2 failed, 1 ignored (2.95s) — the 2 failures are the pre-existing #1744 NVIDIA 1M view-heap cap failures on `main` (`descriptor::host::tests::dynamic_slots_are_held_until_released`, `memory::tests::lists_share_a_table_and_copies_keep_their_views`); no regressions and all 4 new tests pass on hardware - **WARP (`VICTORY_D3D12_WARP=1`):** **250 passed**, 0 failed, 1 ignored (1.94s) - **Clippy (`-p victory-gpu --lib --tests --features diagnostics -- -D warnings`):** clean (0 warnings) - **`cargo xtask policy`:** 191 files ok Not tested: live title workload / real device-removal fault under gameplay. *AI-assisted test run and summary.*
Author
Owner

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

Reviewed the diff and verified locally on Windows 11 x64:

  • removal_cause cleanly surfaces the error(s) from the D3D12 call immediately preceding D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_{AT_FAULT,POSSIBLY_AT_FAULT} while preserving the first error for context when it came from an earlier call.
  • cargo test -p victory-gpu --lib host::removal_cause_tests:: -- --test-threads=1: 4 passed, 0 failed.
  • cargo clippy -p victory-gpu --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:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/3260#pullrequestreview-6076520932) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64: - `removal_cause` cleanly surfaces the error(s) from the D3D12 call immediately preceding `D3D12_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_{AT_FAULT,POSSIBLY_AT_FAULT}` while preserving the first error for context when it came from an earlier call. - `cargo test -p victory-gpu --lib host::removal_cause_tests:: -- --test-threads=1`: 4 passed, 0 failed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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/3260/head:github-bot/gh-3260'
git switch 'github-bot/gh-3260'

Merge

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