GPU: safely reset an open host command list #2977
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2979"
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?
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T02:08:16Z.
An open VIctory command list can reach the host allocator reset without being closed. On D3D12 this returns
E_FAILand VIctory terminates. A second guestClosecan also reach the same host list after it is closed.Keep the recording state on the host list. Close an open host recording before resetting its allocator and skip repeated native closes.
Close,ResetandResetXkeep VIctory's existing guest result codes. The existing guest restart still discards the old commands, deferred work and state.The same synthetic guest-vtable test aborts at the first host reset on
63bcca43. At4f97c15it passes for direct and copy lists on Windows app-local WARP. It covers resetting a recording, discarding deferred work throughResetandResetX, repeated closes, the null-allocator error, and submitting the reset list. The focused test also passes with GPU timing enabled. The full GPU suite passed 247 tests with one ignored. Strict GPU Clippy passed with default and all features, and asset policy passed.The host precondition comes from the Windows D3D12 API. Command allocator reset
Coordination claim
Please retain the Git author when reapplying this change. If you fold it into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T02:20:34Z.
Review: COMMENTED
Reviewed and verified against
main(63bcca43) on Windows 11 (RTX 5090 + WARP,VICTORY_D3D12_DEBUG=1) — clean state-machine validation and ready to merge:List::recordingtracks guest open/closed state accurately: duplicateClosereturnsE_FAILwithout re-closing the host list;Resetvalidatesallocator.is_null()(E_INVALIDARG) before checkingrecording, returnsE_FAILon an open list without clobbering state, and flipsrecording = trueon valid reset.Ordering::AcqRelinstead ofRelaxedonrecording.swap(...)would be safer if a title ever callsClose/Resetacross threads.)Local verification:
victory-gpu(list::,draw::,queue::,resource::withVICTORY_D3D12_DEBUG=1): 48/48 passed on both RTX 5090 and WARP (--features diagnostics), includinglist_close_and_reset_follow_the_guest_recording_statecargo clippy --all-targets -- -D warnings(default &--features diagnostics) +cargo xtask policy(191 files ok): 0 warningsImported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T02:24:12Z.
Review: COMMENTED
Verified: tracking guest recording state makes Close-on-closed and Reset-on-open return E_FAIL, matching D3D12 list semantics (tested sequence reset→E_FAIL, close→OK, close→E_FAIL, reset→OK, reset→E_FAIL, close→OK). AtomicBool is the right fit — list calls can race. Also good that the uploads lock-take moved after the recording gate, so a failed Reset no longer drains the upload list.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T02:27:34Z.
Thanks for the RTX 5090 and WARP checks. D3D12 requires the caller to serialize methods on the same command list. For a handoff between threads, the caller's synchronization covers the entire Close or Reset operation, including the guest recording bit. The atomic is a lifecycle flag.
Review note · Command list threading contract
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T05:40:42Z.
Automated triage for the maintainers.
Merge candidate (recommending a look, not approving). Thanks for taking the narrower route. The guest
Close/Reset/ResetXinlist.rsreturn the same codes as onmain, so the title sees no change. The fix is now host-side only, inHostList(crates/victory-gpu/src/host.rs):recordingflag makesclosea no-op on an already closed list;resetcloses an open recording before it resets the allocator.This avoids the host
E_FAILonmainwhen the title resets an open list. I checked the other callers:waitcloses a segment and thenrestart/recyclereset it, which still works because a closed list skips the second close.command_list_can_discard_an_open_recordingchecks the HRESULTs and that discarded deferred work never runs, for direct and copy lists.CI: passing (
check).Generated by Claude Code
[PR #2979] GPU: validate command list Close and Reset stateto [PR #2979] GPU: safely reset an open host command listImported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T06:11:08Z.
I took the narrower option in the review. Commit
4f97c15restores the existing guestClose,ResetandResetXresult codes. The host closes an open recording before resetting its allocator and ignores a second native close.The same synthetic test on
63bcca43reaches hostE_FAILduring the first reset. On the updated head, direct and copy lists discard the queued work, preserve the null-allocator check and can submit after resetting. Windows app-local WARP passed the focused case with and without GPU timing and 247 GPU tests with one ignored. Both strict GPU Clippy configurations and asset policy passed.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T07:29:55Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):cargo test -p victory-gpu list::tests -- --test-threads=1(RTX 5090 & WARP): 5 passed, 0 failed on both (includingcommand_list_can_discard_an_open_recording).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).
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.