Drop retired host objects on a thread of their own (VICTORY_REAPER=1) #247

Open
github-bot wants to merge 2 commits from github-bot/gh-247 into main AGit
Owner

@⁠CristianCiubancan on GitHub · 2026-11-27 12:01 UTC · original
CristianCiubancan:perf/reaper-thread → main · +151 −1 · 1 files · 2 commits · open

One commit on main at 63e2c98. Off by default.

What

What bury drops was dropped by the thread that had just landed a flight. With VICTORY_REAPER=1 the objects go to a list and a thread of ours (victory-reaper) drops them, handed over at the moment they were dropped before, never earlier. VICTORY_AB=<s>,VICTORY_REAPER does each in turn in one run. It follows the switch of the same name in fxceless/victory-fork, which this tree did not have; here it covers bury only.

Why

On an RTX 5070 Ti the first minutes in the world ran at 8 to 9 fps and then went to 17 to 20 by themselves, in every run. In the slow stretch the card was about 29 % busy and the submitting thread stood waiting for flights: 54 ms a frame in settles (lists in the air 29.5 ms, title memory read 24.8 ms), with the relay's line at 102 ms of landing a frame against 25 ms later in the same run.

A VICTORY_PROFILE window over that stretch put the relay thread 79 % of its samples in host::bury → drop<Vec<(u64, Retired)>> → D3D12Core → nvwgf2umx → win32u. While the world streams in the title lets go of thousands of objects a second, and each drop is a call into the driver on the thread everything else was waiting for. On the reaper the same drops cost about 1 µs each (1.17 million in 0.62 s of that thread in one run), so it is not the drops themselves that are slow there.

Measured

RTX 5070 Ti 16 GB (driver 32.0.16.1088), Ryzen 7 9850X3D, 32 GB, Windows 11. Diagnostics build of this branch, Series S, -Machine 4070 -Windowed with VICTORY_PIPELINE_WORKERS=8, shaders translated and pipelines warmed ahead. A self-driven run: the same copy of the saves each time, Enter through VICTORY_KEYS_FILE until the world draws, then a fixed route of scripted keys for 300 s. Runs alternated without, with, without, with. Figures are from the once-a-second frame lines over 1,000 draws, the first four left out.

without, run 1 without, run 2 with, run 1 with, run 2
fps median 18.2 14.6 19.5 19.2
fps p10 15.3 7.0 17.5 17.8
ms per frame, median 56.1 100.6 51.4 52.1
submitting thread's work, ms a frame 53.2 78.8 49.1 49.0
submitting thread waiting for the card, mean ms a frame 5.0 28.3 0.1 0.1
relay thread landing, mean ms a frame 26.6 57.5 15.5 15.2
game memory, peak private 21.8 GB 23.4 GB 21.4 GB 21.4 GB

The slow stretch lasted about 35 s in the first run without the switch and about 2.5 minutes in the second; neither run with it has one. On the base I first measured on (3da964a, two runs each way, same route) it lasted 3 to 4 minutes without the switch: medians 9.5 and 12.6 fps without, 18.1 and 19.2 with, and peak private memory 24.8 and 23.4 GB against 21.3 and 21.3 GB.

No errors and no device loss in any of the runs.

Limits

  • One PC, one card, two runs each way on each base. The length of the slow stretch varies from run to run without the switch, so the medians without it scatter widely.
  • The picture: one hand-played full-screen session of about ten minutes with the switch on looked normal. It was not recorded, so there is no video to go with this.
  • The card's memory comes back some milliseconds later than before. The reaper logs how many objects wait every 16,384 dropped; the most I saw waiting was about 40,000 for a moment while the world loaded, usually 0.
  • Off by default for those reasons. On this PC I would turn it on in the NVIDIA settings of play.ps1; that is left for you to judge from other cards.

Checks

cargo test -p victory-gpu --locked --lib reaper_tests passes (two tests: dropped here without the switch, and by the thread of that name with it). cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features are clean. cargo xtask policy passes.

Aside, not from this change: host::refresh_tests::raw_title_copy_keeps_write_watch_and_resends_equal_bytes failed in 4 of 8 runs of cargo test -p victory-gpu --lib on unmodified 3da964a here (default configuration, tests in parallel), and passes alone.

🤖 Generated with Claude Code

**@⁠CristianCiubancan** on GitHub · 2026-11-27 12:01 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/247) `CristianCiubancan:perf/reaper-thread` → `main` · +151 −1 · 1 files · 2 commits · open One commit on `main` at `63e2c98`. Off by default. ## What What `bury` drops was dropped by the thread that had just landed a flight. With `VICTORY_REAPER=1` the objects go to a list and a thread of ours (`victory-reaper`) drops them, handed over at the moment they were dropped before, never earlier. `VICTORY_AB=<s>,VICTORY_REAPER` does each in turn in one run. It follows the switch of the same name in fxceless/victory-fork, which this tree did not have; here it covers `bury` only. ## Why On an RTX 5070 Ti the first minutes in the world ran at 8 to 9 fps and then went to 17 to 20 by themselves, in every run. In the slow stretch the card was about 29 % busy and the submitting thread stood waiting for flights: 54 ms a frame in settles (`lists in the air` 29.5 ms, `title memory read` 24.8 ms), with the relay's line at 102 ms of landing a frame against 25 ms later in the same run. A `VICTORY_PROFILE` window over that stretch put the relay thread 79 % of its samples in `host::bury` → `drop<Vec<(u64, Retired)>>` → `D3D12Core` → `nvwgf2umx` → `win32u`. While the world streams in the title lets go of thousands of objects a second, and each drop is a call into the driver on the thread everything else was waiting for. On the reaper the same drops cost about 1 µs each (1.17 million in 0.62 s of that thread in one run), so it is not the drops themselves that are slow there. ## Measured RTX 5070 Ti 16 GB (driver 32.0.16.1088), Ryzen 7 9850X3D, 32 GB, Windows 11. Diagnostics build of this branch, Series S, `-Machine 4070 -Windowed` with `VICTORY_PIPELINE_WORKERS=8`, shaders translated and pipelines warmed ahead. A self-driven run: the same copy of the saves each time, `Enter` through `VICTORY_KEYS_FILE` until the world draws, then a fixed route of scripted keys for 300 s. Runs alternated without, with, without, with. Figures are from the once-a-second frame lines over 1,000 draws, the first four left out. | | without, run 1 | without, run 2 | with, run 1 | with, run 2 | |---|---|---|---|---| | fps median | 18.2 | 14.6 | 19.5 | 19.2 | | fps p10 | 15.3 | 7.0 | 17.5 | 17.8 | | ms per frame, median | 56.1 | 100.6 | 51.4 | 52.1 | | submitting thread's work, ms a frame | 53.2 | 78.8 | 49.1 | 49.0 | | submitting thread waiting for the card, mean ms a frame | 5.0 | 28.3 | 0.1 | 0.1 | | relay thread landing, mean ms a frame | 26.6 | 57.5 | 15.5 | 15.2 | | game memory, peak private | 21.8 GB | 23.4 GB | 21.4 GB | 21.4 GB | The slow stretch lasted about 35 s in the first run without the switch and about 2.5 minutes in the second; neither run with it has one. On the base I first measured on (`3da964a`, two runs each way, same route) it lasted 3 to 4 minutes without the switch: medians 9.5 and 12.6 fps without, 18.1 and 19.2 with, and peak private memory 24.8 and 23.4 GB against 21.3 and 21.3 GB. No errors and no device loss in any of the runs. ## Limits - One PC, one card, two runs each way on each base. The length of the slow stretch varies from run to run without the switch, so the medians without it scatter widely. - The picture: one hand-played full-screen session of about ten minutes with the switch on looked normal. It was not recorded, so there is no video to go with this. - The card's memory comes back some milliseconds later than before. The reaper logs how many objects wait every 16,384 dropped; the most I saw waiting was about 40,000 for a moment while the world loaded, usually 0. - Off by default for those reasons. On this PC I would turn it on in the NVIDIA settings of `play.ps1`; that is left for you to judge from other cards. ## Checks `cargo test -p victory-gpu --locked --lib reaper_tests` passes (two tests: dropped here without the switch, and by the thread of that name with it). `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features` are clean. `cargo xtask policy` passes. Aside, not from this change: `host::refresh_tests::raw_title_copy_keeps_write_watch_and_resends_equal_bytes` failed in 4 of 8 runs of `cargo test -p victory-gpu --lib` on unmodified `3da964a` here (default configuration, tests in parallel), and passes alone. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
What `bury` drops was dropped by the thread that had just landed a
flight. Dropping a host texture or buffer is a call into Direct3D and
the driver, and while a world streams in the title lets go of thousands
of objects a second: in a profile of the first minutes of the world on
an RTX 5070 Ti the landing thread was 79 % of its time in these drops,
the flights behind it were not landed, and the submitting thread waited
54 ms a frame for them.

With `VICTORY_REAPER=1` the objects go to a list and a thread of ours
drops them, handed over at the moment they were dropped before. Off by
default; `VICTORY_AB=<s>,VICTORY_REAPER` does each in turn in one run.
After the switch of the same name in fxceless/victory-fork.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 12:11:27 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 12:03 UTC · original · edited 2026-11-27 12:15 UTC

@⁠CristianCiubancan The reported p10 went from 15.3/7.0 to 17.5/17.8 FPS, and the mean relay landing time moved down in both pairs. I added 599ff9d to cap queued and in-progress releases at 16,384 objects. An excess batch releases on the caller after the same flight fence. Three isolated tests passed, and the Windows CI run is queued. The same-route FPS and shutdown drain checks are still open for this revision.

**@⁠TaynanGT** on GitHub · 2026-11-27 12:03 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/247#issuecomment-7217791324) · edited 2026-11-27 12:15 UTC @⁠CristianCiubancan The reported p10 went from 15.3/7.0 to 17.5/17.8 FPS, and the mean relay landing time moved down in both pairs. I added [`599ff9d`](https://github.com/CristianCiubancan/Vice-Tay/commit/599ff9d050613da5f19f161e2297789316cf853c) to cap queued and in-progress releases at 16,384 objects. An excess batch releases on the caller after the same flight fence. Three isolated tests passed, and the Windows CI run is queued. The same-route FPS and shutdown drain checks are still open for this revision.
Count queued and in-progress releases against one limit. Release a batch on the calling thread if it would exceed the limit, and cover that fallback with a regression test.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/247/head:github-bot/gh-247'
git switch 'github-bot/gh-247'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-247'
git switch 'github-bot/gh-247'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-247'
git switch 'github-bot/gh-247'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-247'
git switch 'main'
git merge --squash 'github-bot/gh-247'
git switch 'main'
git merge --ff-only 'github-bot/gh-247'
git switch 'main'
git merge 'github-bot/gh-247'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.