GPU: record per-span stamps for partial watched-page refreshes #1388

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

@⁠n-romanovich on GitHub · 2026-11-26 22:19 UTC · original
n-romanovich:fix/1344-partial-page-stamps → main · +389 −53 · 1 files · 1 commits · open

Fixes #1344.

Previously, Shadow::copy_stale only updated copied[page - base] when a refresh covered the entire 64 KiB page (within the shadow buffer). Partial or unaligned refreshes left the page unstamped, causing repeated refreshes of the same unchanged span to re-copy boundary bytes on every frame.

Changes in crates/victory-gpu/src/shadow.rs:

  • Track sorted, non-overlapping per-page partial byte spans (lo, hi, stamp) in Shadow::partial alongside Shadow::copied.
  • In copy_stale / copy_stale_with, prune any partial spans invalidated by a newer CPU write (stamp < write), copy only the uncovered gaps (including when VICTORY_DIRTY_4K subpage filtering is active), and promote to a whole-page stamp when a full page is refreshed.
  • Keep partial stamps in sync in Shadow::wrote_own.
  • Add unit tests in shadow::stale_tests covering unaligned cross-boundary refreshes, consecutive refreshes skipping unchanged bytes, CPU write invalidation, overlapping extensions, promotion to whole-page stamps, and VICTORY_DIRTY_4K interaction.

Verified locally:

  • cargo test --locked -p victory-gpu --lib shadow (34 passed, 0 failed)
  • cargo test --locked -p victory-gpu --features diagnostics --lib shadow (34 passed, 0 failed)
  • cargo test --locked -p victory-gpu --lib (226 passed, 0 failed, 6 ignored)
  • cargo build --release --locked -p victory
**@⁠n-romanovich** on GitHub · 2026-11-26 22:19 UTC · [original](https://github.com/fxceless/victory-fork/pull/1388) `n-romanovich:fix/1344-partial-page-stamps` → `main` · +389 −53 · 1 files · 1 commits · open Fixes #1344. Previously, `Shadow::copy_stale` only updated `copied[page - base]` when a refresh covered the entire 64 KiB page (within the shadow buffer). Partial or unaligned refreshes left the page unstamped, causing repeated refreshes of the same unchanged span to re-copy boundary bytes on every frame. Changes in `crates/victory-gpu/src/shadow.rs`: - Track sorted, non-overlapping per-page partial byte spans `(lo, hi, stamp)` in `Shadow::partial` alongside `Shadow::copied`. - In `copy_stale` / `copy_stale_with`, prune any partial spans invalidated by a newer CPU write (`stamp < write`), copy only the uncovered gaps (including when `VICTORY_DIRTY_4K` subpage filtering is active), and promote to a whole-page stamp when a full page is refreshed. - Keep `partial` stamps in sync in `Shadow::wrote_own`. - Add unit tests in `shadow::stale_tests` covering unaligned cross-boundary refreshes, consecutive refreshes skipping unchanged bytes, CPU write invalidation, overlapping extensions, promotion to whole-page stamps, and `VICTORY_DIRTY_4K` interaction. Verified locally: - `cargo test --locked -p victory-gpu --lib shadow` (34 passed, 0 failed) - `cargo test --locked -p victory-gpu --features diagnostics --lib shadow` (34 passed, 0 failed) - `cargo test --locked -p victory-gpu --lib` (226 passed, 0 failed, 6 ignored) - `cargo build --release --locked -p victory`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:02:55 +00:00
Author
Owner

@⁠Filip722 on GitHub · 2026-11-26 23:07 UTC · original

All four focused stale-page tests passed under GE-Proton11-14 on Bazzite 44 with an RTX 5060 Laptop. I also replayed the same Series S checkpoint from identical initial caches on the same local integration of main and #257, with #1388 as the app source change.

The patched run reached the cell and recorded 206 distinct presents over 54 seconds at 3.82 FPS, with 965 MiB minimum free VRAM and no pending pipelines. Camera movement responded to input. The unpatched run reached the matched view and hit the local GPU headroom stop at 618 MiB free before completing the window. This pair establishes a working Proton run with the patch. A complete control window is still needed for an FPS or CPU-copy comparison.

Assisted by Codex (GPT-6.2-Sol High).

**@⁠Filip722** on GitHub · 2026-11-26 23:07 UTC · [original](https://github.com/fxceless/victory-fork/pull/1388#issuecomment-7205277617) All four focused stale-page tests passed under GE-Proton11-14 on Bazzite 44 with an RTX 5060 Laptop. I also replayed the same Series S checkpoint from identical initial caches on the same local integration of main and #257, with #1388 as the app source change. The patched run reached the cell and recorded 206 distinct presents over 54 seconds at 3.82 FPS, with 965 MiB minimum free VRAM and no pending pipelines. Camera movement responded to input. The unpatched run reached the matched view and hit the local GPU headroom stop at 618 MiB free before completing the window. This pair establishes a working Proton run with the patch. A complete control window is still needed for an FPS or CPU-copy comparison. Assisted by Codex (GPT-6.2-Sol High).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1388/head:github-bot/gh-1388'
git switch 'github-bot/gh-1388'

Merge

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