perf(gpu): scope title write invalidations, trim submit steps, and speed up texture refresh #3109

Closed
github-bot wants to merge 1 commit from github-bot/gh-3109 into main AGit
Owner

@⁠qlfu on GitHub · 2026-11-29 20:03 UTC · original
qlfu:pr/perf-submit-steps-and-texture-refresh → main · +508 −110 · 6 files · 1 commits · closed without merging

Summary

Cuts CPU overhead in per-submission step execution (steps_oth, HostList::run_deferred, HostList::prelude) and texture refresh checks:

  • Scoped Batch::invalidate_written: evicts only ahead and textures entries overlapping [dst, dst + len) (and physical-page alias blocks via watch::wrote_and_elsewhere / elsewhere_blocks) instead of clearing the entire ahead/textures maps on every Step::Copy / Step::Placed.
  • Step::Host split from Step::Run: host-only bookkeeping callbacks no longer flush batch.fill(), invalidate ahead/textures, or terminate ask_once. Also measures Step::Copy/Step::Placed timing after batch.fill()/batch.flush() so batched fill/flush work is not double-counted in SPLIT[7] (copies_fills).
  • Submit & prelude trims: Taken::has_list, batched port::bounds_snapshot / note_filled_batch, lazy air & place::forwards gated on any_placed, cached HostList::cmd_list, lock trims in HostList::prelude (has_detiles, has_twins, alias_rt::on()), fused refresh_front walk, Batch::last_ahead 1-entry cache.
  • Lock-free texture refresh & AVX2 digest: lock-free PreludeUpload::finish_refresh (uploaded && !dirty), Staging::watch_kind + lock-free watch::guarded_clean_since (PageEpochs::all_at_most), all_there checked under _mapped, and AVX2 128-byte-stripe texture::digest.

Verification

  • cargo +1.98.1-x86_64-pc-windows-msvc clippy -p victory-gpu --lib --tests --no-deps --locked: 0 new warnings.
  • cargo +1.98.1-x86_64-pc-windows-msvc test -p victory-gpu --lib --locked -- --test-threads=1 (texture::, host::, watch::): 288/288 passed.
  • Live 90s benchmarks on Series X title (1440p DLSS Balanced, 0 WARNs / 0 ERRORs):
    • steps_oth: 7.35 -> 4.40 ms (-2.95 ms/frame, -40.1%, Native) / 6.50 -> 4.75 ms (FG).
    • copies_fills: 3.85 -> 2.75 ms (-1.10 ms/frame, -28.6%).
    • texture refreshes (all threads): 11.4 -> 8.5 ms (-25.4%), tex_ask: 1.9 -> 0.2 ms (-89.5%), flush_one: 248–268 -> 3–9 (-97%).
**@⁠qlfu** on GitHub · 2026-11-29 20:03 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3109) `qlfu:pr/perf-submit-steps-and-texture-refresh` → `main` · +508 −110 · 6 files · 1 commits · closed without merging ## Summary Cuts CPU overhead in per-submission step execution (`steps_oth`, `HostList::run_deferred`, `HostList::prelude`) and texture refresh checks: - **Scoped `Batch::invalidate_written`**: evicts only `ahead` and `textures` entries overlapping `[dst, dst + len)` (and physical-page alias blocks via `watch::wrote_and_elsewhere` / `elsewhere_blocks`) instead of clearing the entire `ahead`/`textures` maps on every `Step::Copy` / `Step::Placed`. - **`Step::Host` split from `Step::Run`**: host-only bookkeeping callbacks no longer flush `batch.fill()`, invalidate `ahead`/`textures`, or terminate `ask_once`. Also measures `Step::Copy`/`Step::Placed` timing after `batch.fill()`/`batch.flush()` so batched fill/flush work is not double-counted in `SPLIT[7]` (`copies_fills`). - **Submit & prelude trims**: `Taken::has_list`, batched `port::bounds_snapshot` / `note_filled_batch`, lazy `air` & `place::forwards` gated on `any_placed`, cached `HostList::cmd_list`, lock trims in `HostList::prelude` (`has_detiles`, `has_twins`, `alias_rt::on()`), fused `refresh_front` walk, `Batch::last_ahead` 1-entry cache. - **Lock-free texture refresh & AVX2 digest**: lock-free `PreludeUpload::finish_refresh` (`uploaded && !dirty`), `Staging::watch_kind` + lock-free `watch::guarded_clean_since` (`PageEpochs::all_at_most`), `all_there` checked under `_mapped`, and AVX2 128-byte-stripe `texture::digest`. ## Verification - `cargo +1.98.1-x86_64-pc-windows-msvc clippy -p victory-gpu --lib --tests --no-deps --locked`: 0 new warnings. - `cargo +1.98.1-x86_64-pc-windows-msvc test -p victory-gpu --lib --locked -- --test-threads=1` (`texture::`, `host::`, `watch::`): `288/288` passed. - Live 90s benchmarks on Series X title (1440p DLSS Balanced, `0 WARNs / 0 ERRORs`): - `steps_oth`: `7.35 -> 4.40 ms` (`-2.95 ms/frame`, `-40.1%`, Native) / `6.50 -> 4.75 ms` (FG). - `copies_fills`: `3.85 -> 2.75 ms` (`-1.10 ms/frame`, `-28.6%`). - `texture refreshes (all threads)`: `11.4 -> 8.5 ms` (`-25.4%`), `tex_ask`: `1.9 -> 0.2 ms` (`-89.5%`), `flush_one`: `248–268 -> 3–9` (`-97%`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 20:06:56 +00:00
github-bot force-pushed github-bot/gh-3109 from d955b13ced to 083b1d6279 2026-11-30 00:17:24 +00:00 Compare
Author
Owner

@⁠qlfu on GitHub · 2026-11-30 00:12 UTC · original

Rebased cleanly onto main (41adb551), integrating upstream #2795 (watch::writes_since) with watch_kind caching + guarded_clean_since in texture.rs, and keeping #2604's lock-free !is_kept() fast path in watch::wrote / wrote_and_elsewhere. Verified watch::tests:: (41 passed) and --features diagnostics.

**@⁠qlfu** on GitHub · 2026-11-30 00:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3109#issuecomment-7265065391) Rebased cleanly onto `main` (`41adb551`), integrating upstream `#2795` (`watch::writes_since`) with `watch_kind` caching + `guarded_clean_since` in `texture.rs`, and keeping `#2604`'s lock-free `!is_kept()` fast path in `watch::wrote` / `wrote_and_elsewhere`. Verified `watch::tests::` (41 passed) and `--features diagnostics`.
Author
Owner

@⁠DoubleD17 on GitHub · 2026-11-30 07:58 UTC · original · edited 2026-11-30 09:56 UTC

We ran a test of this PR on current main (41adb551 with this PR merged), on a CPU-bound machine.

We compare only the seconds where the idle camera shows the same lighter views (about 7,500 draws a frame). Its heavier view (about 15,000 draws, half the frame rate) takes 10 to 60 s of each 150 s run, and it moved whole-run means by several ms.

CPU prep (ms/frame) main at that point fps main at that point
round 1 63.2 60.6 14.0 14.3
round 2 60.8 60.2 14.8 15.2
mean difference +1.6 ms −2.4 %

No difference we can measure. The five main runs of the session agreed within 1.3 ms on these seconds. But we also ran main again, built in another folder, eight times: it ranged from 57.5 to 65.5 ms. Its first four runs were 2.4 ms slower than main on average, and the last four 4.2 ms faster. All nine PRs we tested in this session came out 0.4 to 3.9 ms slower than main, and fps moved with it. So we read the difference as a newly built executable, not as this PR.

Picture: 0 defects in 160 frames.

Setup:

  • Ryzen 7 5800X (8 cores, 16 threads), RTX 5070 12 GB (DXGI budget 11,175 MB), 64 GB RAM, Windows 11;
  • Series X, 1440p with DLAA (DLSS at native resolution; corrected, this line said DLSS Performance at first), frame generation and ray tracing off;
  • the PR merged locally onto main 41adb551 (only its own commits on top), against 41adb551 itself;
  • a warm-up run per build, then 150 s runs in two rounds (the second in reverse order), with five main runs spread through the session;
  • every run starts from the same save, restored before each run;
  • CPU prep is the median of the submitting thread's 5 s lines, fps the median of the host's 5 s lines, on the light-view seconds after the first 20 s; each run is compared with main's runs interpolated in time.

Picture check: a burst of 10 captures a second at the end of each run (80 frames), looked at frame by frame.

AI Assisted

**@⁠DoubleD17** on GitHub · 2026-11-30 07:58 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3109#issuecomment-7272334598) · edited 2026-11-30 09:56 UTC We ran a test of this PR on current main (41adb551 with this PR merged), on a CPU-bound machine. We compare only the seconds where the idle camera shows the same lighter views (about 7,500 draws a frame). Its heavier view (about 15,000 draws, half the frame rate) takes 10 to 60 s of each 150 s run, and it moved whole-run means by several ms. | | CPU prep (ms/frame) | main at that point | fps | main at that point | |---|---|---|---|---| | round 1 | 63.2 | 60.6 | 14.0 | 14.3 | | round 2 | 60.8 | 60.2 | 14.8 | 15.2 | | **mean difference** | **+1.6 ms** | | **−2.4 %** | | No difference we can measure. The five main runs of the session agreed within 1.3 ms on these seconds. But we also ran main again, built in another folder, eight times: it ranged from 57.5 to 65.5 ms. Its first four runs were 2.4 ms slower than main on average, and the last four 4.2 ms faster. All nine PRs we tested in this session came out 0.4 to 3.9 ms slower than main, and fps moved with it. So we read the difference as a newly built executable, not as this PR. **Picture:** 0 defects in 160 frames. **Setup:** - Ryzen 7 5800X (8 cores, 16 threads), RTX 5070 12 GB (DXGI budget 11,175 MB), 64 GB RAM, Windows 11; - Series X, 1440p with DLAA (DLSS at native resolution; corrected, this line said DLSS Performance at first), frame generation and ray tracing off; - the PR merged locally onto main 41adb551 (only its own commits on top), against 41adb551 itself; - a warm-up run per build, then 150 s runs in two rounds (the second in reverse order), with five main runs spread through the session; - every run starts from the same save, restored before each run; - CPU prep is the median of the submitting thread's 5 s lines, fps the median of the host's 5 s lines, on the light-view seconds after the first 20 s; each run is compared with main's runs interpolated in time. Picture check: a burst of 10 captures a second at the end of each run (80 frames), looked at frame by frame. AI Assisted
github-bot closed this pull request 2026-12-01 18:59:03 +00:00

Pull request closed

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