Leave a title list's new host list open when its recording is taken #311
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!311
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-311"
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?
@wondasahnet on GitHub · 2026-11-27 15:38 UTC · original
wondasahnet:perf/detach-leaves-list-open→main· +382 −15 · 2 files · 2 commits · merged 2026-11-27 18:06 UTCAt every submission each of the title's lists gives up its host list and is handed a new one from the idle ones, reset and open. That new list was then closed, empty, at once, so that the title's next
Resetfound it closed. The close ran on the thread that prepares the submissions, the one a frame waits for.Measured
RTX 5080, Ryzen 7 9800X3D, 64 GB, Windows 11. Series S build, prison intro, windowed, diagnostics build,
-Machine 4070.A sampling profile of the submitting thread: 3.8% of its samples in the driver's
Closeof these empty lists, 216 of them a frame.The profile share is the evidence. The frame rate was not measured with this change alone, and runs of this scene differ by about 1 fps anyway, so I claim no frame-rate change.
What changes
list::detachandlist::detach_partsleave the new host list open.HostList::resetalready closes a recording that is discarded before it resets the allocator, and it runs on the thread that translates the title's calls. So the empty close moves off the submitting thread to the title's nextResetof that list.HostList::close_if_opencloses it when it is taken, in both functions.Tests
Run on this branch at
2736ab2(basec44e2ce), Windows 11, RTX 5080, Ryzen 7 9800X3D, 64 GB:cargo check --workspace --all-targets --lockedcargo test --locked -p victory-gpu --features diagnostics --lib -- list::cargo build --locked --profile diag -p victory --features diagnostics(before the rebase ontoc44e2ce, which was clean)git diff --checkThe four CI commands were run once on a local merge of this branch with five other branches of mine, on base
fe8a7a2before the rebase: both clippy commands clean,cargo test --workspace --lockedpassed, andcargo test --workspace --all-features --locked -- --test-threads=1passed exceptmodules::lifecycle::tests::direct_close_suspends_and_exitsinvictory-hle, a window test in a crate this branch does not touch; it passed in the default job of the same run and when run again alone. After the rebase the merge was linted again with both clippy commands: clean.In game: builds with this change ran the Series S prison intro (cell, corridor, common room, with camera turns and walking) more than a dozen times on the PC above, self-driven, about a minute and a half to three minutes each. None of the logs has a "host command list did not close" or "did not reset" line.
Not covered
Resetor the second submission without a reset: both need a host device and a title list. Whether the title ever submits a list twice without a reset in these scenes was not checked, soclose_if_openon that path is covered by reading only.Since the runs above the branch was rebased onto
mainat16edfec(no conflicts;cargo check -p victory-gpu --all-targets --lockedclean); its tip isb4936banow.@TaynanGT on GitHub · 2026-11-27 15:54 UTC · original
@wondasahnet The 216 empty closes per frame identify a concrete source of submit-thread work. The important checks now are the next Reset and submitting the same title list twice before Reset. Both should reach execution with a closed host list.
@wondasahnet on GitHub · 2026-11-27 17:59 UTC · original
Done in
c65e462, on top of the reviewed tip.Both cases are checked now, not read.
The open or closed state of a host list is a small state of its own (
host::Recording: open when made or reset, left open when handed to a title's list in place of the recording a submission took, closed).HostListasks it what to do with its native list, so the two cases can be tested without a device and are then driven through the real code with one.Reset:a_list_left_open_is_closed_by_the_next_reset_and_closed_when_submitted(state only), andlist::tests::host_lists_reach_execution_closed_after_a_reset_and_when_submitted_twicewith a device: a title list's ownClose, a submission'sdetach, the title'sReset(which has to close the open native list before the allocator can be reset), a command,Close, a seconddetach. The host list taken is closed.Reset:a_list_submitted_twice_without_a_reset_is_closed_when_taken(state only), and in the same device test a thirddetachwith noResetbefore it: the list that was left open is taken, and it is closed when taken.In the device test every host list taken then goes through a real submission (
Host::execute): the check at the queue finds none open, the lists run, and the device is still there afterwards. It passes on the hardware device and on WARP (VICTORY_D3D12_WARP=1).Closed at execution is enforced. Where lists go to the queue (
Host::submit, and before a submission is cut) a list that is still open is closed there with what it holds, counted, and logged: the first four, then every one that doubles the count. No path is known to lead there; it costs one load a list.an_open_host_list_given_to_a_submission_is_closed_and_runshands a submission an open list on purpose: it is closed by the check and runs.Counters. Since the start, written by the diagnostics build with its lines every five seconds: host lists left open at detach; of those, closed by the title's next
Reset, closed when submitted again without aReset, closed with something recorded and noResetbefore; recordings the title submitted without aClose; lists found open at the queue.One self-driven run with them: Series S build, prison intro,
-Machine 4070, about three minutes in the world with the camera turning and walking, frame generation on. The build is this commit on a tree that has today'smainmerged in. The last counters line of the log, since the start:ResetResetResetbeforeCloseThe 298 not accounted for were still in their title lists, open, when the run was ended. The log has no "did not close", no "did not reset" and no "still open where they go to the queue" line, and no line at error level.
So the answer to "does the title submit a list twice before
Reset" is yes, in this run 29,983 times, about 3 in 100 of the lists taken. Every one of them reached the queue closed.Checks.
cargo check --workspace --all-targets --locked, andcargo clippy --workspace --all-targets --locked -- -D warningswith and without--all-features: clean.cargo test --locked -p victory-gpu --features diagnostics --lib -- recording_tests list::: 11 passed; the same without the diagnostics feature: 11 passed.Merged locally with today's
main: no conflict, the 11 tests pass and both clippy commands are clean.Not covered.
Resetin between, in anotherExecuteCommandListscall, runs an empty host list: the recording went with the first. That was so before this pull request as well (the list given in its place was closed empty); this change makes sure it is closed and counts how often it happens: 29,983 times in the run above. I have not looked at what those lists held the first time, so I cannot say whether anything is missing from the picture because of it; it is not something this pull request changes.list::detach.detach_parts(lists cut at waits for memory values) has the same two lines and is covered by the check at the queue and the counters, not by a test of its own.Reset, not removed; its cost on the translating threads is not measured.@TaynanGT on GitHub · 2026-11-27 18:02 UTC · original
@wondasahnet The real submissions cover both the next Reset and the repeat submit, with closed lists on hardware and WARP. The 29,983 repeats show why that second check matters. The queue guard also covers split lists when they reach execution. I’ll use the original Close profile as the performance baseline and check
c65e462against current main when CI finishes.