Reset landed host lists on the helper thread #284

Manually merged
github merged 1 commit from github-bot/gh-284 into gh-pr/284/base 2026-11-27 17:36:34 +00:00 AGit
Owner

@⁠PetrSeifert on GitHub · 2026-11-27 13:37 UTC · original
PetrSeifert:perf/submit-thread-overhead → main · +139 −5 · 3 files · 1 commits · merged 2026-11-27 17:19 UTC

Summary

Split from the original 3-commit #284 per review feedback so each submitting-thread change can be evaluated and attributed independently:

  • This PR (993dd7d): Offload landed host-list resets (land()) out of send_late onto the victory-late-wait helper thread, keeping an inline fallback only when the helper thread is not live.
  • Split follow-ups (each opened as its own PR on 38c4cf9):
    • #322 (perf/card-steps-preplan) — reuse cut_or_plan's Preplan in card_steps
    • #323 (perf/heap-sync-stamps) — share heap-sync rounds across queued submissions via SyncRounds

Dynamic-slot retirement safety & telemetry

Both relay_land and settle already call Detached::release_tables() on every list in a flight before pushing those lists onto line.landed, so offloading land() does not delay dynamic descriptor slot return to recording threads.

Under diagnostics, late_line now reports submitting-thread vs helper-thread land() time alongside dynamic slots waiting for retirement (in flight, peak retired at settle, and in landed + line.landed queue depth). A unit test (pending_dynamic_slots_clears_after_tables_done) verifies State::pending_dynamic_slots() drops to 0 after tables_done().

Verification

Automated checks

  • cargo xtask policy --staged — passed
  • git diff --check — clean
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --features diagnostics) — passed
  • cargo test --locked -p victory-gpu --lib -- --test-threads=1 (default and --features diagnostics) — passed (single-threaded due to the pre-existing parallel flake in host::refresh_tests::raw_title_copy_keeps_write_watch_and_resends_equal_bytes on unmodified main)

Real-title comparison (GTA VI, Series S, standard -Machine 4070 diag build)

  • Hardware: Windows 11, AMD Ryzen 5 7600 (6C/12T), 63.1 GB RAM, NVIDIA GeForce RTX 4070 12 GB
  • Methodology: Single warm-cache run per build (target\diag\victory.exe shared path so all runs share the same NVIDIA shader cache). Diner comparisons use the exact contiguous being_made = 0 diner window (11 five-second samples, excluding initial scene-load spike and final transition), plus whole-diner submit time for transparency.
  • Control: Unmodified origin/main (38c4cf9, SHA-256 F3DF678E..., base38-r3, being_made = 0 from +8s; plus settled cell tail from base38-r2)
  • PR build: 993dd7d (SHA-256 7EDE6483..., landing-r2, being_made = 0 from +8s)
  • Flags: Standard scripts/play.ps1 -Console series-s -Machine 4070 -Build diag settings + VICTORY_PIPELINE_WORKERS=8, VICTORY_FULLSCREEN=1, VICTORY_PANEL=1
Window (being_made = 0, single run each) base38-r3 (38c4cf9) landing-r2 (993dd7d) Delta
Contiguous diner FPS (n=11 5s samples) 14.50 FPS (med 15.40, 69.81 ms) 14.21 FPS (med 14.70, 73.75 ms) −0.29 FPS (within single-run spread)
Contiguous diner submitting thread (n=51 1s samples) 60.82 ms 58.39 ms −2.43 ms
Whole diner submitting thread (incl. load transient) 61.72 ms 59.40 ms −2.32 ms
Early Prologue cell FPS (first 15s, ~4,650 draws) 18.80 FPS (53.23 ms) 18.93 FPS (53.03 ms) +0.13 FPS (flat)
Early Prologue cell submitting thread 49.41 ms 49.39 ms −0.02 ms (flat)

Slot-retirement & land() telemetry (landing-r2, steady Prologue cell):

  • land() time: 0.00 ms/frame on submitting thread, 16.30 ms/frame on victory-late-wait helper thread
  • Dynamic slots waiting for retirement: 7,895 in flight (peak 20,176 retired at settle), 0 in line.landed (peak 0 across all 126 log lines), 64.3 landed flights queued (peak 70), 0 dynamic-slot waits or refusals (copystat).
  • Trade-off note: on this 6-core CPU, steady-state Prologue cell FPS is flat (18.93 vs 18.80 early; settled base38-r2 tail is 19.80 FPS), while the submitting thread saves ~2.3–2.4 ms/frame during the heavier diner cutscene without delaying dynamic-slot return.

Full-video visual review

  • Reviewed full 1080p30 captures of both base38-r3 (140.8s) and landing-r2 (141.9s) via start-to-finish contact sheets and full-resolution diner/cell frames: 0 errors, 0 DRED, clean diner waitress and Prologue cell visuals throughout.
  • Note on the coloured face/neck mosaic reported earlier on the 3-commit branch: unmodified origin/main (38c4cf9) also showed the exact same intermittent coloured skin mosaic on the diner waitress in both base38-r2 and base38-r3 on this RTX 4070; landing-r2 rendered cleanly.
**@⁠PetrSeifert** on GitHub · 2026-11-27 13:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284) `PetrSeifert:perf/submit-thread-overhead` → `main` · +139 −5 · 3 files · 1 commits · merged 2026-11-27 17:19 UTC ## Summary Split from the original 3-commit #284 per review feedback so each submitting-thread change can be evaluated and attributed independently: - **This PR (`993dd7d`)**: Offload landed host-list resets (`land()`) out of `send_late` onto the `victory-late-wait` helper thread, keeping an inline fallback only when the helper thread is not live. - **Split follow-ups** (each opened as its own PR on `38c4cf9`): - #322 (`perf/card-steps-preplan`) — reuse `cut_or_plan`'s `Preplan` in `card_steps` - #323 (`perf/heap-sync-stamps`) — share heap-sync rounds across queued submissions via `SyncRounds` ### Dynamic-slot retirement safety & telemetry Both `relay_land` and `settle` already call `Detached::release_tables()` on every list in a flight *before* pushing those lists onto `line.landed`, so offloading `land()` does not delay dynamic descriptor slot return to recording threads. Under `diagnostics`, `late_line` now reports submitting-thread vs helper-thread `land()` time alongside dynamic slots waiting for retirement (`in flight`, `peak retired at settle`, and `in landed` + `line.landed` queue depth). A unit test (`pending_dynamic_slots_clears_after_tables_done`) verifies `State::pending_dynamic_slots()` drops to `0` after `tables_done()`. ## Verification ### Automated checks - `cargo xtask policy --staged` — passed - `git diff --check` — clean - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--features diagnostics`) — passed - `cargo test --locked -p victory-gpu --lib -- --test-threads=1` (default and `--features diagnostics`) — passed (single-threaded due to the pre-existing parallel flake in `host::refresh_tests::raw_title_copy_keeps_write_watch_and_resends_equal_bytes` on unmodified `main`) ### Real-title comparison (GTA VI, Series S, standard `-Machine 4070` `diag` build) - **Hardware**: Windows 11, AMD Ryzen 5 7600 (6C/12T), 63.1 GB RAM, NVIDIA GeForce RTX 4070 12 GB - **Methodology**: Single warm-cache run per build (`target\diag\victory.exe` shared path so all runs share the same NVIDIA shader cache). Diner comparisons use the exact contiguous `being_made = 0` diner window (11 five-second samples, excluding initial scene-load spike and final transition), plus whole-diner submit time for transparency. - **Control**: Unmodified `origin/main` (`38c4cf9`, SHA-256 `F3DF678E...`, `base38-r3`, `being_made = 0` from `+8s`; plus settled cell tail from `base38-r2`) - **PR build**: `993dd7d` (SHA-256 `7EDE6483...`, `landing-r2`, `being_made = 0` from `+8s`) - **Flags**: Standard `scripts/play.ps1 -Console series-s -Machine 4070 -Build diag` settings + `VICTORY_PIPELINE_WORKERS=8`, `VICTORY_FULLSCREEN=1`, `VICTORY_PANEL=1` | Window (`being_made = 0`, single run each) | `base38-r3` (`38c4cf9`) | `landing-r2` (`993dd7d`) | Delta | |---|---:|---:|---:| | Contiguous diner FPS (`n=11` 5s samples) | 14.50 FPS (med 15.40, 69.81 ms) | 14.21 FPS (med 14.70, 73.75 ms) | −0.29 FPS (within single-run spread) | | Contiguous diner submitting thread (`n=51` 1s samples) | 60.82 ms | **58.39 ms** | **−2.43 ms** | | Whole diner submitting thread (incl. load transient) | 61.72 ms | **59.40 ms** | **−2.32 ms** | | Early Prologue cell FPS (first 15s, ~4,650 draws) | 18.80 FPS (53.23 ms) | 18.93 FPS (53.03 ms) | +0.13 FPS (flat) | | Early Prologue cell submitting thread | 49.41 ms | 49.39 ms | −0.02 ms (flat) | **Slot-retirement & `land()` telemetry (`landing-r2`, steady Prologue cell):** - `land()` time: **`0.00 ms/frame`** on submitting thread, **`16.30 ms/frame`** on `victory-late-wait` helper thread - Dynamic slots waiting for retirement: **`7,895` in flight** (peak **`20,176`** retired at `settle`), **`0` in `line.landed` (peak `0` across all 126 log lines)**, `64.3` landed flights queued (peak `70`), `0` dynamic-slot waits or refusals (`copystat`). - Trade-off note: on this 6-core CPU, steady-state Prologue cell FPS is flat (`18.93` vs `18.80` early; settled `base38-r2` tail is `19.80 FPS`), while the submitting thread saves `~2.3–2.4 ms/frame` during the heavier diner cutscene without delaying dynamic-slot return. ### Full-video visual review - Reviewed full 1080p30 captures of both `base38-r3` (`140.8s`) and `landing-r2` (`141.9s`) via start-to-finish contact sheets and full-resolution diner/cell frames: **0 errors, 0 DRED**, clean diner waitress and Prologue cell visuals throughout. - Note on the coloured face/neck mosaic reported earlier on the 3-commit branch: unmodified `origin/main` (`38c4cf9`) also showed the exact same intermittent coloured skin mosaic on the diner waitress in both `base38-r2` and `base38-r3` on this RTX 4070; `landing-r2` rendered cleanly.
`send_late` reset and recycled the host lists of landed flights
(`land()`) on the submitting thread after every flight it sent. Once
`victory-late-wait` is running, `send_late` now only sets `line.poke`
when more lists have landed than the bury lag keeps and wakes that
thread, which already lands and looks at what queues hold when poked.

Without the helper thread (it could not make its event) the submitting
thread lands as before.
Every submission sent from a queue's thread asked for a round of the
heaps' records of its own and waited for it, also when a round that began
after the title submitted it had finished already.

A submission now takes a stamp when the title submits it
(`descriptor::heap_sync_stamp`): the number of the first round that begins
after that moment. At preparation it asks for a round only if none from
that number on has finished, so submissions queued back to back share
one. The worker counts rounds begun and done, the early ones too.

Kept as before, with a round of their own at preparation:
- parts behind a memory-value wait, and every part after one (a joined
  submission with such a part is unstamped as a whole);
- submissions not sent from a queue's thread (`Host::execute`, the
  present's copy).

A stamped part behind a fence wait is raised to the stamp taken when the
wait was met. A host heap made after the stamp (lists translated behind
the queue, `VICTORY_THIN=1`) and `round_mark` raise a floor, so a stamped
submission still waits for a round that saw the new heap.

`port_journal::round_after` is only used by its tests now.
With `VICTORY_PLACED_ORDER=1`, `cut_for` listed the steps of a submission
that has a copy at its place and planned them to see whether it must be
cut, and `Host::card_steps` then did both again under the submission
lock.

`cut_or_plan` hands the steps and the plan of a submission it does not
cut to `card_steps` (`Preplan`), which takes them if the flights still
write the same ranges and works them out again if not.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 13:47:50 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 13:43 UTC · original

@⁠PetrSeifert Please split the three changes so the submit-thread gains can be attributed. Moving landing affects when descriptor slots are returned, so record slots waiting for retirement alongside the thread time. The repeated heap sync and card-step plan can each use the same-route control.

**@⁠TaynanGT** on GitHub · 2026-11-27 13:43 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7219864360) @⁠PetrSeifert Please split the three changes so the submit-thread gains can be attributed. Moving landing affects when descriptor slots are returned, so record slots waiting for retirement alongside the thread time. The repeated heap sync and card-step plan can each use the same-route control.
Author
Owner

@⁠Garu667 on GitHub · 2026-11-27 15:20 UTC · original

Tested on an RTX 3080 10 GB (Series S, -Machine auto, boat mission autosave, warm shader cache), one run each:

Run Build fps median (last 24 lines) preparing ms (median) Crash / card loss
159 main e45051a 6.9 81 none
164 main + #284 7.5 83 none
  • fps: +0.6. That's within launch-to-launch noise on this scene, so it needs a second pair before it means anything. The preparing time didn't go down here.
  • Picture, new with this PR: in the prison cutscene, the woman at the desk (glasses) had her face and neck covered in a coloured mosaic: small green, pink, white, black and yellow squares. The tester has watched that cutscene about ten times today on other builds of main and never saw it before this run. One launch only, so it could still be a one-off. I can rerun #284 and main again to check whether it reproduces.
**@⁠Garu667** on GitHub · 2026-11-27 15:20 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7221935373) Tested on an **RTX 3080 10 GB** (Series S, `-Machine auto`, boat mission autosave, warm shader cache), one run each: | Run | Build | fps median (last 24 lines) | preparing ms (median) | Crash / card loss | |---|---|---|---|---| | 159 | `main` e45051a | 6.9 | 81 | none | | 164 | `main` + #284 | 7.5 | 83 | none | - **fps:** +0.6. That's within launch-to-launch noise on this scene, so it needs a second pair before it means anything. The preparing time didn't go down here. - **Picture, new with this PR:** in the prison cutscene, the woman at the desk (glasses) had her face and neck covered in a coloured mosaic: small green, pink, white, black and yellow squares. The tester has watched that cutscene about ten times today on other builds of `main` and never saw it before this run. One launch only, so it could still be a one-off. I can rerun #284 and `main` again to check whether it reproduces.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 15:32 UTC · original

@⁠Garu667 The FPS difference is within the run-to-run spread, and preparation rose from 81 to 83 ms. The mosaic is the part I’d check first. A second control/candidate pair at the desk, with the same save and camera, can tell us whether to isolate the three commits.

**@⁠TaynanGT** on GitHub · 2026-11-27 15:32 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7222172374) @⁠Garu667 The FPS difference is within the run-to-run spread, and preparation rose from 81 to 83 ms. The mosaic is the part I’d check first. A second control/candidate pair at the desk, with the same save and camera, can tell us whether to isolate the three commits.
github-bot changed title from Take landing, repeated heap-sync rounds and a second card-step plan off the submitting thread to Reset landed host lists on the helper thread 2026-11-27 16:44:48 +00:00
github-bot force-pushed github-bot/gh-284 from d7334aa200 to 993dd7dd03 2026-11-27 16:44:48 +00:00 Compare
Author
Owner

@⁠PetrSeifert on GitHub · 2026-11-27 16:39 UTC · original

@⁠TaynanGT Split into three single-change PRs on 38c4cf9 (this PR now keeps only the helper-thread land() offload, with card-step preplanning in #322 and stamped heap sync in #323), added dynamic-slot retirement telemetry (0 slots stuck in line.landed), and updated the body with isolated warm-cache comparisons and full-video verification. Ready for review!

**@⁠PetrSeifert** on GitHub · 2026-11-27 16:39 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7223510550) @⁠TaynanGT Split into three single-change PRs on `38c4cf9` (this PR now keeps only the helper-thread `land()` offload, with card-step preplanning in #322 and stamped heap sync in #323), added dynamic-slot retirement telemetry (0 slots stuck in `line.landed`), and updated the body with isolated warm-cache comparisons and full-video verification. Ready for review!
Author
Owner

@⁠PetrSeifert on GitHub · 2026-11-27 16:52 UTC · original

@⁠Garu667 @⁠TaynanGT Quick note on the coloured face/neck mosaic: we also hit the exact same mosaic on the diner waitress on unmodified main (38c4cf9) in both base38-r2 and base38-r3 on an RTX 4070, while all four split PR runs (#284, #322, #323 with the two post-write/GPU-landing heap-sync floor fixes, and #285) rendered cleanly. I don't have a desk autosave to re-test that exact camera, so let me know if you'd like to re-check #323 on the boat-mission save.

**@⁠PetrSeifert** on GitHub · 2026-11-27 16:52 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7223778532) @⁠Garu667 @⁠TaynanGT Quick note on the coloured face/neck mosaic: we also hit the exact same mosaic on the diner waitress on unmodified `main` (`38c4cf9`) in both `base38-r2` and `base38-r3` on an RTX 4070, while all four split PR runs (#284, #322, #323 with the two post-write/GPU-landing heap-sync floor fixes, and #285) rendered cleanly. I don't have a desk autosave to re-test that exact camera, so let me know if you'd like to re-check #323 on the boat-mission save.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 16:58 UTC · original

@⁠PetrSeifert Zero dynamic slots left in line.landed answers the retirement question. The mosaic in both unmodified diner runs also gives us a control for the image issue. Yes, a boat-mission pair with #323 and the same save and camera would help check the two heap-sync floor fixes before putting the splits together.

**@⁠TaynanGT** on GitHub · 2026-11-27 16:58 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7223887456) @⁠PetrSeifert Zero dynamic slots left in `line.landed` answers the retirement question. The mosaic in both unmodified diner runs also gives us a control for the image issue. Yes, a boat-mission pair with #323 and the same save and camera would help check the two heap-sync floor fixes before putting the splits together.
Author
Owner

@⁠urielbeaupre on GitHub · 2026-11-27 17:06 UTC · original

Measured on Windows 11, RTX 4070 Ti 12 GB, Ryzen 9 7900X, 64 GB, driver 621.40. Setup: scripts/play.ps1 -Machine 4070 -Console series-s -Windowed, ray tracing off.

The base is 8137f71, from #305 (on top of main at b06fdd5). #284 and #294 were merged together onto it, so the result below is the two combined. I haven't separated them.

Method: unattended opening (the game's own intro sequence, A pressed by VICTORY_KEYS_FILE); a warm-up run first so no pipelines were being made (checked in the log); then 100 s of the frame lines.

median fps slowest quarter fastest quarter
base, run 1 16.9 12.5 20.7
base, run 2 16.5 13.7 20.7
base + #284 + #294 20.0 16.2 21.8

That's about +20% at the median, with the slow quarter gaining the most. There was no crash, and the picture looked unchanged. I can split the two PRs into separate runs if that helps.

**@⁠urielbeaupre** on GitHub · 2026-11-27 17:06 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7224026816) Measured on Windows 11, RTX 4070 Ti 12 GB, Ryzen 9 7900X, 64 GB, driver 621.40. Setup: `scripts/play.ps1 -Machine 4070 -Console series-s -Windowed`, ray tracing off. The base is `8137f71`, from #305 (on top of `main` at `b06fdd5`). **#284 and #294 were merged together** onto it, so the result below is the two combined. I haven't separated them. Method: unattended opening (the game's own intro sequence, A pressed by `VICTORY_KEYS_FILE`); a warm-up run first so no pipelines were being made (checked in the log); then 100 s of the frame lines. | | median fps | slowest quarter | fastest quarter | |---|---|---|---| | base, run 1 | 16.9 | 12.5 | 20.7 | | base, run 2 | 16.5 | 13.7 | 20.7 | | base + #284 + #294 | **20.0** | **16.2** | **21.8** | That's about +20% at the median, with the slow quarter gaining the most. There was no crash, and the picture looked unchanged. I can split the two PRs into separate runs if that helps.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 17:08 UTC · original

@⁠urielbeaupre Yes, please split the runs. For #284, use 8137f71 with ray tracing off and the same 100-second window. Include the slowest quarter, time in land(), and queued lists if the log has them. That’ll show how much of the combined 20.0 FPS result comes from moving the reset to the helper.

**@⁠TaynanGT** on GitHub · 2026-11-27 17:08 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7224078786) @⁠urielbeaupre Yes, please split the runs. For #284, use `8137f71` with ray tracing off and the same 100-second window. Include the slowest quarter, time in `land()`, and queued lists if the log has them. That’ll show how much of the combined 20.0 FPS result comes from moving the reset to the helper.
github-bot changed target branch from main to gh-pr/284/base 2026-11-27 17:36:31 +00:00
github manually merged commit 993dd7dd03 into gh-pr/284/base 2026-11-27 17:36:34 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.