Share heap-sync rounds between queued submissions #323

Open
github-bot wants to merge 1 commit from github-bot/gh-323 into main AGit
Owner

@⁠PetrSeifert on GitHub · 2026-11-27 16:38 UTC · original
PetrSeifert:perf/heap-sync-stamps → main · +368 −180 · 4 files · 1 commits · open

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** on GitHub · 2026-11-27 16:38 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/323) `PetrSeifert:perf/heap-sync-stamps` → `main` · +368 −180 · 4 files · 1 commits · open ## 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).
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 `port_journal::prep_wrote` raise
`SyncRounds::floor` strictly *after* the write or GPU landing into a
shader heap completes, so later stamped submissions still wait for a
round that observes the written records.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 16:44:34 +00:00
github-bot force-pushed github-bot/gh-323 from 6a1cf20ad7 to b56ee49821 2026-11-27 16:53:48 +00:00 Compare
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/323/head:github-bot/gh-323'
git switch 'github-bot/gh-323'

Merge

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