Reset landed host lists on the helper thread #284

Merged
PetrSeifert merged 1 commit from upstream-pr/284 into main 2026-11-27 17:19:26 +00:00
PetrSeifert commented 2026-11-27 13:37:40 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by PetrSeifert on 2026-11-27T13:37:40Z.


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.
<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5527570281 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284). Originally posted by [PetrSeifert](https://github.com/PetrSeifert) on 2026-11-27T13:37:40Z. --- ## 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.
TaynanGT commented 2026-11-27 13:43:25 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T13:43:25Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7219864360 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7219864360). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T13:43:25Z. --- @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.
Garu667 commented 2026-11-27 15:20:27 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Garu667 on 2026-11-27T15:20:27Z.


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.
<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7221935373 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7221935373). Originally posted by [Garu667](https://github.com/Garu667) on 2026-11-27T15:20:27Z. --- 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.
TaynanGT commented 2026-11-27 15:32:00 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T15:32:00Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7222172374 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7222172374). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T15:32:00Z. --- @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.
PetrSeifert commented 2026-11-27 16:39:03 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by PetrSeifert on 2026-11-27T16:39:03Z.


@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!

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7223510550 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7223510550). Originally posted by [PetrSeifert](https://github.com/PetrSeifert) on 2026-11-27T16:39:03Z. --- @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 commented 2026-11-27 16:52:57 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by PetrSeifert on 2026-11-27T16:52:57Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7223778532 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7223778532). Originally posted by [PetrSeifert](https://github.com/PetrSeifert) on 2026-11-27T16:52:57Z. --- @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.
TaynanGT commented 2026-11-27 16:58:45 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T16:58:45Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7223887456 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7223887456). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T16:58:45Z. --- @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.
urielbeaupre commented 2026-11-27 17:06:04 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by urielbeaupre on 2026-11-27T17:06:04Z.


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.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7224026816 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7224026816). Originally posted by [urielbeaupre](https://github.com/urielbeaupre) on 2026-11-27T17:06:04Z. --- 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.
TaynanGT commented 2026-11-27 17:08:48 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T17:08:48Z.


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7224078786 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/284#issuecomment-7224078786). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T17:08:48Z. --- @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.
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
TaynanGT/Vice-Tay!284
No description provided.