Repository navigation
Conversation
When the title resets a list that a queue still holds part of (a wait
the queue has not seen hold yet), restart() replaces each held host list
with a spare or a new one. When none could be made (CreateCommandList or
CreateCommandAllocator failing once system memory for the GPU ran out),
it kept the held one in place: the title then recorded into a list that
was closed and the queue's, closing it again failed (E_FAIL, "a host
command list did not close"), a later submission would have run it a
second time, and leave() did not get it, so the title list's uploads
and state could be freed while it ran.
Now the title list's host lists end before that one: it and any held
after it are the queue's, and leave() gets the last held one; the
closed ones after it go back to the spares once no queue holds them,
and those not recorded since the last reset (still open: resetting them
would fail) are dropped. A title list without a host list records
nothing until its next reset, which takes a spare or makes one if it
can. A wait that starts a new segment also takes a spare before making
a list, and a list that cannot be made is logged ("no host command
list").
In the prologue's intro on a 16 GB machine, once the shared buffers
began failing with E_OUTOFMEMORY, making a host list failed 41 times in
one run of this change alone ("no host command list"), and no Close
failed then. The run still stopped
34 s later, as runs without it do, at a Close that itself returned
E_OUTOFMEMORY: that failure is the allocation's, not this one.
Tests: early_reset_without_a_new_host_list_does_not_keep_the_closed_one
(no host list is left, closing does not fail, the next reset gets one);
a_reset_that_cannot_replace_a_held_host_list_cuts_the_list_there (three
segments made, reset, then two recorded so the third is still open, and
both held: the last held one keeps what the title list owned; again with
only the first held: the closed one cut off goes back to the spares and
the open one is dropped, which a reset of it would not survive).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kotekompotek
left a comment
There was a problem hiding this comment.
LGTM — real bug correctly contained: previously an unreplaced held list stayed attached, so a later Close failed and submission could re-run it. The keep-cutoff drains everything past the failed segment (held last one keeps ownership via left, recorded ones recycle once the queue frees them, open ones drop since reset would fail), and the empty-hosts case now gets a list on reset. take_list() shares the spare pool with next_segment; NO_NEW_LIST gives a clean deterministic test hook.
fuzeofficlal
left a comment
There was a problem hiding this comment.
Code review on ba252aa3 (static source inspection; no runtime GPU execution):
- P2 — Failed replacement leaves
hostsempty whileReset/Closestill returnS_OK, allowing dropped work and premature CPU completion writes (crates/victory-gpu/src/list.rs):- In
restart, when segment0is still held by a queue andtake_list()returnsNone,keepbecomes0andhosts.drain(0..)leaveslist.hostsempty, yetResetandClosestill returnS_OK. - If the title subsequently records dispatches/draws followed by
Write64BitValueBottomOfPipeXon that list, the recorded GPU commands silently no-op (with_statesees no host list), while the bottom-of-pipe completion write can still fire immediately on the CPU, releasing dependent queues onto stale data. Similarly, ifrestartretains a non-empty prefix and a laternext_segmentallocation fails during recording, subsequent waits/commands are silently dropped. - Suggest propagating the allocation failure from
Resetwhen segment0cannot be replaced, and latching mid-recording segment allocation errors to failClose(keeping incomplete recordings out of queue submission while still preserving the previously submitted queue-held host list).
- In
Review follow-up. When a reset could not replace a held first host list, the title list was left with none, yet Reset and Close returned S_OK and a bottom-of-pipe write recorded next was done on the CPU at once (the path for no host GPU), telling the title the list had run. A wait that could not start a new host list (memory ran out) was dropped, and what followed it ran without it. Now, as D3D12 does, Reset and Close return E_OUTOFMEMORY for a list with no host list to record into, and its bottom-of-pipe writes are not done. A wait that finds no host list to go on in closes the one being recorded and loses the recording until the next reset: nothing more is recorded, Close returns E_OUTOFMEMORY and a submission of it runs nothing. The next reset starts again in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
@fuzeofficlal Thanks, both points were real. The first one this PR introduced: before it, that case kept the held list attached and the run stopped at
|
|
Automated triage for the maintainers. Merge candidate. This fixes One thing for the maintainer to weigh: CI: passing. Recommending a look, not approving. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):
- Diff review: Tracking a
lostflag onListwhen a host list cannot be replaced on early reset or wait-cut cleanly avoids mutating a still-held host command list or executing commands past a missing wait. cargo test -p victory-gpu list::tests -- --test-threads=1(RTX 5090 & WARP): 7 passed, 0 failed on both (including all 3 new early-reset/wait-cut tests).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).
… it cannot replace
fuzeofficlal
left a comment
There was a problem hiding this comment.
Re-reviewed and verified 1ca6e507 on Windows 11 with RTX 5090, WARP (VICTORY_D3D12_WARP=1), and D3D12 Debug Layer (VICTORY_D3D12_DEBUG=1).
Both issues from the earlier review of ba252aa3 are cleanly resolved:
- When
restart(crates/victory-gpu/src/list.rs:291-342) cannot replace a queue-held host list at segment0,reset(list.rs:555-557) andclose(list.rs:525) now returnE_OUTOFMEMORY, anddefer_write(list.rs:1812-1815) suppresses premature CPU bottom-of-pipe writes when a host GPU is present. - When
wait(list.rs:220-229) fails to allocate a next segment after recorded commands, closing the current host list and latchinglost = truestops further recording (host_listreturnsNone,segmentsreturns empty,closereturnsE_OUTOFMEMORY) while keeping the closed segments resettable in place on the nextreset. - Traced open/closed segment states across
wait,restart,close, andrecycle: only closed segments (k <= used) are reset or recycled, while untouched open trailing segments are dropped.
Verification:
cargo xtask policy(191 files ok) andcargo clippy -p victory-gpu --tests -- -D warnings(default and--all-features): clean.- RTX 5090 (default):
list::tests7/7 (including all three new tests),hold::10/10,queue::5/5 passed. - RTX 5090 +
VICTORY_D3D12_DEBUG=1(--features diagnostics):list::testspassed 5/5 consecutive runs (35/35) with zero Debug Layer errors. - WARP +
VICTORY_D3D12_DEBUG=1(--features diagnostics):list::tests7/7,hold::10/10,queue::5/5 passed.
What
When the title resets a command list while a queue still holds part of it
(a wait the queue has not seen hold yet; D3D12 lets a list be reset as
soon as it is submitted),
list::restartreplaces each held host listwith a spare or a new one. When none can be made, because
CreateCommandAllocator/CreateCommandListfail with E_OUTOFMEMORY oncesystem memory for the GPU has run out, it kept the held host list in
place:
queue held, and closing it again failed (
Closereturns E_FAIL: "a hostcommand list did not close (0x80004005)");
second time;
leavedid not get it, so the title list's upload memory and drawstate could be freed while the queue still ran that host list.
This PR makes the title list's host lists end before the first held one
that cannot be replaced:
leavegets the lastheld one (the last to run);
them; those not recorded since the last reset are still open and are
dropped, since resetting an open list fails;
which takes a spare or makes one if it can; as D3D12 does when memory
runs out,
ResetandClosereturn E_OUTOFMEMORY for it, and itsbottom-of-pipe writes are not done (they used to be done on the CPU at
once, as without a host GPU, telling the title the list had run);
one being recorded and loses the recording until the next reset: it
used to be dropped, and what followed ran without it. Now nothing more
is recorded,
Closereturns E_OUTOFMEMORY and a submission of the listruns nothing; the next reset resets its host lists in place;
next_segmenttries the spares before making a new host list, and ahost list that cannot be made is logged ("no host command list").
Tests
list::tests::early_reset_without_a_new_host_list_does_not_keep_the_closed_one:a list is closed and held (as by a queue), then reset while no host list
can be made. The reset returns E_OUTOFMEMORY and the list has no host
list afterwards; a bottom-of-pipe write recorded then does not land,
closing it returns E_OUTOFMEMORY, and once the held one is given back,
the next reset gets one again.
list::tests::a_reset_that_cannot_replace_a_held_host_list_cuts_the_list_there:three segments made, the list reset, then two recorded (the third still
open) and both held. The last held one keeps what the title list owned
(one more piece of work after it runs), and the title list holds none of
them. Again with only the first held: the closed one cut off goes back
to the spares, and the open one is dropped (with it reset instead, the
test process stops at "a host command list did not reset").
list::tests::a_wait_without_a_new_host_list_loses_the_recording: alist cut once by a wait, then a second wait while no host list can be
made. Nothing past it is recorded, no bottom-of-pipe write lands,
Closereturns E_OUTOFMEMORY, a submission gets no host lists, and the next
reset, still without new host lists, starts again in the list's own
first one.
cargo test -p victory-gpu: 234 passed.cargo clippy --workspace --all-targets -- -D warnings, with and without--all-features: clean.cargo xtask policy: ok. The other crates' tests pass, except twovictory-shadertests that fail on my machine with a DXIL validationerror (
rectangles_get_their_fourth_corner,elements_sharing_a_row_keep_their_order); this PR does not touch thatcrate.
main(2 of 30 against 1 of 30), each time in
shadow::tests::partial_refresh_under_marked_range_updates_saved_bytes,which GPU: a marked page's copy-back writes only the bytes the shaders changed, with plain stores #2918 addresses.
In game
Machine: RX 7800 XT 16 GB, Ryzen 5 5600, 16 GB RAM, Windows 11, Series X
profile, diagnostics build. My own copy of the title was used; only log
lines, counts and timings are reported here.
CreateCommittedResourcefor shared (CUSTOM, L0) buffers fail withE_OUTOFMEMORY after 2.5 to 5 minutes. In one run of this change alone,
making a host list then failed 41 times ("no host command list", which
covers this case and the other places a host list is made), and no
Closefailed then.Closethat itself returned E_OUTOFMEMORY, as runs without this change do. That
failure comes from the memory running out, not from the list kept in
place; this PR does not address it, so it does not make such runs last
longer.
main, 13f91ca)stopped there with E_FAIL instead, which matches a list closed twice; I
did not confirm that with the debug layer, which is not installed here.
AI-assisted: written with Claude Code (Claude Opus 5.5) and reviewed by
Gemini 4 Neon. I read the code and the reviews, and ran the in-game tests
on my machine.