Add opt-in differential queries for certified buffer refreshes #4995

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

@⁠sklzygit on GitHub · 2026-12-01 16:54 UTC · original
sklzygit:contrib/differential-refresh-20261201 → main · +542 −11 · 5 files · 1 commits · open

What it changes

Large buffer refreshes can materialize the journal's complete historical page list, then walk the span again to select stale pages. With a previously copied 128 MiB range and one newly written 4 KiB part, most of that query result is old history.

Add opt-in VICTORY_REFRESH_DELTAS=1 (default OFF):

  • A complete-copy certificate bounds the journal projection. Per-64-page (4 MiB) upper-bound epochs skip clean groups; only newer records reach the copy planner.
  • Free gaps around pending shader writes retain separate certificates. Their minimum bounds one span query; an unknown gap uses the original full-history path. Tiny gaps remain eligible as part of a large union.
  • First copies and standalone single-page requests retain the existing planner. Sub-page masks and partial borders still apply. Copied stamps/certificates publish after bytes land.
  • Five-second counters report eligible queries, span-page coverage and returned records. Coverage is not bytes saved or a count of historical journal entries.

This is extracted directly onto 5fabb46e, independently of #3756: it retains main's JOURNAL locking and ordinary guard/kernel query operation. It does not cache an earlier submission's journal answer. No dependency, shader, launcher, settings, barrier or GPU-flight ownership changes.

How it was tested

  • Hardware: Ryzen 7 9800X3D, NVIDIA GeForce RTX 5080 16 GB, 32 GB RAM, Windows 11, NVIDIA 621.40 (32.0.16.2140).
  • Clean extraction tested commit: dc2fc8376eefcc69584593e3e1a7f8d737f3c197, one commit on 5fabb46e.
  • With VICTORY_REFRESH_DELTAS=1, cargo test --locked -p victory-gpu --lib -- --test-threads=1: 1,098 passed, 0 failed, 71 ignored.
  • Ten explicit fresh-process projection/native cases passed in both debug and release (20 child checks): delta OFF/ON, PAGE_PARTS OFF/ON, owner-reported writes and real Windows GetWriteWatch, partial edges, 200 mutations, repeated fragmented-gap updates, a 4 KiB gap between pending regions, unknown-gap fallback, range expansion, and actual decommit/recommit with mapping notifications. The mapped-resource cases compare owned bytes and submit no GPU commands.
  • Component benchmark: cargo test --locked --release -p victory-gpu --lib delta --no-run, with RUSTFLAGS=-C target-cpu=znver5, release LTO off, 16 codegen units and debug off; then fresh-process shadow::delta::tests::measure_native_large_heap_refreshes --exact --ignored --nocapture. Same executable, alternating OFF/ON, six pairs per scenario; first pair excluded, median of five. A 128 MiB authored mapped Shadow receives 512 single-byte updates and full-heap refresh requests. Both modes copy exactly 2,097,152 bytes and match the complete byte oracle.
Component workload (512 updates) OFF ON
Owner-reported writes, wall 2.303 ms 0.608 ms
Real Windows write-watch, total wall 35.692 ms 33.233 ms
Real Windows write-watch, refresh portion 2.116 ms 0.396 ms

These are CPU component timings, not game-frame timings or a whole-process RAM saving. The Windows collection cost remains. Short component timings vary; there is no 3.8x game-FPS claim.

  • Separate gameplay evidence belongs to a private integration, not this exact clean extraction: Series X, 1080p scene / 2560x1440 output, DLSS Quality, base cap 30, frame generation OFF, ray tracing OFF. A 9m06s in-world interval recorded 28.97 FPS, maximum 240 ms, no frames >250 ms; the user reported markedly smoother play. Other local changes and warmer pipelines confound comparison. The ordinary slow-frame tail was not uniformly improved. No isolated FPS, visual-correctness or large RAM/VRAM-saving claim is made for this PR.
  • For shader changes, wave sizes: N/A; no shader changes.
  • cargo test passed for the crate it touches: yes, GPU lib suite above. Full workspace tests were not run.
  • cargo clippy --locked -p victory-gpu --lib --tests -- -D warnings stops on the same five findings reproduced on unmodified 5fabb46e: font.rs:213/260, menu.rs:667, panel.rs:602/668. Those UI files are untouched; no delta-module finding was reported. This is not a CI-pass claim.
  • cargo run --locked --quiet -p xtask -- policy --staged: five source files passed. git diff --check: passed. Cargo.lock is unchanged. No title data, logs, screenshots or caches are included.

Checked for overlap

  • Searched open/closed issues and PRs for writes_after, REFRESH_DELTAS, differential refresh, journal summaries and the relevant functions. Inspected the first 1,000 updated open PRs; 229 touched watch.rs, shadow.rs or host/send.rs. Own existing PRs #4220, #4394 and #4395 remain relevant and mergeable.
  • #2049 provides a sparse copy-stale planner but still receives the historical written input. This proposal supplies a differential query and group index before result allocation, so dense historical journals can produce genuinely sparse input. The minimal consuming planner follows that existing principle and credits it in source; it does not import the other changes in that stack. Please coordinate the small planner overlap if #2049 lands first.
  • #3756 changes journal locking/publication. This PR retains main's locking and needs none of that patch.
  • #4802 observes the original page-walk denominator. That complements this opt-in policy; requested span coverage alone is not claimed as work saved.
  • #4294 bypasses an empty-journal stale walk; this handles the non-empty historical-journal case. The range-publication helper is an extraction of existing code, as in that PR.
  • #2795 supplies the existing newer-write predicate for textures; this adds filtered page records and a consuming buffer-refresh path.
**@⁠sklzygit** on GitHub · 2026-12-01 16:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4994) `sklzygit:contrib/differential-refresh-20261201` → `main` · +542 −11 · 5 files · 1 commits · open ## What it changes Large buffer refreshes can materialize the journal's complete historical page list, then walk the span again to select stale pages. With a previously copied 128 MiB range and one newly written 4 KiB part, most of that query result is old history. Add opt-in `VICTORY_REFRESH_DELTAS=1` (default OFF): - A complete-copy certificate bounds the journal projection. Per-64-page (4 MiB) upper-bound epochs skip clean groups; only newer records reach the copy planner. - Free gaps around pending shader writes retain separate certificates. Their minimum bounds one span query; an unknown gap uses the original full-history path. Tiny gaps remain eligible as part of a large union. - First copies and standalone single-page requests retain the existing planner. Sub-page masks and partial borders still apply. Copied stamps/certificates publish after bytes land. - Five-second counters report eligible queries, span-page coverage and returned records. Coverage is not bytes saved or a count of historical journal entries. This is extracted directly onto `5fabb46e`, independently of #3756: it retains main's JOURNAL locking and ordinary guard/kernel query operation. It does not cache an earlier submission's journal answer. No dependency, shader, launcher, settings, barrier or GPU-flight ownership changes. ## How it was tested - Hardware: Ryzen 7 9800X3D, NVIDIA GeForce RTX 5080 16 GB, 32 GB RAM, Windows 11, NVIDIA 621.40 (32.0.16.2140). - Clean extraction tested commit: `dc2fc8376eefcc69584593e3e1a7f8d737f3c197`, one commit on `5fabb46e`. - With `VICTORY_REFRESH_DELTAS=1`, `cargo test --locked -p victory-gpu --lib -- --test-threads=1`: **1,098 passed, 0 failed, 71 ignored**. - Ten explicit fresh-process projection/native cases passed in both debug and release (20 child checks): delta OFF/ON, PAGE_PARTS OFF/ON, owner-reported writes and real Windows GetWriteWatch, partial edges, 200 mutations, repeated fragmented-gap updates, a 4 KiB gap between pending regions, unknown-gap fallback, range expansion, and actual decommit/recommit with mapping notifications. The mapped-resource cases compare owned bytes and submit no GPU commands. - Component benchmark: `cargo test --locked --release -p victory-gpu --lib delta --no-run`, with `RUSTFLAGS=-C target-cpu=znver5`, release LTO off, 16 codegen units and debug off; then fresh-process `shadow::delta::tests::measure_native_large_heap_refreshes --exact --ignored --nocapture`. Same executable, alternating OFF/ON, six pairs per scenario; first pair excluded, median of five. A 128 MiB authored mapped Shadow receives 512 single-byte updates and full-heap refresh requests. Both modes copy exactly **2,097,152 bytes** and match the complete byte oracle. | Component workload (512 updates) | OFF | ON | |---|---:|---:| | Owner-reported writes, wall | 2.303 ms | 0.608 ms | | Real Windows write-watch, total wall | 35.692 ms | 33.233 ms | | Real Windows write-watch, refresh portion | 2.116 ms | 0.396 ms | These are CPU component timings, not game-frame timings or a whole-process RAM saving. The Windows collection cost remains. Short component timings vary; there is no 3.8x game-FPS claim. - Separate gameplay evidence belongs to a private integration, **not this exact clean extraction**: Series X, 1080p scene / 2560x1440 output, DLSS Quality, base cap 30, frame generation OFF, ray tracing OFF. A 9m06s in-world interval recorded 28.97 FPS, maximum 240 ms, no frames >250 ms; the user reported markedly smoother play. Other local changes and warmer pipelines confound comparison. The ordinary slow-frame tail was not uniformly improved. No isolated FPS, visual-correctness or large RAM/VRAM-saving claim is made for this PR. - For shader changes, wave sizes: N/A; no shader changes. - `cargo test` passed for the crate it touches: **yes, GPU lib suite above**. Full workspace tests were not run. - `cargo clippy --locked -p victory-gpu --lib --tests -- -D warnings` stops on the same five findings reproduced on unmodified `5fabb46e`: font.rs:213/260, menu.rs:667, panel.rs:602/668. Those UI files are untouched; no delta-module finding was reported. This is not a CI-pass claim. - `cargo run --locked --quiet -p xtask -- policy --staged`: five source files passed. `git diff --check`: passed. Cargo.lock is unchanged. No title data, logs, screenshots or caches are included. ## Checked for overlap - [x] Searched open/closed issues and PRs for writes_after, REFRESH_DELTAS, differential refresh, journal summaries and the relevant functions. Inspected the first 1,000 updated open PRs; 229 touched watch.rs, shadow.rs or host/send.rs. Own existing PRs #4220, #4394 and #4395 remain relevant and mergeable. - **#2049** provides a sparse copy-stale planner but still receives the historical `written` input. This proposal supplies a differential query and group index *before* result allocation, so dense historical journals can produce genuinely sparse input. The minimal consuming planner follows that existing principle and credits it in source; it does not import the other changes in that stack. Please coordinate the small planner overlap if #2049 lands first. - **#3756** changes journal locking/publication. This PR retains main's locking and needs none of that patch. - **#4802** observes the original page-walk denominator. That complements this opt-in policy; requested span coverage alone is not claimed as work saved. - **#4294** bypasses an empty-journal stale walk; this handles the non-empty historical-journal case. The range-publication helper is an extraction of existing code, as in that PR. - **#2795** supplies the existing newer-write predicate for textures; this adds filtered page records and a consuming buffer-refresh path.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 16:57:11 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/shadow.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/4995/head:github-bot/gh-4994'
git switch 'github-bot/gh-4994'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4994'
git switch 'github-bot/gh-4994'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4994'
git switch 'github-bot/gh-4994'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4994'
git switch 'main'
git merge --squash 'github-bot/gh-4994'
git switch 'main'
git merge --ff-only 'github-bot/gh-4994'
git switch 'main'
git merge 'github-bot/gh-4994'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4995
No description provided.