Leave a title list's new host list open when its recording is taken #311

Manually merged
github merged 2 commits from github-bot/gh-311 into gh-pr/311/base 2026-11-27 18:09:31 +00:00 AGit
Owner

@⁠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 UTC

At 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 Reset found 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 Close of 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::detach and list::detach_parts leave the new host list open. HostList::reset already 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 next Reset of that list.
  • A list the title submits again without a reset in between would now give an open host list to the queue. HostList::close_if_open closes it when it is taken, in both functions.

Tests

  • Run on this branch at 2736ab2 (base c44e2ce), Windows 11, RTX 5080, Ryzen 7 9800X3D, 64 GB:

    Command Result
    cargo check --workspace --all-targets --locked clean
    cargo test --locked -p victory-gpu --features diagnostics --lib -- list:: 5 passed, 0 failed
    cargo build --locked --profile diag -p victory --features diagnostics (before the rebase onto c44e2ce, which was clean) builds
    git diff --check clean

    The four CI commands were run once on a local merge of this branch with five other branches of mine, on base fe8a7a2 before the rebase: both clippy commands clean, cargo test --workspace --locked passed, and cargo test --workspace --all-features --locked -- --test-threads=1 passed except modules::lifecycle::tests::direct_close_suspends_and_exits in victory-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

  • No unit test covers the open list through a real Reset or 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, so close_if_open on that path is covered by reading only.
  • The close of the empty list is moved, not removed: its cost on the translating threads was not measured.
  • One PC, one card, one driver.

Since the runs above the branch was rebased onto main at 16edfec (no conflicts; cargo check -p victory-gpu --all-targets --locked clean); its tip is b4936ba now.

**@⁠wondasahnet** on GitHub · 2026-11-27 15:38 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/311) `wondasahnet:perf/detach-leaves-list-open` → `main` · +382 −15 · 2 files · 2 commits · merged 2026-11-27 18:06 UTC At 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 `Reset` found 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 `Close` of 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::detach` and `list::detach_parts` leave the new host list open. `HostList::reset` already 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 next `Reset` of that list. - A list the title submits again without a reset in between would now give an open host list to the queue. `HostList::close_if_open` closes it when it is taken, in both functions. ## Tests - Run on this branch at `2736ab2` (base `c44e2ce`), Windows 11, RTX 5080, Ryzen 7 9800X3D, 64 GB: | Command | Result | |---|---| | `cargo check --workspace --all-targets --locked` | clean | | `cargo test --locked -p victory-gpu --features diagnostics --lib -- list::` | 5 passed, 0 failed | | `cargo build --locked --profile diag -p victory --features diagnostics` (before the rebase onto `c44e2ce`, which was clean) | builds | | `git diff --check` | clean | The four CI commands were run once on a local merge of this branch with five other branches of mine, on base `fe8a7a2` before the rebase: both clippy commands clean, `cargo test --workspace --locked` passed, and `cargo test --workspace --all-features --locked -- --test-threads=1` passed except `modules::lifecycle::tests::direct_close_suspends_and_exits` in `victory-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 - No unit test covers the open list through a real `Reset` or 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, so `close_if_open` on that path is covered by reading only. - The close of the empty list is moved, not removed: its cost on the translating threads was not measured. - One PC, one card, one driver. --- Since the runs above the branch was rebased onto `main` at `16edfec` (no conflicts; `cargo check -p victory-gpu --all-targets --locked` clean); its tip is `b4936ba` now.
At every submission each of the title's lists (216 a frame in the Series S
prison scene) was given a host list from the idle ones, reset and open,
which was then closed empty at once so that the title's next Reset found
it closed: 3.8% of the submitting thread's samples, in the driver's Close
(RTX 5080, Ryzen 7 9800X3D, 4070 profile). HostList::reset already closes
a recording that is discarded, and runs on the thread that translates the
title's calls.

The new list now stays open. One the title submits again without a reset
is closed when it is taken (HostList::close_if_open).

The profile share is the evidence; the frame rate was not measured with
this change alone.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 15:43:35 +00:00
Author
Owner

@⁠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.

**@⁠TaynanGT** on GitHub · 2026-11-27 15:54 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/311#issuecomment-7222620207) @⁠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.
A title list's new host list is left open when its recording is taken.
That a host list is closed when it reaches execution then rests on two
paths: the title's next Reset closes the open list before it records
again, and a list submitted twice with no Reset in between is closed
when it is taken. Both were covered by reading only.

The open or closed state of a host list is now a small state of its own
(host::Recording) that HostList asks what to do with its native list:
open when made or reset, left open when handed to a title's list, closed.
It counts what closes a list that was left open: the title's next Reset,
a second submission without a Reset, a Close with no Reset before it.
A recording the title submits without a Close is counted apart.

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; the check is one load a list.
The diagnostics build writes the counts since the start with its lines
every five seconds.

Tests, without a device: a list left open, reset, closed and submitted;
a list submitted twice without a Reset; a list open at the queue; each
way of closing counted once. With a device (hardware and WARP here): a
title's list through its own Close, Reset and three submissions, the
second without a Reset before the third, each host list closed where it
is taken, none found open at the queue, each run by a real submission
with the device still there; and an open host list given to a
submission is closed by the check and runs.
Author
Owner

@⁠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). HostList asks 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.

  • Next Reset: a_list_left_open_is_closed_by_the_next_reset_and_closed_when_submitted (state only), and list::tests::host_lists_reach_execution_closed_after_a_reset_and_when_submitted_twice with a device: a title list's own Close, a submission's detach, the title's Reset (which has to close the open native list before the allocator can be reset), a command, Close, a second detach. The host list taken is closed.
  • Twice before Reset: a_list_submitted_twice_without_a_reset_is_closed_when_taken (state only), and in the same device test a third detach with no Reset before 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_runs hands 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 a Reset, closed with something recorded and no Reset before; recordings the title submitted without a Close; 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's main merged in. The last counters line of the log, since the start:

host lists left open when their recording was taken 945,537
closed by the title's next Reset 915,256
closed when the list was submitted again without a Reset 29,983
closed with something recorded and no Reset before 0
recordings submitted without a Close 0
found open where lists go to the queue 0

The 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, and cargo clippy --workspace --all-targets --locked -- -D warnings with 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.

  • Where a submission takes a list's recording, a second submission of that list with no Reset in between, in another ExecuteCommandLists call, 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.
  • The device test drives 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.
  • The empty close is moved to the title's next Reset, not removed; its cost on the translating threads is not measured.
**@⁠wondasahnet** on GitHub · 2026-11-27 17:59 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/311#issuecomment-7225006953) 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). `HostList` asks 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. - Next `Reset`: `a_list_left_open_is_closed_by_the_next_reset_and_closed_when_submitted` (state only), and `list::tests::host_lists_reach_execution_closed_after_a_reset_and_when_submitted_twice` with a device: a title list's own `Close`, a submission's `detach`, the title's `Reset` (which has to close the open native list before the allocator can be reset), a command, `Close`, a second `detach`. The host list taken is closed. - Twice before `Reset`: `a_list_submitted_twice_without_a_reset_is_closed_when_taken` (state only), and in the same device test a third `detach` with no `Reset` before 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_runs` hands 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 a `Reset`, closed with something recorded and no `Reset` before; recordings the title submitted without a `Close`; 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's `main` merged in. The last counters line of the log, since the start: | | | |---|---:| | host lists left open when their recording was taken | 945,537 | | closed by the title's next `Reset` | 915,256 | | closed when the list was submitted again without a `Reset` | 29,983 | | closed with something recorded and no `Reset` before | 0 | | recordings submitted without a `Close` | 0 | | found open where lists go to the queue | 0 | The 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`, and `cargo clippy --workspace --all-targets --locked -- -D warnings` with 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.** - Where a submission takes a list's recording, a second submission of that list with no `Reset` in between, in another `ExecuteCommandLists` call, 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. - The device test drives `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. - The empty close is moved to the title's next `Reset`, not removed; its cost on the translating threads is not measured.
Author
Owner

@⁠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 c65e462 against current main when CI finishes.

**@⁠TaynanGT** on GitHub · 2026-11-27 18:02 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/311#issuecomment-7225063444) @⁠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 `c65e462` against current main when CI finishes.
github-bot changed target branch from main to gh-pr/311/base 2026-11-27 18:09:31 +00:00
github manually merged commit c65e462da8 into gh-pr/311/base 2026-11-27 18:09:31 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.