GPU tests: a device removal fails the test that found it, later tests skip (#2317 item 1) #2430
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2430
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2430"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@KainanP on GitHub · 2026-11-25 13:25 UTC · original
KainanP:fix/gpu-test-device-removal→main· +291 −3 · 2 files · 2 commits · openPart of #2317 (item 1: one device removal takes the whole
victory-gputest run down with it). Items 2 and 3 are covered by #2315 / #2322 and are not touched here.Root cause
The
victory-gputests share one host device:host()keeps it in aOnceLock, and D3D12 hands a process the same device per adapter anyway. When a test removes it:Host::executesees the removal and callsfail(). In tests nothing seton_failure, sofail()callsstd::process::abort(). On Windows that is__fastfail, which shows up as0xc0000409(STATUS_STACK_BUFFER_OVERRUN). That is the "stack overrun" in the issue. The report goes throughtracing::error!, and tests have no subscriber, so it is lost. The binary dies mid-line (test x ...and nothing after it) without naming a test or a reason.0x887A0005. Each of those failures looks like its own bug, and the test that actually removed the device may not even fail.Design (test builds only; runtime builds are unchanged)
New
#[cfg(test)] mod host::removal, wired intohost.rswith#[cfg(test)]hooks only:fail()panics in the test that called it instead of aborting. Its message already hasdevice removed: <reason>plus the DRED data (removal_data) when it is on. On avictory-*worker thread, which tests do not join, it writes the report to stderr and aborts as before.fail(), inhost(), or in a panic. The harness writes one line to the real stderr (outside libtest's capture, so it still shows if the process ends early). WithVICTORY_D3D12_DRED=1(diagnostics builds) the line also carries the DRED/breadcrumb data:victory-gpu tests: `<test>` found the host device removed (0x887A0005 …); GPU tests after it skip the host GPUhost()returnsNoneto every other test. Tests already treat that as "no host GPU here" and return early, and runtime code called through the console's tables already handlesNone. Each skipping test writes one line:`<test>` skips the host GPU: the device was found removed in `<culprit>` (<reason>). The recorded test keeps its host, so it fails on its own calls.host()itself never panics, because it is reached fromextern "system"functions, which cannot unwind.the host device is removed (<reason>); this test was the first to find it so …. In any other test:the host device was found removed in `<culprit>` … this failure may only follow from that. This mainly helps tests already running in parallel when the removal happened.I did not recreate the device for later tests. Many statics hold objects made on the device: descriptor heaps, title-buffer copies, pipelines and root signatures, the bindless upload list. A new device would mix objects from two devices. A skip is honest and keeps the scope to tests.
Known limit: if
fail()is reached under anextern "system"frame (a test calling a console table function that submits), the panic cannot unwind past that frame and the process still aborts. The stderr line naming the test and the reason is written before that happens.Tests
host::removal::tests::a_test_that_removes_the_device_fails_aloneruns this test binary in child processes, because a removal in-process would remove the device for every test. In each child,child_1removes the device withID3D12Device5::RemoveDeviceand then either submits a list (submission), makes a device call (call), or does nothing more (unnoticed).child_2andchild_3are ordinary GPU tests that run after it.--test-threads=1keeps them in that order. The parent checks that:child_1, orchild_2in theunnoticedcase, since it is the first to find the removal), with the reason;The
child_*tests do nothing unlessVICTORY_TEST_REMOVES_DEVICEis set, so the normal run never removes the shared device. The assertions use only our own English strings, not the localized HRESULT text.Before (main
940d32f, same test):-1073740791(0xc0000409) aftertest …child_1_removes_the_device ..., no messagechild_1,child_2,child_3all FAILED with the sameHRESULT(0x887A0005)unwrapchild_1ok (the culprit passes),child_2andchild_3FAILED with the same unwrapThe parent test fails on main, on RTX and on WARP:
left: Some(-1073740791) right: Some(101).After: in every scenario exactly one test fails and names the reason, the later ones are
okwith the skip line, and the exit code is 101. The parent test passes.Results
RTX 4060 Laptop (driver 610.47), Windows 11 26200, Rust 1.98.1. WARP is
VICTORY_WARP=1 VICTORY_D3D12_WARP=1with--all-features, becauseVICTORY_D3D12_WARPneeds thediagnosticsfeature.940d32fcargo test --workspace --locked --no-fail-fast(RTX)--all-features(RTX)--all-features, WARPcargo clippy --workspace --all-targets [--all-features] -- -D warningscargo xtask policyOn both sides, the RTX failures are the known ones:
dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views(NVIDIA heap cap, #2315), plus the threevictory-shadertests fixed by #2322. The WARPvictory-shaderfailures (gathers_at_a_level_match_the_hardware,permutes_read_the_lane_named_and_zero_from_lanes_left_out) are identical on main. The new test also passes inside the full parallel run on both adapters. ARemoveDevicein the child process does not disturb the parent's device. WithVICTORY_D3D12_DRED=1the found-removed line carries the breadcrumb data.No game data was used: everything here is
cargo test.AI use: Claude Code (Claude Opus 5.5)
🤖 Generated with Claude Code
@oni-swr on GitHub · 2026-11-25 13:50 UTC · original
Verification — head
d38411372a6508280adb7d76d0413ff5d888d9dcEnvironment: Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, DXC/dxil 1.8.2502.11 (Windows Kits 10.0.26100.0 x64).
origin/main=940d32f69b22265690a0b5a15d6ded572ba33baf; the PR is one commit set on top of it (merge-base = main), so the exact head was tested with no merge needed.cargo test -p victory-gpu --lib --features diagnostics -- --test-threads=1: 150 passed, 0 failed, 2 ignored (+4 vs main). New testshost::removal::tests::a_test_that_removes_the_device_fails_aloneandchild_1/2/3ran and passed: the parent re-runs its own test binary as a child process for the three removal modes (inherits the WARP env) and RemoveDevice works on WARP.diagnostics: clean.cargo xtask policy: ok (183 files).VICTORY_D3D12_WARP=1and--features diagnostics(the switch has no effect without that feature),-- --test-threads=1;warp_adapter_accepts_only_softwareran and passed (adapter vendor 0x1414, software flag). Baselineorigin/mainfor the same command: 146 passed, 0 failed, 2 ignored.Read the full diff first: no process, network or filesystem code beyond what the PR describes; no game data, dumps, shader names or retail hashes involved.
Verified by Claude Code (Claude Sonnet 5.5), an AI assistant; this is a test report, not a code review or approval.
@kotekompotek on GitHub · 2026-11-25 13:52 UTC · original
Verified on Windows 10 / GTX 1050 at
d384113:cargo test -p victory-gpu --lib host::removal— 4/4 pass, including the subprocess harness (a_test_that_removes_the_device_fails_alone) exercising realRemoveDeviceon hardware through all three paths (submission / call / unnoticed).Design notes:
host()→usable()means the culprit test still gets the device (its own calls surface the real error) while every later test seesNoneand skips — matches how the suite already treats host-less machines.failed()panicking only on test threads and writing to stderr onvictory-*worker threads is the right split: workers cannot unwind (called through the console's tables), so the report is logged and the process still ends — now with the culprit named on stderr instead of a bare0xc0000409.REPORTINGgating the panic hook avoids double-annotating the failure report panic itself.#[cfg(test)]throughout;#[cfg(not(test))] host()is the oldcreated()).@Marvisak on GitHub · 2026-11-25 15:33 UTC · original · edited 2026-11-25 20:21 UTC
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. This adds test-only infrastructure in
crates/victory-gpu/src/host.rsandhost/removal.rs. When a test removes the device, that test fails, later tests seehost()asNoneand skip, and stderr names the test that found the removal. Before, the removal cascaded into later tests or aborted the process. All of it is#[cfg(test)], and runtime builds are unchanged. CI is passing.Reply to the author: both points from the last triage are addressed in
ca5f7baa.a_test_that_removes_the_device_fails_aloneis now#[ignore], which matches the#[ignore = "..."]tests already invictory-formats,victory-gpu/src/object.rsandvictory-shader. The note to the test that finds the removal now also covers a test running alongside it. The ignored test still re-runs the test binary throughstd::process::Commandwhen someone runs it. Whether the suite should carry a test that starts processes is still the maintainer's call, so the verdict stays. The PR is ready if the maintainer accepts that test, or wants it dropped.CI:
checkpassing.Generated by Claude Code
@KainanP on GitHub · 2026-11-25 16:56 UTC · original
Rebased onto main
67e8ae14;a_test_that_removes_the_device_fails_alonepasses (RTX/WARP), victory-gpu --all-features passes on RTX exceptdynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, which fail the same way on main (capped NVIDIA heap); clippy and policy pass.AI use: Claude Code (Claude Opus 5.5).
@KainanP on GitHub · 2026-11-25 19:19 UTC · original
Both triage points are addressed in
ca5f7baa:a_test_that_removes_the_device_fails_alonenow carries#[ignore = "starts this test binary again; run with --ignored"], the same convention as the repository's other tests that need more than a plain run (victory-formatsbenchmarks and reference-file tests). A plaincargo testtherefore starts no process;cargo test -p victory-gpu --lib host::removal -- --ignoredruns it. Nothing else in the suite depends on it, so the maintainer can drop it entirely if preferred.RTX 4060 Laptop:
host::removal3 passed, 1 ignored; with--ignoredthe subprocess test passes (1.6 s).cargo clippy -p victory-gpu --all-targets -- -D warningsclean, rustfmt--checkclean.AI use: Claude Code (Claude Opus 5.5) made the change and ran the tests.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.