Landed lists reset on a thread of their own (VICTORY_LAND_ASIDE=1, off by default) #1146

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

@⁠beamdotdev on GitHub · 2026-11-25 21:37 UTC · original
beamdotdev:perf/recording-thread-locks → main · +33 −1 · 1 files · 2 commits · open

Branch perf/recording-thread-locks, merged with main 58de9bf. Found with a stack-sampling profile on a six-thread processor.

What it does

VICTORY_LAND_ASIDE=1 (off by default): the host lists of landed flights are reset on a thread of their own (victory-land), not by land() at the end of execute_late on the submitting thread. Asks that pile up are answered by one landing. A submission that follows takes a list from the idle ones or makes one, as before. Without the switch, or if the thread cannot be started, land() runs where it did.

The other half of the first version of this PR, sparing the recording threads the descriptor heap's two locks, is now on main in its own form (5d659e0, VICTORY_HEAP_LOCKS=1, off by default). The merge takes descriptor/host.rs exactly as main has it, so this PR no longer changes that file.

Why

Profile (stack samples every 2.5 s over five minutes of the first gameplay scene, i5-9600K, 6 cores and 6 threads): about a tenth of the submitting thread's time was inside list::recycle, which is the host's and the driver's work on the allocators. Nothing the next submission waits for.

Measured (both halves together, before the split)

RTX 3070 8 GB, i5-9600K, 32 GB, first gameplay scene, the README's switch set of run 253 plus VICTORY_CARD_WINDOWS_MB=2048 VICTORY_TEXTURE_ROOM_PERCENT=60, captures on, medians of three time windows of a 13-minute run:

300-430 s 430-600 s 600-780 s
085ee7c 272 ms 263 ms 301 ms
with the heap-lock change on and VICTORY_LAND_ASIDE=1 251 ms 224 ms 220 ms

Limits

  • These numbers are for the heap-lock change and the landing aside together. There is no run yet with the landing aside alone, so how much of the gain is its own is not known. To measure it on main now, run with VICTORY_HEAP_LOCKS=1 with and without VICTORY_LAND_ASIDE=1.
  • One run each way. Runs differ by about 15 % here.
  • Measured on 085ee7c. Not measured since the merge with main.
  • This PC is short of processor threads and of memory (0.6-0.7 GB free during a run). On a machine with many threads the gain may be nothing. I have no measurement on one.
  • After the merge: cargo build -p victory-gpu, plain and with --features diagnostics, both build; cargo test -p victory-gpu: 217 passed, 6 ignored.

🤖 Generated with Claude Code

**@⁠beamdotdev** on GitHub · 2026-11-25 21:37 UTC · [original](https://github.com/fxceless/victory-fork/pull/1146) `beamdotdev:perf/recording-thread-locks` → `main` · +33 −1 · 1 files · 2 commits · open Branch `perf/recording-thread-locks`, merged with `main` 58de9bf. Found with a stack-sampling profile on a six-thread processor. ## What it does **`VICTORY_LAND_ASIDE=1`** (off by default): the host lists of landed flights are reset on a thread of their own (`victory-land`), not by `land()` at the end of `execute_late` on the submitting thread. Asks that pile up are answered by one landing. A submission that follows takes a list from the idle ones or makes one, as before. Without the switch, or if the thread cannot be started, `land()` runs where it did. The other half of the first version of this PR, sparing the recording threads the descriptor heap's two locks, is now on `main` in its own form (5d659e0, `VICTORY_HEAP_LOCKS=1`, off by default). The merge takes `descriptor/host.rs` exactly as `main` has it, so this PR no longer changes that file. ## Why Profile (stack samples every 2.5 s over five minutes of the first gameplay scene, i5-9600K, 6 cores and 6 threads): about a tenth of the submitting thread's time was inside `list::recycle`, which is the host's and the driver's work on the allocators. Nothing the next submission waits for. ## Measured (both halves together, before the split) RTX 3070 8 GB, i5-9600K, 32 GB, first gameplay scene, the README's switch set of run 253 plus `VICTORY_CARD_WINDOWS_MB=2048 VICTORY_TEXTURE_ROOM_PERCENT=60`, captures on, medians of three time windows of a 13-minute run: | | 300-430 s | 430-600 s | 600-780 s | |---|---|---|---| | 085ee7c | 272 ms | 263 ms | 301 ms | | with the heap-lock change on and `VICTORY_LAND_ASIDE=1` | 251 ms | 224 ms | 220 ms | ## Limits - These numbers are for the heap-lock change and the landing aside together. There is no run yet with the landing aside alone, so how much of the gain is its own is not known. To measure it on `main` now, run with `VICTORY_HEAP_LOCKS=1` with and without `VICTORY_LAND_ASIDE=1`. - One run each way. Runs differ by about 15 % here. - Measured on 085ee7c. Not measured since the merge with `main`. - This PC is short of processor threads and of memory (0.6-0.7 GB free during a run). On a machine with many threads the gain may be nothing. I have no measurement on one. - After the merge: `cargo build -p victory-gpu`, plain and with `--features diagnostics`, both build; `cargo test -p victory-gpu`: 217 passed, 6 ignored. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- HostHeap::kept is in pieces of 1,024 slots with a lock each, and what a
  slot held is let go outside the lock. A slot made from the same record
  already is found without the heap's lock (made_now, written under the
  lock wherever made is). VICTORY_HEAP_LOCKS=0: under the lock, as before.
  On a six-thread processor a fifth of the recording threads' time in list
  calls was waiting for these two locks.
- VICTORY_LAND_ASIDE=1 (off by default): the host lists of landed flights
  are reset on a thread of their own, not at the end of a submission on
  the submitting thread (a tenth of its time in gameplay on that PC).

Measured on an RTX 3070 with an i5-9600K, first gameplay scene, the
README's switch set of run 253 with VICTORY_CARD_WINDOWS_MB=2048 and
VICTORY_TEXTURE_ROOM_PERCENT=60, captures on, medians of three time
windows: 272, 263, 301 ms a frame before; 251, 224, 220 ms with both
changes and VICTORY_LAND_ASIDE=1. The two are not told apart yet, and
the measurement was on 085ee7c, not on the head this is rebased onto.
The victory-gpu tests pass (184).

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

@⁠Proudnoob4 on GitHub · 2026-11-25 22:16 UTC · original

AI-assisted testing (Gemini in OpenCode); measured locally on my own machine.

RTX 4080 / Windows 10 bundled test report (6d1fe2f)

Setup: Windows 10 Pro 22H2 (Agility SDK 1.620.2), i5-13600K (6P+8E), 32 GB RAM, RTX 4080 16 GB (driver 621.01), Series X profile, diagnostics release build (9c184b3 + #1146 + bundled perf PRs), VICTORY_LAND_ASIDE=1 + default VICTORY_HEAP_LOCKS=1.

  • 66/66 targeted victory-gpu (shadow/descriptor/plaincopy) tests pass.
  • Ran cleanly for 330 s in world (VICTORY_LAND_ASIDE=1, VICTORY_HEAP_LOCKS=1, 0 crashes / 0 device removals): 8.50 fps median, 9.20 p90, 9.30 max, usual frame 113 ms (recording, all threads: 271.7 ms in 40,578 calls, copy-back 23.2 ms).
  • Merge note: if stacked with #1117, both add an atomic mirror of HostHeap::made (made_now vs made_fast); unifying on #1146's made_now keeps #1146's VICTORY_HEAP_LOCKS=0 opt-out and sharded HostHeap::kept cleanly. (Isolated single-PR A/B is unmeasured here.)
**@⁠Proudnoob4** on GitHub · 2026-11-25 22:16 UTC · [original](https://github.com/fxceless/victory-fork/pull/1146#issuecomment-7176160291) *AI-assisted testing (Gemini in OpenCode); measured locally on my own machine.* ### RTX 4080 / Windows 10 bundled test report (`6d1fe2f`) **Setup:** Windows 10 Pro 22H2 (Agility SDK 1.620.2), i5-13600K (6P+8E), 32 GB RAM, RTX 4080 16 GB (driver 621.01), Series X profile, diagnostics release build (`9c184b3` + `#1146` + bundled perf PRs), `VICTORY_LAND_ASIDE=1` + default `VICTORY_HEAP_LOCKS=1`. - `66/66` targeted `victory-gpu` (`shadow`/`descriptor`/`plaincopy`) tests pass. - Ran cleanly for 330 s in world (`VICTORY_LAND_ASIDE=1`, `VICTORY_HEAP_LOCKS=1`, `0` crashes / `0` device removals): **8.50 fps median, 9.20 p90, 9.30 max**, `usual frame 113 ms` (`recording, all threads: 271.7 ms in 40,578 calls`, `copy-back 23.2 ms`). - Merge note: if stacked with `#1117`, both add an atomic mirror of `HostHeap::made` (`made_now` vs `made_fast`); unifying on `#1146`'s `made_now` keeps `#1146`'s `VICTORY_HEAP_LOCKS=0` opt-out and sharded `HostHeap::kept` cleanly. *(Isolated single-PR A/B is unmeasured here.)*
Author
Owner

@⁠LeonardoS11 on GitHub · 2026-11-25 23:44 UTC · original

Measured here carried over an integration branch (current main plus a few open PRs), RTX 3080 Ti 12 GB, 24 threads, Windows 11 26200, Series S profile, the fixed room of the prologue, 300 s runs with the pipelines already cached.

  • The kept-in-pieces locks and VICTORY_LAND_ASIDE build and run with no image change in our screenshots.
  • Frame time did not move outside run-to-run spread: 107–120 ms a frame before and after, with VICTORY_LAND_ASIDE=1 and without. A second machine (RTX 5070 Ti, Ryzen 7 7700X, Windows 10) gave 113 ms both ways.
  • We left the lock-free made table out, since our branch already reads made slots without a lock; so this says nothing about that part.

Where our frame goes, for context: about 70 ms of preparing under the one submission lock on the submitting thread, and 35–45 ms of heap buffer pass on the recording threads. The recording threads' locks do not seem to be what bounds the frame on this card.

Written with Claude Code.

**@⁠LeonardoS11** on GitHub · 2026-11-25 23:44 UTC · [original](https://github.com/fxceless/victory-fork/pull/1146#issuecomment-7177975115) Measured here carried over an integration branch (current main plus a few open PRs), RTX 3080 Ti 12 GB, 24 threads, Windows 11 26200, Series S profile, the fixed room of the prologue, 300 s runs with the pipelines already cached. - The kept-in-pieces locks and `VICTORY_LAND_ASIDE` build and run with no image change in our screenshots. - Frame time did not move outside run-to-run spread: 107–120 ms a frame before and after, with `VICTORY_LAND_ASIDE=1` and without. A second machine (RTX 5070 Ti, Ryzen 7 7700X, Windows 10) gave 113 ms both ways. - We left the lock-free made table out, since our branch already reads made slots without a lock; so this says nothing about that part. Where our frame goes, for context: about 70 ms of preparing under the one submission lock on the submitting thread, and 35–45 ms of heap buffer pass on the recording threads. The recording threads' locks do not seem to be what bounds the frame on this card. Written with Claude Code.
github-bot changed title from Recording threads: the descriptor heap's locks no longer line them up; landed lists reset on a thread of their own (VICTORY_LAND_ASIDE=1, off by default) to Landed lists reset on a thread of their own (VICTORY_LAND_ASIDE=1, off by default) 2026-11-26 15:07:42 +00:00
descriptor/host.rs taken as main has it: the same made_now fast path and
kept in pieces, with the old single line kept as the switch-off path and
the switch off by default. What this branch adds on top of main is the
landing aside (VICTORY_LAND_ASIDE=1, off by default) in host.rs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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