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

Open
beamdotdev wants to merge 2 commits from upstream-pr/1146 into main
beamdotdev commented 2026-11-25 21:37:49 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by beamdotdev on 2026-11-25T21:37:49Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6614259713 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1146). Originally posted by [beamdotdev](https://github.com/beamdotdev) on 2026-11-25T21:37:49Z. --- 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)
Proudnoob4 commented 2026-11-25 23:09:54 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Proudnoob4 on 2026-11-25T22:16:41Z.


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.)
<!-- greyfinch-sync:fxceless/victory-fork:comment:7176160291 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1146#issuecomment-7176160291). Originally posted by [Proudnoob4](https://github.com/Proudnoob4) on 2026-11-25T22:16:41Z. --- *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.)*
LeonardoS11 commented 2026-11-26 00:06:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by LeonardoS11 on 2026-11-25T23:44:07Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7177975115 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1146#issuecomment-7177975115). Originally posted by [LeonardoS11](https://github.com/LeonardoS11) on 2026-11-25T23:44:07Z. --- 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.
upstream-sync changed title from [PR #1146] 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 [PR #1146] Landed lists reset on a thread of their own (VICTORY_LAND_ASIDE=1, off by default) 2026-11-26 16:06:30 +00:00
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1146:upstream-pr/1146'
git switch 'upstream-pr/1146'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1146'
git switch 'upstream-pr/1146'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1146'
git switch 'upstream-pr/1146'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1146'
git switch 'main'
git merge --squash 'upstream-pr/1146'
git switch 'main'
git merge --ff-only 'upstream-pr/1146'
git switch 'main'
git merge 'upstream-pr/1146'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1143
No description provided.