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

Closed
PetrSeifert wants to merge 572 commits from upstream-pr/285 into main
PetrSeifert commented 2026-11-27 13:37:42 +00:00 (Migrated from github.com)

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


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

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


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

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

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


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

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

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


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

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7223888211 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/285#issuecomment-7223888211). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T16:58:47Z. --- @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.
PetrSeifert commented 2026-11-27 19:35:37 +00:00 (Migrated from github.com)

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


Superseded by merged #344 (which cherry-picked this commit as df01b38 and added the dependent constant-fill retry behind VICTORY_PLACED_FILL_REDIRECT=1). Closing — thanks!

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7226680626 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/285#issuecomment-7226680626). Originally posted by [PetrSeifert](https://github.com/PetrSeifert) on 2026-11-27T19:35:37Z. --- Superseded by merged #344 (which cherry-picked this commit as `df01b38` and added the dependent constant-fill retry behind `VICTORY_PLACED_FILL_REDIRECT=1`). Closing — thanks!
TaynanGT commented 2026-11-27 19:40:05 +00:00 (Migrated from github.com)

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


@PetrSeifert The source read and dependent constant-fill retry both landed in #344. VICTORY_PLACED_FILL_REDIRECT=1 still controls that path, so the original opt-in can be used for the comparison.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7226753053 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/285#issuecomment-7226753053). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T19:40:05Z. --- @PetrSeifert The source read and dependent constant-fill retry both landed in #344. `VICTORY_PLACED_FILL_REDIRECT=1` still controls that path, so the original opt-in can be used for the comparison.

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