Share heap-sync rounds between queued submissions #323

Closed
PetrSeifert wants to merge 572 commits from upstream-pr/323 into main
PetrSeifert commented 2026-11-27 16:38:58 +00:00 (Migrated from github.com)

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


Summary

Split out from #284 per review feedback as a standalone single-change PR on origin/main (38c4cf9).

Every submission sent from a queue thread previously requested a fresh heap-sync round of its own and waited for it, even when a round that started after the title submitted it had already finished.

What changed

  • Stamp each queue-thread submission at enqueue time (descriptor::heap_sync_stamp) with the first round number that begins after that moment (SyncRounds). At preparation, only wait for a round if no round from that stamp onward has completed, allowing back-to-back queued submissions to share one round.
  • Preserve dedicated fresh rounds for parts behind a memory-value wait (and every part after one), and for submissions not sent from a queue thread (Host::execute, present copy).
  • Raise a stamped part behind a fence wait to the stamp taken when the wait is met.
  • Raise SyncRounds::floor strictly after writes or GPU copy-back landings that touch shader-visible descriptor heaps complete:
    • port_journal::prep_wrote() is called after copy_mapped / prepare / copy_raw_title in Step::Copy, Step::Placed (when free), and Step::RawCopy.
    • Added descriptor::any_in_shader_heap / Host::landed_touches_shader_heap to call port_journal::prep_wrote() after hand_back merges GPU copy-back landings into title memory in both relay_land and settle.
  • Removed dead test-only port_journal::round_after and cleaned up stale doc comments in descriptor.rs, port_journal.rs, and host.rs.

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).
  • Control: Unmodified origin/main (38c4cf9, SHA-256 F3DF678E...; base38-r2 for settled 4,467-draw Prologue cell tail and base38-r3 for contiguous diner + early cell)
  • PR build: 6a1cf20 (HEAD b56ee49 differs only by doc-comment cleanup) (SHA-256 21FED4C7..., heapsync-r1; note: the initial diner samples at 16:12:42–52 still drained 188 → 161 → 15 being_made pipelines before hitting 0 at 16:12:57 (+62s) for the rest of the diner and the entire Prologue cell)
  • Flags: Same route and VICTORY_* settings (scripts/play.ps1 -Console series-s -Machine 4070 -Build diag + VICTORY_PIPELINE_WORKERS=8, VICTORY_FULLSCREEN=1, VICTORY_PANEL=1)

Primary targeted metric (settled Prologue cell, being_made = 0, ~4,470 draws/frame):

Metric (single run each) base38-r2 (38c4cf9) heapsync-r1 (6a1cf20) Delta
Settled tail10s at the end ... waiting for the heaps' records 2.86 ms 1.10 ms −1.76 ms
Settled tail4 FPS 19.80 FPS (50.55 ms) 19.88 FPS (50.30 ms) +0.08 FPS (neutral)
Settled tail10s submitting thread (that thread worked) 47.39 ms 47.20 ms −0.19 ms (neutral)

Other windows (being_made = 0, single run each vs base38-r3):

  • Contiguous being_made = 0 diner (16:12:57–16:13:44, n=10 vs base38-r3 n=11): 14.94 FPS (med 14.75, submit 59.02 ms) vs 14.50 FPS (med 15.40, submit 60.82 ms) — neutral like-for-like (whole diner including the initial being_made drain was 65.16 ms vs 61.72 ms).
  • Early Prologue cell (first 15s, ~4,600–4,690 draws): 19.43 FPS / 48.75 ms submit / 4.21 ms heap wait vs 18.80 FPS / 49.41 ms submit / 5.05 ms heap wait (within single-run spread).
  • Overall: reproducible −1.76 ms reduction in end-of-submission heap-sync wait with neutral headline FPS and clean visuals.

Full-video visual review

  • Reviewed full 1080p30 capture of heapsync-r1 (168.2s) via start-to-finish contact sheet and full-resolution diner waitress & Prologue cell frames alongside base38-r2/base38-r3: 0 errors, 0 DRED. Both diner waitress and Prologue cell rendered cleanly throughout (no texture corruption; base38-r2 and base38-r3 exhibited intermittent upstream rainbow face corruption on the waitress while heapsync-r1 was clean).
<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5530048239 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/323). Originally posted by [PetrSeifert](https://github.com/PetrSeifert) on 2026-11-27T16:38:58Z. --- ## Summary Split out from #284 per review feedback as a standalone single-change PR on `origin/main` (`38c4cf9`). Every submission sent from a queue thread previously requested a fresh heap-sync round of its own and waited for it, even when a round that started *after* the title submitted it had already finished. ### What changed - Stamp each queue-thread submission at enqueue time (`descriptor::heap_sync_stamp`) with the first round number that begins after that moment (`SyncRounds`). At preparation, only wait for a round if no round from that stamp onward has completed, allowing back-to-back queued submissions to share one round. - Preserve dedicated fresh rounds for parts behind a memory-value wait (and every part after one), and for submissions not sent from a queue thread (`Host::execute`, present copy). - Raise a stamped part behind a fence wait to the stamp taken when the wait is met. - Raise `SyncRounds::floor` strictly **after** writes or GPU copy-back landings that touch shader-visible descriptor heaps complete: - `port_journal::prep_wrote()` is called *after* `copy_mapped` / `prepare` / `copy_raw_title` in `Step::Copy`, `Step::Placed` (when `free`), and `Step::RawCopy`. - Added `descriptor::any_in_shader_heap` / `Host::landed_touches_shader_heap` to call `port_journal::prep_wrote()` *after* `hand_back` merges GPU copy-back landings into title memory in both `relay_land` and `settle`. - Removed dead test-only `port_journal::round_after` and cleaned up stale doc comments in `descriptor.rs`, `port_journal.rs`, and `host.rs`. ## 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). - **Control**: Unmodified `origin/main` (`38c4cf9`, SHA-256 `F3DF678E...`; `base38-r2` for settled 4,467-draw Prologue cell tail and `base38-r3` for contiguous diner + early cell) - **PR build**: `6a1cf20` (HEAD `b56ee49` differs only by doc-comment cleanup) (SHA-256 `21FED4C7...`, `heapsync-r1`; note: the initial diner samples at `16:12:42–52` still drained `188 → 161 → 15` `being_made` pipelines before hitting `0` at `16:12:57` (`+62s`) for the rest of the diner and the entire Prologue cell) - **Flags**: Same route and `VICTORY_*` settings (`scripts/play.ps1 -Console series-s -Machine 4070 -Build diag` + `VICTORY_PIPELINE_WORKERS=8`, `VICTORY_FULLSCREEN=1`, `VICTORY_PANEL=1`) **Primary targeted metric (settled Prologue cell, `being_made = 0`, ~4,470 draws/frame):** | Metric (single run each) | `base38-r2` (`38c4cf9`) | `heapsync-r1` (`6a1cf20`) | Delta | |---|---:|---:|---:| | Settled tail10s `at the end ... waiting for the heaps' records` | 2.86 ms | **1.10 ms** | **−1.76 ms** | | Settled tail4 FPS | 19.80 FPS (50.55 ms) | 19.88 FPS (50.30 ms) | +0.08 FPS (neutral) | | Settled tail10s submitting thread (`that thread worked`) | 47.39 ms | 47.20 ms | −0.19 ms (neutral) | **Other windows (`being_made = 0`, single run each vs `base38-r3`):** - **Contiguous `being_made = 0` diner** (`16:12:57–16:13:44`, `n=10` vs `base38-r3` `n=11`): `14.94 FPS` (med `14.75`, submit `59.02 ms`) vs `14.50 FPS` (med `15.40`, submit `60.82 ms`) — neutral like-for-like (whole diner including the initial `being_made` drain was `65.16 ms` vs `61.72 ms`). - **Early Prologue cell** (first 15s, ~4,600–4,690 draws): `19.43 FPS` / `48.75 ms` submit / `4.21 ms` heap wait vs `18.80 FPS` / `49.41 ms` submit / `5.05 ms` heap wait (within single-run spread). - Overall: reproducible `−1.76 ms` reduction in end-of-submission heap-sync wait with neutral headline FPS and clean visuals. ### Full-video visual review - Reviewed full 1080p30 capture of `heapsync-r1` (`168.2s`) via start-to-finish contact sheet and full-resolution diner waitress & Prologue cell frames alongside `base38-r2`/`base38-r3`: **0 errors, 0 DRED**. Both diner waitress and Prologue cell rendered cleanly throughout (no texture corruption; `base38-r2` and `base38-r3` exhibited intermittent upstream rainbow face corruption on the waitress while `heapsync-r1` was clean).
PetrSeifert commented 2026-11-27 19:35:40 +00:00 (Migrated from github.com)

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


Superseded by merged #343 (aa917f3, incorporating these heap-sync round changes onto current main). Closing — thanks!

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7226681394 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/323#issuecomment-7226681394). Originally posted by [PetrSeifert](https://github.com/PetrSeifert) on 2026-11-27T19:35:40Z. --- Superseded by merged #343 (`aa917f3`, incorporating these heap-sync round changes onto current `main`). Closing — thanks!
TaynanGT commented 2026-11-27 19:40:08 +00:00 (Migrated from github.com)

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


@PetrSeifert Confirmed aa917f3 is on main. Eligible queued submissions can use the same completed heap-sync round, with a fresh round still required on the paths that need one.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7226753798 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/323#issuecomment-7226753798). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T19:40:08Z. --- @PetrSeifert Confirmed `aa917f3` is on `main`. Eligible queued submissions can use the same completed heap-sync round, with a fresh round still required on the paths that need one.

Pull request closed

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!323
No description provided.