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

Open
potatoe0100 wants to merge 1 commit from upstream-pr/3260 into main
potatoe0100 commented 2026-11-26 14:51:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by potatoe0100 on 2026-11-26T14:51:03Z.


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)

<!-- greyfinch-sync:Marvisak/VIctory:issue:6629219008 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3260). Originally posted by [potatoe0100](https://github.com/potatoe0100) on 2026-11-26T14:51:03Z. --- ## 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)
Bj0rnis commented 2026-11-26 15:02:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bj0rnis on 2026-11-26T14:58:30Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7195599884 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3260#issuecomment-7195599884). Originally posted by [Bj0rnis](https://github.com/Bj0rnis) on 2026-11-26T14:58:30Z. --- 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.*
Dukestar69 commented 2026-11-26 16:04:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T15:11:08Z.

Review: APPROVED


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

<!-- greyfinch-sync:Marvisak/VIctory:review:6076520932 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3260#pullrequestreview-6076520932). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T15:11:08Z. **Review:** APPROVED --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3260:upstream-pr/3260'
git switch 'upstream-pr/3260'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3260'
git switch 'upstream-pr/3260'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3260'
git switch 'upstream-pr/3260'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3260'
git switch 'main'
git merge --squash 'upstream-pr/3260'
git switch 'main'
git merge --ff-only 'upstream-pr/3260'
git switch 'main'
git merge 'upstream-pr/3260'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!3258
No description provided.