Read a fill behind a placed copy from the copy's source #285

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

@⁠PetrSeifert on GitHub · 2026-11-27 13:37 UTC · original
PetrSeifert:perf/placed-fill-read-through → main · +378 −29 · 3 files · 1 commits · open

Summary

Rebased onto origin/main (38c4cf9) and updated per review feedback from @TaynanGT:

With VICTORY_PLACED_ORDER=1, a fill taken to the card that reads bytes written by an earlier placed copy in the same submission previously refused the submission (BEHIND_PLACED) or forced a cut behind the placed copy's list, because our front list runs before the placed copy.

Such a fill now reads from the placed copy's source host copy at the matching offset when safe:

  • the fill lies wholly inside the placed copy's destination;
  • the placed copy reads a host copy on the card (not upload memory);
  • nothing ahead of the placed copy writes its source (shader write or earlier placed copy), and no buffer copy of the submission does;
  • no buffer copy or shader write between the placed copy and the fill writes the fill's bytes;
  • if a later placed copy overlaps the fill, it must cover the fill wholly (in which case the fill reads that later copy's source); any partial overlap refuses the redirect.

Review feedback addressed

  • Added a dedicated placed_redirect_regression_cases unit test covering:
    • partial overlaps (leading edge, trailing edge, wider fill spanning past both ends),
    • a later write covering the full fill (Copy, GpuWrite, and Placed),
    • split cover (partial Placed + GpuWrite covering the remainder, in both orders),
    • a later Placed writing the earlier copy's source (redirect still valid since our front list runs first),
    • a self-overlapping Placed, and
    • a write to the copy's source outside the redirected slice (conservatively refused).
  • Under diagnostics, logs placed-copy fill read-through per frame (VICTORY_PLACED_ORDER): X fills redirected, Y cuts (counting cuts only when split succeeds via card_steps::note_cut()).

Merge-order note: This PR and #322 (perf/card-steps-preplan) both touch cut_for / take_steps (Preplan.chosen type); whichever merges second will need a small rebase.

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, including placed_redirect_regression_cases (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, VICTORY_PLACED_ORDER=1 on both control and PR).
  • Control: Unmodified origin/main (38c4cf9, SHA-256 F3DF678E...; base38-r3 for contiguous diner + early cell, base38-r2 for settled Prologue cell tail)
  • PR build: 837f77e (SHA-256 7B618F0C..., placed-r1; being_made = 0 from 16:15:13 with one brief 155 loading blip at 16:15:28, then 0 throughout the diner and Prologue cell)
  • Flags: Standard scripts/play.ps1 -Console series-s -Machine 4070 -Build diag (VICTORY_PLACED_ORDER=1 on both control and PR) + VICTORY_PIPELINE_WORKERS=8, VICTORY_FULLSCREEN=1, VICTORY_PANEL=1

Redirect activity (placed-r1):

  • Actively exercised during the diner cutscene (16:16:23, 16:16:47–48): 0.83, 1.29, and 0.27 fills redirected per frame with 0.00 cuts and clean visuals throughout.
  • 0.00 redirects/cuts in the steady Prologue cell (zero steady-state overhead).

Performance (like-for-like, neutral within single-run spread):

Window (being_made = 0, single run each) Baseline (38c4cf9) placed-r1 (837f77e) Delta
Contiguous diner FPS (n=11 5s samples, vs base38-r3) 14.50 FPS (med 15.40, 69.81 ms) 15.05 FPS (med 15.20, 72.59 ms) Neutral
Contiguous diner submitting thread (n=51 1s samples) 60.82 ms 58.38 ms −2.44 ms (whole diner: 61.77 vs 61.72 ms, neutral)
Early Prologue cell FPS (first 15s, ~4,684 draws, vs base38-r3) 18.80 FPS (53.23 ms) 19.43 FPS (51.40 ms) Neutral vs settled tail
Settled Prologue cell tail6 FPS / tail10s submit (vs base38-r2) 19.80 FPS / 47.39 ms 19.77 FPS / 46.98 ms −0.03 FPS / −0.41 ms (neutral)

Full-video visual review

  • Reviewed full 1080p30 capture of placed-r1 (171.4s) via start-to-finish contact sheet and full-resolution diner waitress & Prologue cell frames alongside base38-r3: 0 errors, 0 DRED, completely clean diner and Prologue cell rendering throughout (including during the diner redirect windows).
**@⁠PetrSeifert** on GitHub · 2026-11-27 13:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/285) `PetrSeifert:perf/placed-fill-read-through` → `main` · +378 −29 · 3 files · 1 commits · open ## Summary Rebased onto `origin/main` (`38c4cf9`) and updated per review feedback from `@TaynanGT`: With `VICTORY_PLACED_ORDER=1`, a fill taken to the card that reads bytes written by an earlier placed copy in the same submission previously refused the submission (`BEHIND_PLACED`) or forced a cut behind the placed copy's list, because our front list runs before the placed copy. Such a fill now reads from the placed copy's source host copy at the matching offset when safe: - the fill lies wholly inside the placed copy's destination; - the placed copy reads a host copy on the card (not upload memory); - nothing ahead of the placed copy writes its source (shader write or earlier placed copy), and no buffer copy of the submission does; - no buffer copy or shader write between the placed copy and the fill writes the fill's bytes; - if a later placed copy overlaps the fill, it must cover the fill wholly (in which case the fill reads that later copy's source); any partial overlap refuses the redirect. ### Review feedback addressed - Added a dedicated `placed_redirect_regression_cases` unit test covering: - partial overlaps (leading edge, trailing edge, wider fill spanning past both ends), - a later write covering the full fill (`Copy`, `GpuWrite`, and `Placed`), - split cover (partial `Placed` + `GpuWrite` covering the remainder, in both orders), - a later `Placed` writing the earlier copy's source (redirect still valid since our front list runs first), - a self-overlapping `Placed`, and - a write to the copy's source outside the redirected slice (conservatively refused). - Under `diagnostics`, logs `placed-copy fill read-through per frame (VICTORY_PLACED_ORDER): X fills redirected, Y cuts` (counting cuts only when `split` succeeds via `card_steps::note_cut()`). > **Merge-order note:** This PR and #322 (`perf/card-steps-preplan`) both touch `cut_for` / `take_steps` (`Preplan.chosen` type); whichever merges second will need a small rebase. ## 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, including `placed_redirect_regression_cases` (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, `VICTORY_PLACED_ORDER=1` on both control and PR). - **Control**: Unmodified `origin/main` (`38c4cf9`, SHA-256 `F3DF678E...`; `base38-r3` for contiguous diner + early cell, `base38-r2` for settled Prologue cell tail) - **PR build**: `837f77e` (SHA-256 `7B618F0C...`, `placed-r1`; `being_made = 0` from `16:15:13` with one brief `155` loading blip at `16:15:28`, then `0` throughout the diner and Prologue cell) - **Flags**: Standard `scripts/play.ps1 -Console series-s -Machine 4070 -Build diag` (`VICTORY_PLACED_ORDER=1` on both control and PR) + `VICTORY_PIPELINE_WORKERS=8`, `VICTORY_FULLSCREEN=1`, `VICTORY_PANEL=1` **Redirect activity (`placed-r1`):** - Actively exercised during the diner cutscene (`16:16:23`, `16:16:47–48`): **`0.83`, `1.29`, and `0.27` fills redirected per frame** with **`0.00` cuts** and clean visuals throughout. - `0.00` redirects/cuts in the steady Prologue cell (zero steady-state overhead). **Performance (like-for-like, neutral within single-run spread):** | Window (`being_made = 0`, single run each) | Baseline (`38c4cf9`) | `placed-r1` (`837f77e`) | Delta | |---|---:|---:|---:| | Contiguous diner FPS (`n=11` 5s samples, vs `base38-r3`) | 14.50 FPS (med 15.40, 69.81 ms) | 15.05 FPS (med 15.20, 72.59 ms) | Neutral | | Contiguous diner submitting thread (`n=51` 1s samples) | 60.82 ms | 58.38 ms | −2.44 ms *(whole diner: 61.77 vs 61.72 ms, neutral)* | | Early Prologue cell FPS (first 15s, ~4,684 draws, vs `base38-r3`) | 18.80 FPS (53.23 ms) | 19.43 FPS (51.40 ms) | Neutral vs settled tail | | Settled Prologue cell tail6 FPS / tail10s submit (vs `base38-r2`) | 19.80 FPS / 47.39 ms | 19.77 FPS / 46.98 ms | −0.03 FPS / −0.41 ms (neutral) | ### Full-video visual review - Reviewed full 1080p30 capture of `placed-r1` (`171.4s`) via start-to-finish contact sheet and full-resolution diner waitress & Prologue cell frames alongside `base38-r3`: **0 errors, 0 DRED**, completely clean diner and Prologue cell rendering throughout (including during the diner redirect windows).
With `VICTORY_PLACED_ORDER=1` a fill taken to the card that reads bytes
a copy at its place in an earlier list writes refused the submission
(`BEHIND_PLACED`), or had it cut behind the copy's list: our list runs in
front of all of them, so it would read the bytes before the copy.

Such a fill now reads the placed copy's source host copy at the same
offset, which holds those bytes before the copy runs. Only when:

- the fill lies wholly inside the copy's destination;
- the copy reads a host copy on the card, not upload memory;
- nothing ahead of the copy in the submission writes its source (a
  shader write or another placed copy), and no buffer copy of the
  submission does;
- no buffer copy or shader write between the copy and the fill writes
  the fill's bytes;
- a later placed copy that writes the fill's bytes covers all of them
  (the fill then reads that one's source).

Anything else behind a placed copy is refused or cut as before, and so
is every case with the switch off. `Does` gains the shader writes the
lists declare (`GpuWrite`) for these checks.

What stands between the copy and each fill is gathered in one pass over
the steps behind the copy.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 13:47:51 +00:00
Author
Owner

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

@⁠PetrSeifert The source substitution is only equivalent while the placed copy’s source is still valid for the whole fill range. The useful regression cases are a partial overlap and a later write that covers the full fill. Keep those distinct from the placement-order performance comparison.

**@⁠TaynanGT** on GitHub · 2026-11-27 13:43 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/285#issuecomment-7219865208) @⁠PetrSeifert The source substitution is only equivalent while the placed copy’s source is still valid for the whole fill range. The useful regression cases are a partial overlap and a later write that covers the full fill. Keep those distinct from the placement-order performance comparison.
github-bot force-pushed github-bot/gh-285 from 9dea421bf4 to 837f77ebce 2026-11-27 16:44:50 +00:00 Compare
Author
Owner

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

@⁠TaynanGT Rebased on 38c4cf9, added the dedicated placed_redirect_regression_cases unit test covering partial overlaps and later full-cover writes separately from the placement-order tests, and updated the body with warm-cache comparison results (including diner redirect counts) and full-video verification. Ready for review!

**@⁠PetrSeifert** on GitHub · 2026-11-27 16:39 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/285#issuecomment-7223512346) @⁠TaynanGT Rebased on `38c4cf9`, added the dedicated `placed_redirect_regression_cases` unit test covering partial overlaps and later full-cover writes separately from the placement-order tests, and updated the body with warm-cache comparison results (including diner redirect counts) and full-video verification. Ready for review!
Author
Owner

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

@⁠PetrSeifert The dedicated regression now covers the partial overlap and full-cover writes I asked for, including the split-cover case. I’ll check the Preplan.chosen overlap once #322 settles so the redirect stays correct when the two changes meet.

**@⁠TaynanGT** on GitHub · 2026-11-27 16:58 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/285#issuecomment-7223888211) @⁠PetrSeifert The dedicated regression now covers the partial overlap and full-cover writes I asked for, including the split-cover case. I’ll check the `Preplan.chosen` overlap once #322 settles so the redirect stays correct when the two changes meet.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/host/card_steps.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/285/head:github-bot/gh-285'
git switch 'github-bot/gh-285'

Merge

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