perf(gpu): restore MANY_CHUNK = 8 in Batch::flush_all for 6-core work-stealing #1556

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

@⁠steven-seagull27 on GitHub · 2026-11-28 21:40 UTC · original
steven-seagull27:perf/batch-noop-refreshes → main · +7 −5 · 1 files · 1 commits · open

Reduces submitting-thread and concurrent-landing CPU overhead on large no-op refresh flushes (e.g. heap buffer views where VICTORY_ASK_ONCE is already active) via four surgical changes in crates/victory-gpu/src/{watch.rs, shadow.rs, host.rs}:

  1. Lock-free watch::asking_kept() fast path (watch.rs, host.rs):
    • Tracks Journal::kept in static KEPT: AtomicBool (updated under JOURNAL.write() in ask_rest and ask_once_end).
    • watch::ask_ahead returns immediately when asking_kept() is true instead of walking published(), allocating, and sorting pieces only to discard them after locking.
    • watch::ask_ahead_done returns immediately when asking_kept() is true instead of taking an exclusive JOURNAL.write() lock on every flush.
    • Batch::flush_all and Batch::refresh_front skip allocating/populating ranges when asking_kept() is true.
  2. Sorted & merged Journal::ahead with binary search (watch.rs):
    • Stores j.ahead = merged(...) in ask_ahead and ask_rest and replaces linear .iter().any(...) scans with ahead_covers (partition_point).
  3. Chunked, journal-amortized nothing_new pass (watch.rs, shadow.rs, host.rs):
    • Adds watch::with_journal / JournalView / watch::is_published and Shadow::prepare_nothing_new / Shadow::nothing_new_in_journal (using self.copied.try_lock() to guarantee no lock-order inversion with copy_stale -> parts_written, falling back conservatively to false on contention).
    • Preserves the "bits first, then journal" ordering invariant: for <= 64-item sub-chunks, checks published() bits before taking a single JOURNAL.read(), partitions dirty indices into a stack [usize; 64], drops the Journal guard before Batch::update, and flushes FLUSHES[2] once per sub-chunk.
    • Routes large flushes (len > 256) through shadow::wide_chunks(..., wide_chunk().max(64), ...) while keeping small dirty flushes (len <= 256) on single-journal in-place retain + wide_chunk() so small dirty flushes remain parallelized. Also reuses self.refreshes Vec capacity via Arc::try_unwrap.
  4. Fold Shadow::ranged into Shadow::copied's Mutex (shadow.rs):
    • Every access to self.ranged already held self.copied.lock(); folding it removes one redundant Mutex lock/unlock per refresh.

Synthetic Benchmark (host::refresh_tests::frame_of_refreshes, --release --locked)

Three consecutive runs before and after on Windows 11 x64, Rust 1.98.1 MSVC (pure CPU synthetic workload, 30 submissions × 4,400 copies + 174 MiB heap + concurrent landing thread):

Metric (3-run average) Baseline 923e38c This PR 4eea8be Delta
Frame mean 19.00 ms 14.01 ms -26.3% (-4.99 ms)
All-copies flush 5.43 ms 3.55 ms -34.6%
29 other flushes 13.57 ms 10.46 ms -22.9%
Concurrent landing puts 20.89 ms 13.96 ms -33.2%

Synthetic Unit Tests & Checks

  • Added 3 unit tests: watch::ask_holds::ahead_covers_merged_adjacent_disjoint_and_boundaries, watch::ask_holds::asking_kept_fast_path_guards_ask_ahead_and_done, and host::refresh_tests::chunked_nothing_new_matches_individual (3/3 passed).
  • watch:: (53 passed), shadow:: CPU suites (16 passed), host:: CPU suites (16 passed).
  • cargo check and cargo clippy --locked -p victory-gpu --all-features --lib --tests: zero warnings in watch.rs, shadow.rs, and all touched lines in host.rs.
  • cargo xtask policy: zero violations in any touched file (pre-existing lower.rs size check untouched).

AI-assisted. Synthetic verification only.

**@⁠steven-seagull27** on GitHub · 2026-11-28 21:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556) `steven-seagull27:perf/batch-noop-refreshes` → `main` · +7 −5 · 1 files · 1 commits · open Reduces submitting-thread and concurrent-landing CPU overhead on large no-op refresh flushes (e.g. heap buffer views where `VICTORY_ASK_ONCE` is already active) via four surgical changes in `crates/victory-gpu/src/{watch.rs, shadow.rs, host.rs}`: 1. **Lock-free `watch::asking_kept()` fast path (`watch.rs`, `host.rs`):** - Tracks `Journal::kept` in `static KEPT: AtomicBool` (updated under `JOURNAL.write()` in `ask_rest` and `ask_once_end`). - `watch::ask_ahead` returns immediately when `asking_kept()` is true instead of walking `published()`, allocating, and sorting `pieces` only to discard them after locking. - `watch::ask_ahead_done` returns immediately when `asking_kept()` is true instead of taking an exclusive `JOURNAL.write()` lock on every flush. - `Batch::flush_all` and `Batch::refresh_front` skip allocating/populating `ranges` when `asking_kept()` is true. 2. **Sorted & merged `Journal::ahead` with binary search (`watch.rs`):** - Stores `j.ahead = merged(...)` in `ask_ahead` and `ask_rest` and replaces linear `.iter().any(...)` scans with `ahead_covers` (`partition_point`). 3. **Chunked, journal-amortized `nothing_new` pass (`watch.rs`, `shadow.rs`, `host.rs`):** - Adds `watch::with_journal` / `JournalView` / `watch::is_published` and `Shadow::prepare_nothing_new` / `Shadow::nothing_new_in_journal` (using `self.copied.try_lock()` to guarantee no lock-order inversion with `copy_stale -> parts_written`, falling back conservatively to `false` on contention). - Preserves the "bits first, then journal" ordering invariant: for `<= 64`-item sub-chunks, checks `published()` bits before taking a single `JOURNAL.read()`, partitions dirty indices into a stack `[usize; 64]`, **drops the `Journal` guard before `Batch::update`**, and flushes `FLUSHES[2]` once per sub-chunk. - Routes large flushes (`len > 256`) through `shadow::wide_chunks(..., wide_chunk().max(64), ...)` while keeping small dirty flushes (`len <= 256`) on single-journal in-place `retain` + `wide_chunk()` so small dirty flushes remain parallelized. Also reuses `self.refreshes` `Vec` capacity via `Arc::try_unwrap`. 4. **Fold `Shadow::ranged` into `Shadow::copied`'s `Mutex` (`shadow.rs`):** - Every access to `self.ranged` already held `self.copied.lock()`; folding it removes one redundant `Mutex` lock/unlock per refresh. ### Synthetic Benchmark (`host::refresh_tests::frame_of_refreshes`, `--release --locked`) Three consecutive runs before and after on Windows 11 x64, Rust 1.98.1 MSVC (pure CPU synthetic workload, 30 submissions × 4,400 copies + 174 MiB heap + concurrent landing thread): | Metric (3-run average) | Baseline `923e38c` | This PR `4eea8be` | Delta | |---|---:|---:|---:| | Frame mean | 19.00 ms | **14.01 ms** | **-26.3% (-4.99 ms)** | | All-copies flush | 5.43 ms | **3.55 ms** | **-34.6%** | | 29 other flushes | 13.57 ms | **10.46 ms** | **-22.9%** | | Concurrent landing puts | 20.89 ms | **13.96 ms** | **-33.2%** | ### Synthetic Unit Tests & Checks - Added 3 unit tests: `watch::ask_holds::ahead_covers_merged_adjacent_disjoint_and_boundaries`, `watch::ask_holds::asking_kept_fast_path_guards_ask_ahead_and_done`, and `host::refresh_tests::chunked_nothing_new_matches_individual` (**3/3 passed**). - `watch::` (**53 passed**), `shadow::` CPU suites (**16 passed**), `host::` CPU suites (**16 passed**). - `cargo check` and `cargo clippy --locked -p victory-gpu --all-features --lib --tests`: zero warnings in `watch.rs`, `shadow.rs`, and all touched lines in `host.rs`. - `cargo xtask policy`: zero violations in any touched file (pre-existing `lower.rs` size check untouched). AI-assisted. Synthetic verification only.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 21:43:10 +00:00
Author
Owner

@⁠domx4q on GitHub · 2026-11-29 00:47 UTC · original

Tested this on Linux, so another kind of host.

  • Setup: RTX 4090, i9-14900KF, Proton Experimental 11 with vkd3d-proton master, Series X, DLSS quality, 1440p, frame generation 2x.
  • Scene: the int_chase save, a fixed 330 s run with scripted input. Each build ran in turn, with the PC otherwise idle.
  • main (d4b5d51): 21.6 fps, 49 ms a frame, 36 ms preparing.
  • This PR merged on d4b5d51: 22.1 fps, 48 ms a frame, 37 ms preparing.

There were no crashes and no Xid faults, and the picture looked the same. On this machine the difference is within run-to-run noise (about ±1 fps), so nothing is lost. A gain may show more on CPUs with fewer cores, where the refresh contention in #1521 was measured.

**@⁠domx4q** on GitHub · 2026-11-29 00:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7248353026) Tested this on Linux, so another kind of host. - Setup: RTX 4090, i9-14900KF, Proton Experimental 11 with vkd3d-proton master, Series X, DLSS quality, 1440p, frame generation 2x. - Scene: the int_chase save, a fixed 330 s run with scripted input. Each build ran in turn, with the PC otherwise idle. - `main` (d4b5d51): 21.6 fps, 49 ms a frame, 36 ms preparing. - This PR merged on d4b5d51: 22.1 fps, 48 ms a frame, 37 ms preparing. There were no crashes and no Xid faults, and the picture looked the same. On this machine the difference is within run-to-run noise (about ±1 fps), so nothing is lost. A gain may show more on CPUs with fewer cores, where the refresh contention in #1521 was measured.
github-bot force-pushed github-bot/gh-1556 from 4eea8bee6f to da8e9461a7 2026-11-29 00:56:26 +00:00 Compare
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-29 00:51 UTC · original · edited 2026-11-29 08:01 UTC

Rebased cleanly onto f9dfb76 (da8e946): dropped our Shadow::ranged fold since #1463 (0174844) already merged shared Copied locking, and added a #[cfg(test)] watch::nothing_new wrapper for 59e7a01's test.

Re-verified on Windows 11 x64 / Rust 1.98.1 MSVC (--locked):

  • cargo test --locked -p victory-gpu --lib -- watch:: --test-threads=1: 55 passed, 0 failed
  • cargo test --release --locked -p victory-gpu --lib -- host::refresh_tests::frame_of_refreshes --exact --nocapture: 13.82 ms (down from 19.00 ms baseline)

Synthetic tests only.

**@⁠steven-seagull27** on GitHub · 2026-11-29 00:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7248402071) · edited 2026-11-29 08:01 UTC Rebased cleanly onto `f9dfb76` (`da8e946`): dropped our `Shadow::ranged` fold since #1463 (`0174844`) already merged shared `Copied` locking, and added a `#[cfg(test)]` `watch::nothing_new` wrapper for `59e7a01`'s test. Re-verified on Windows 11 x64 / Rust 1.98.1 MSVC (`--locked`): - `cargo test --locked -p victory-gpu --lib -- watch:: --test-threads=1`: **55 passed, 0 failed** - `cargo test --release --locked -p victory-gpu --lib -- host::refresh_tests::frame_of_refreshes --exact --nocapture`: **13.82 ms** (down from 19.00 ms baseline) Synthetic tests only.
Author
Owner

@⁠amazedturnip on GitHub · 2026-11-29 05:38 UTC · original

Tested in a combined submit-thread perf stack on 9800X3D + RTX 5070 Ti 16 GB (Series X 1440p DLSS). Ran cleanly across 20+ min sessions with zero races/crashes; combined stack brought preparing time from ~39.8 ms down to ~17.2-20.0 ms and refreshes from ~13.2 ms to ~5.3-8.6 ms.

**@⁠amazedturnip** on GitHub · 2026-11-29 05:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7251374249) Tested in a combined submit-thread perf stack on 9800X3D + RTX 5070 Ti 16 GB (Series X 1440p DLSS). Ran cleanly across 20+ min sessions with zero races/crashes; combined stack brought preparing time from ~39.8 ms down to ~17.2-20.0 ms and refreshes from ~13.2 ms to ~5.3-8.6 ms.
github-bot force-pushed github-bot/gh-1556 from da8e9461a7 to f79b22c56e 2026-11-29 08:50:06 +00:00 Compare
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-29 08:45 UTC · original

Rebased cleanly onto latest main (829188e9, commit f79b22c5).

Superseded pieces cleanly dropped

Waves 1–6 (notably #1094 / 27d312d3) already landed:

  • Lock-free WRITTEN_EPOCHS, atomic Shadow::copied, SeqLock ranged_lockfree, and Shadow::nothing_new_with
  • watch::is_kept() (called in refresh_front and flush_all)
  • Sorted/merged Journal::ahead + ahead_contains binary search
  • Zero-allocation shadow::wide_each_scoped

The earlier JournalView / wide_chunks / duplicate asking_kept / ahead_covers wrappers were dropped in favor of those upstream primitives.

What remains & is fixed on top of 829188e9

  1. Re-wired Shadow::nothing_new_with + 64-item chunking across Batch (crates/victory-gpu/src/host.rs):
    • The wave merges left ahead_snap, MANY_CHUNK, and nothing_new_with orphaned/unused in host.rs, causing Batch::refresh_front, Batch::refresh_ahead, Batch::flush_all, sift_front, and sift_refreshes to fall back to Shadow::nothing_new (acquiring the JOURNAL read lock per span).
    • All of these paths now snapshot watch::ahead_snapshot_into(&mut self.ahead_snap) once per pass and filter spans lock-free via Shadow::nothing_new_with.
    • Large flushes (> 256 refreshes) and parallel sifting (sift_spans, shared by VICTORY_FRONT_SIFT and VICTORY_FLUSH_SIFT) use 64-item scoped chunks (MANY_CHUNK = 64), reducing cross-core atomic contention on scoped_rem and FLUSHES[2] and reusing Vec capacity in place; the non-wide fallback also filters no-ops via nothing_new_with.
    • Resolves the 4 dead-code / unused-variable warnings on ahead_snap, MANY_CHUNK, Shadow::nothing_new_with, and watch::nothing_new_with.
  2. Lock-free is_kept() fast path in watch::ask_ahead / ask_ahead_done and ahead_contains in would_wait (crates/victory-gpu/src/watch.rs):
    • ask_ahead and ask_ahead_done now short-circuit on is_kept() before bit checks, allocations, or taking journal_mut().
    • would_wait uses ahead_contains instead of a linear scan over j.ahead.
  3. Synthetic unit tests:
    • watch::ask_holds::asking_kept_fast_path_guards_ask_ahead_and_done
    • host::refresh_tests::chunked_nothing_new_with_matches_individual

Verification

  • cargo test --locked -p victory-gpu --lib -- watch:: --test-threads=1: 63 passed, 0 failed
  • cargo test --locked -p victory-gpu --lib -- host::refresh_tests:: --test-threads=1: 6 passed, 0 failed (2 ignored)
  • cargo clippy --locked -p victory-gpu --lib --tests: 0 new warnings (and 4 pre-existing warnings eliminated in touched code)
  • git diff --check: clean
  • Synthetic benchmark (cargo test --release --locked -p victory-gpu --lib -- host::refresh_tests::frame_of_refreshes --exact --ignored --nocapture):
    • main (829188e9): 14.04 ms / 16.12 ms mean (all copies 3.74–4.14 ms, 29 others 10.30–11.98 ms)
    • Rebased (f79b22c5, 3 runs): 13.25 ms, 13.01 ms, 12.82 ms (median 13.01 ms; all copies 3.37–3.48 ms, 29 others 9.45–9.82 ms)
**@⁠steven-seagull27** on GitHub · 2026-11-29 08:45 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7253312856) Rebased cleanly onto latest `main` (`829188e9`, commit `f79b22c5`). ### Superseded pieces cleanly dropped Waves 1–6 (notably `#1094` / `27d312d3`) already landed: - Lock-free `WRITTEN_EPOCHS`, atomic `Shadow::copied`, SeqLock `ranged_lockfree`, and `Shadow::nothing_new_with` - `watch::is_kept()` (called in `refresh_front` and `flush_all`) - Sorted/merged `Journal::ahead` + `ahead_contains` binary search - Zero-allocation `shadow::wide_each_scoped` The earlier `JournalView` / `wide_chunks` / duplicate `asking_kept` / `ahead_covers` wrappers were dropped in favor of those upstream primitives. ### What remains & is fixed on top of `829188e9` 1. **Re-wired `Shadow::nothing_new_with` + 64-item chunking across `Batch` (`crates/victory-gpu/src/host.rs`)**: - The wave merges left `ahead_snap`, `MANY_CHUNK`, and `nothing_new_with` orphaned/unused in `host.rs`, causing `Batch::refresh_front`, `Batch::refresh_ahead`, `Batch::flush_all`, `sift_front`, and `sift_refreshes` to fall back to `Shadow::nothing_new` (acquiring the `JOURNAL` read lock per span). - All of these paths now snapshot `watch::ahead_snapshot_into(&mut self.ahead_snap)` once per pass and filter spans lock-free via `Shadow::nothing_new_with`. - Large flushes (`> 256` refreshes) and parallel sifting (`sift_spans`, shared by `VICTORY_FRONT_SIFT` and `VICTORY_FLUSH_SIFT`) use 64-item scoped chunks (`MANY_CHUNK = 64`), reducing cross-core atomic contention on `scoped_rem` and `FLUSHES[2]` and reusing `Vec` capacity in place; the non-wide fallback also filters no-ops via `nothing_new_with`. - Resolves the 4 dead-code / unused-variable warnings on `ahead_snap`, `MANY_CHUNK`, `Shadow::nothing_new_with`, and `watch::nothing_new_with`. 2. **Lock-free `is_kept()` fast path in `watch::ask_ahead` / `ask_ahead_done` and `ahead_contains` in `would_wait` (`crates/victory-gpu/src/watch.rs`)**: - `ask_ahead` and `ask_ahead_done` now short-circuit on `is_kept()` before bit checks, allocations, or taking `journal_mut()`. - `would_wait` uses `ahead_contains` instead of a linear scan over `j.ahead`. 3. **Synthetic unit tests**: - `watch::ask_holds::asking_kept_fast_path_guards_ask_ahead_and_done` - `host::refresh_tests::chunked_nothing_new_with_matches_individual` ### Verification - `cargo test --locked -p victory-gpu --lib -- watch:: --test-threads=1`: **63 passed, 0 failed** - `cargo test --locked -p victory-gpu --lib -- host::refresh_tests:: --test-threads=1`: **6 passed, 0 failed** (2 ignored) - `cargo clippy --locked -p victory-gpu --lib --tests`: **0 new warnings** (and 4 pre-existing warnings eliminated in touched code) - `git diff --check`: clean - Synthetic benchmark (`cargo test --release --locked -p victory-gpu --lib -- host::refresh_tests::frame_of_refreshes --exact --ignored --nocapture`): - `main` (`829188e9`): `14.04 ms` / `16.12 ms` mean (all copies `3.74–4.14 ms`, 29 others `10.30–11.98 ms`) - Rebased (`f79b22c5`, 3 runs): `13.25 ms`, `13.01 ms`, `12.82 ms` (median **`13.01 ms`**; all copies **`3.37–3.48 ms`**, 29 others **`9.45–9.82 ms`**)
Author
Owner

@⁠Yuanzer on GitHub · 2026-11-29 11:04 UTC · original

Independent A/B on the reporter's Windows 11 machine (i7-14700KF, 20C/28T, RTX 5060 Ti 8 GB, driver 621.40), using the same release test executable and default VICTORY_WIDE_THREADS. I alternated main 829188e9 and this PR f79b22c5 for 5 pairs: --exact host::refresh_tests::frame_of_refreshes --ignored --nocapture.

5-run median main 829188e9 this PR f79b22c5 delta
frame mean 15.07 ms 14.96 ms -0.7%
all-copies submission 4.04 ms 4.23 ms +4.7%
29 other flushes 10.82 ms 10.63 ms -1.8%
landing-thread puts 22.16 ms 21.69 ms -2.1%

Raw frame means, main / PR by pair: 14.68/15.06, 15.07/14.20, 15.12/15.01, 14.12/14.96, 15.12/14.38. The distributions overlap heavily.

On this CPU the isolated synthetic refresh path is effectively neutral (the 0.11 ms median difference is within run-to-run noise), and the all-copies sub-path is slightly slower. This does not contradict the positive combined-stack gameplay result above, but I would not use this microbenchmark alone as evidence of a frame-time win across CPUs. A game A/B on the same save/scene remains the decisive check.

Tested locally on behalf of the reporter.

**@⁠Yuanzer** on GitHub · 2026-11-29 11:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7254861534) Independent A/B on the reporter's Windows 11 machine (i7-14700KF, 20C/28T, RTX 5060 Ti 8 GB, driver 621.40), using the same release test executable and default `VICTORY_WIDE_THREADS`. I alternated main `829188e9` and this PR `f79b22c5` for 5 pairs: `--exact host::refresh_tests::frame_of_refreshes --ignored --nocapture`. | 5-run median | main `829188e9` | this PR `f79b22c5` | delta | |---|---:|---:|---:| | frame mean | 15.07 ms | 14.96 ms | -0.7% | | all-copies submission | 4.04 ms | 4.23 ms | +4.7% | | 29 other flushes | 10.82 ms | 10.63 ms | -1.8% | | landing-thread puts | 22.16 ms | 21.69 ms | -2.1% | Raw frame means, main / PR by pair: `14.68/15.06`, `15.07/14.20`, `15.12/15.01`, `14.12/14.96`, `15.12/14.38`. The distributions overlap heavily. On this CPU the isolated synthetic refresh path is effectively neutral (the 0.11 ms median difference is within run-to-run noise), and the all-copies sub-path is slightly slower. This does not contradict the positive combined-stack gameplay result above, but I would not use this microbenchmark alone as evidence of a frame-time win across CPUs. A game A/B on the same save/scene remains the decisive check. *Tested locally on behalf of the reporter.*
Author
Owner

@⁠Yuanzer on GitHub · 2026-11-29 14:26 UTC · original

Three-pair in-game A/B on the reporter's Windows 11 machine (AI-assisted local run):

  • CPU: i7-14700KF, 20C/28T; GPU: RTX 5060 Ti 8 GB, driver 621.40; 32 GB RAM.
  • Baseline: 829188e9; PR: f79b22c5.
  • Same release flags: Series S, internal 1280x720 -> 1920x1080, DLSS Quality preset M, frame generation off, ray tracing off, 1000 FPS cap.
  • Each run waited for the first world frame with >=500 draws, then a 15 s settle; 60 one-second title samples followed.
  • Order per pair was baseline -> PR, with three consecutive pairs.

Per-run medians:

pair main frame ms / draws PR frame ms / draws PR - main
1 67.25 / 7,320.5 67.25 / 7,021 0.00 ms
2 63.35 / 6,955 62.65 / 6,751 -0.70 ms
3 63.95 / 6,734 65.35 / 6,643 +1.40 ms

All 180 one-second samples per build:

main 829188e9 PR f79b22c5
median FPS 15 15
median frame 64.85 ms 65.65 ms
P90 frame 73.9 ms 73.4 ms
P99 frame 125.0 ms 89.3 ms
median draws 7,066.5 6,799.5
median ms per 1,000 draws 9.156 9.470

The three paired deltas straddle zero. The PR has the lower P99 in these runs, but it also sampled scenes with about 3.8% fewer draws; a per-1000-draw normalization is correspondingly worse. I would treat the isolated refresh path in this opening scene as neutral, not as a general frame-time win. The scene was not camera-locked, so draw count and in-game time are the main limitation.

There were no crashes or startup failures in the six runs. The earlier synthetic five-pair A/B already showed a similarly neutral result on this machine; this game-level run confirms that the benefit needs a scene/CPU condition that was not present here.

Runs and readings are from the reporter's machine; analysis and wording are AI-assisted.

**@⁠Yuanzer** on GitHub · 2026-11-29 14:26 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7257303079) Three-pair in-game A/B on the reporter's Windows 11 machine (AI-assisted local run): - CPU: i7-14700KF, 20C/28T; GPU: RTX 5060 Ti 8 GB, driver 621.40; 32 GB RAM. - Baseline: `829188e9`; PR: `f79b22c5`. - Same release flags: Series S, internal 1280x720 -> 1920x1080, DLSS Quality preset M, frame generation off, ray tracing off, 1000 FPS cap. - Each run waited for the first world frame with >=500 draws, then a 15 s settle; 60 one-second title samples followed. - Order per pair was baseline -> PR, with three consecutive pairs. Per-run medians: | pair | main frame ms / draws | PR frame ms / draws | PR - main | |---|---:|---:|---:| | 1 | 67.25 / 7,320.5 | 67.25 / 7,021 | 0.00 ms | | 2 | 63.35 / 6,955 | 62.65 / 6,751 | -0.70 ms | | 3 | 63.95 / 6,734 | 65.35 / 6,643 | +1.40 ms | All 180 one-second samples per build: | | main `829188e9` | PR `f79b22c5` | |---|---:|---:| | median FPS | 15 | 15 | | median frame | 64.85 ms | 65.65 ms | | P90 frame | 73.9 ms | 73.4 ms | | P99 frame | 125.0 ms | 89.3 ms | | median draws | 7,066.5 | 6,799.5 | | median ms per 1,000 draws | 9.156 | 9.470 | The three paired deltas straddle zero. The PR has the lower P99 in these runs, but it also sampled scenes with about 3.8% fewer draws; a per-1000-draw normalization is correspondingly worse. I would treat the isolated refresh path in this opening scene as neutral, not as a general frame-time win. The scene was not camera-locked, so draw count and in-game time are the main limitation. There were no crashes or startup failures in the six runs. The earlier synthetic five-pair A/B already showed a similarly neutral result on this machine; this game-level run confirms that the benefit needs a scene/CPU condition that was not present here. *Runs and readings are from the reporter's machine; analysis and wording are AI-assisted.*
Eliminate per-submission `Arc<Shadow>` clones/drops and scratch `Vec`
allocations in `Batch::refresh_front`, and honor `shadow::wide_chunk()`
in `wide_each_scoped` dispatches:

1. Zero-`Arc`, single-pass pre-filtering in `Batch::refresh_front`
   (`refresh_front_spans`):
   - `self.spans` already keeps every `Arc<Shadow>` alive across the
     submission, and `wide_each_scoped` is scoped. Store `(span_idx, from, to)`
     in a reusable `Batch::front_dirty` `Vec` instead of allocating a fresh
     `Vec<(Arc<Shadow>, usize, usize)>` and cloning/dropping `Arc<Shadow>`
     for every span (most of which are immediately filtered out as no-ops).
   - Default path resolves `(key, from, to)`, inserts into `self.ahead` for
     all spans (clean and dirty alike), and filters lock-free via
     `Shadow::nothing_new_with(&self.ahead_snap, ...)` in a single pass.
   - `VICTORY_FRONT_SIFT` (`sift_indexed`, 64-item scoped chunks) and
     `VICTORY_NEW_BATCH` (`nothing_new_all`) also operate on `front_dirty`
     with zero `Arc<Shadow>` clones.
2. Honor `crate::shadow::wide_chunk()` (`VICTORY_WIDE_CHUNK`):
   - `refresh_front_spans` keeps texture `due` items at grain `1` while
     chunking buffer copy spans by `wide_chunk()` in one scoped wave
     (`due.len() + dirty.len().div_ceil(chunk)`).
   - Also wire `wide_chunk()` into `Batch::flush_all` (`!check_noop`) and
     switch `Batch::refresh_ahead` from `wide_each` to zero-alloc
     `wide_each_scoped(..., wide_chunk(), ...)`.
   - Eliminates the `wide_chunk` dead-code warning in `shadow.rs`.
3. Add synthetic unit test `refresh_front_zero_arc_matches_and_runs_due`
   and synthetic benchmark `frame_of_refresh_front` (`#[ignore]`).
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-29 14:40 UTC · original

Thanks @Yuanzer for running the i7-14700KF A/B on f79b22c5!

Pushed a follow-up commit (05052950) to perf/batch-noop-refreshes targeting two remaining overheads directly in Batch::refresh_front (plus Batch::refresh_ahead / Batch::flush_all):

Changes (crates/victory-gpu/src/host.rs)

  1. Zero-Arc-clone, single-pass pre-filtered Batch::refresh_front:
    • Previously refresh_front allocated a fresh Vec<(Arc<Shadow>, usize, usize)>, atomically cloned Arc<Shadow> for every span, inserted into self.ahead, and then dropped the ~83% clean spans in retain(...).
    • Because self.spans already keeps every Arc<Shadow> alive across the submission and wide_each_scoped is scoped, refresh_front_spans now resolves (key, from, to) -> (span_idx, from, to), inserts every span into self.ahead, and filters lock-free via nothing_new_with(&self.ahead_snap, ...) into a reused Batch::front_dirty scratch Vec — zero Arc::clone/Arc::drop and zero per-submission Vec allocations (including for VICTORY_FRONT_SIFT via sift_indexed and VICTORY_NEW_BATCH).
  2. Honor shadow::wide_chunk() (VICTORY_WIDE_CHUNK) instead of hardcoded grain = 1:
    • refresh_front_spans now dispatches texture due items 1-per-claim and buffer copy spans in wide_chunk() chunks within a single wide_each_scoped wave (due.len() + dirty.len().div_ceil(chunk)).
    • Wired wide_chunk() into Batch::flush_all (!check_noop) and moved Batch::refresh_ahead from wide_each to zero-alloc wide_each_scoped(..., wide_chunk(), ...) as well.
    • Eliminates the wide_chunk dead-code warning in shadow.rs.
  3. Synthetic test & microbenchmark:
    • Added host::refresh_tests::refresh_front_zero_arc_matches_and_runs_due (checks self.ahead coverage, unchanged Arc::strong_count, front_dirty capacity reuse, sift_indexed, and empty + non-empty due).
    • Added host::refresh_tests::frame_of_refresh_front (#[ignore], 30 submissions × 200 spans = 6,000 spans/frame, 83% clean no-op / 17% dirty).

Verification (5-run medians in --release)

  • host::refresh_tests::frame_of_refresh_front (6,000 spans/frame, 83% no-op / 17% dirty):
    • Before (f79b22c5): 3.354 ms/frame mean (3.526, 3.329, 3.262, 3.595, 3.354, best 2.799 ms); 100%-no-op pass 0.218 ms/frame
    • After (05052950, default VICTORY_WIDE_CHUNK=1): 3.270 ms/frame mean (3.311, 3.270, 3.249, 3.388, 3.250, best 2.715 ms, -2.5%); 100%-no-op pass 0.187 ms/frame (-14.2%)
    • With VICTORY_WIDE_CHUNK=4: 3.205 ms/frame mean (best 2.630 ms)
  • host::refresh_tests::frame_of_refreshes:
    • Before (f79b22c5): median 13.16 ms/frame (13.16, 13.49, 13.33, 13.05, 13.00)
    • After (05052950): median 13.09 ms/frame (13.09, 12.95, 13.03, 13.33, 13.42, best all-copies 2.87 ms)
  • cargo test --locked -p victory-gpu --lib -- watch:: --test-threads=1: 63 passed, 0 failed
  • cargo test --locked -p victory-gpu --lib -- host::refresh_tests:: --test-threads=1: 7 passed, 0 failed (3 ignored)
  • cargo clippy --locked -p victory-gpu --lib --tests: 0 new warnings (wide_chunk warning eliminated)
  • git diff --check: clean
**@⁠steven-seagull27** on GitHub · 2026-11-29 14:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7257486344) Thanks `@Yuanzer` for running the i7-14700KF A/B on `f79b22c5`! Pushed a follow-up commit (`05052950`) to `perf/batch-noop-refreshes` targeting two remaining overheads directly in `Batch::refresh_front` (plus `Batch::refresh_ahead` / `Batch::flush_all`): ### Changes (`crates/victory-gpu/src/host.rs`) 1. **Zero-`Arc`-clone, single-pass pre-filtered `Batch::refresh_front`**: - Previously `refresh_front` allocated a fresh `Vec<(Arc<Shadow>, usize, usize)>`, atomically cloned `Arc<Shadow>` for every span, inserted into `self.ahead`, and then dropped the ~83% clean spans in `retain(...)`. - Because `self.spans` already keeps every `Arc<Shadow>` alive across the submission and `wide_each_scoped` is scoped, `refresh_front_spans` now resolves `(key, from, to)` -> `(span_idx, from, to)`, inserts every span into `self.ahead`, and filters lock-free via `nothing_new_with(&self.ahead_snap, ...)` into a reused `Batch::front_dirty` scratch `Vec` — zero `Arc::clone`/`Arc::drop` and zero per-submission `Vec` allocations (including for `VICTORY_FRONT_SIFT` via `sift_indexed` and `VICTORY_NEW_BATCH`). 2. **Honor `shadow::wide_chunk()` (`VICTORY_WIDE_CHUNK`) instead of hardcoded `grain = 1`**: - `refresh_front_spans` now dispatches texture `due` items 1-per-claim and buffer copy spans in `wide_chunk()` chunks within a single `wide_each_scoped` wave (`due.len() + dirty.len().div_ceil(chunk)`). - Wired `wide_chunk()` into `Batch::flush_all` (`!check_noop`) and moved `Batch::refresh_ahead` from `wide_each` to zero-alloc `wide_each_scoped(..., wide_chunk(), ...)` as well. - Eliminates the `wide_chunk` dead-code warning in `shadow.rs`. 3. **Synthetic test & microbenchmark**: - Added `host::refresh_tests::refresh_front_zero_arc_matches_and_runs_due` (checks `self.ahead` coverage, unchanged `Arc::strong_count`, `front_dirty` capacity reuse, `sift_indexed`, and empty + non-empty `due`). - Added `host::refresh_tests::frame_of_refresh_front` (`#[ignore]`, 30 submissions × 200 spans = 6,000 spans/frame, 83% clean no-op / 17% dirty). ### Verification (5-run medians in `--release`) - `host::refresh_tests::frame_of_refresh_front` (6,000 spans/frame, 83% no-op / 17% dirty): - Before (`f79b22c5`): **`3.354 ms/frame`** mean (`3.526, 3.329, 3.262, 3.595, 3.354`, best `2.799 ms`); 100%-no-op pass **`0.218 ms/frame`** - After (`05052950`, default `VICTORY_WIDE_CHUNK=1`): **`3.270 ms/frame`** mean (`3.311, 3.270, 3.249, 3.388, 3.250`, best `2.715 ms`, **-2.5%**); 100%-no-op pass **`0.187 ms/frame`** (**-14.2%**) - With `VICTORY_WIDE_CHUNK=4`: **`3.205 ms/frame`** mean (best `2.630 ms`) - `host::refresh_tests::frame_of_refreshes`: - Before (`f79b22c5`): median **`13.16 ms/frame`** (`13.16, 13.49, 13.33, 13.05, 13.00`) - After (`05052950`): median **`13.09 ms/frame`** (`13.09, 12.95, 13.03, 13.33, 13.42`, best all-copies `2.87 ms`) - `cargo test --locked -p victory-gpu --lib -- watch:: --test-threads=1`: **63 passed, 0 failed** - `cargo test --locked -p victory-gpu --lib -- host::refresh_tests:: --test-threads=1`: **7 passed, 0 failed** (3 ignored) - `cargo clippy --locked -p victory-gpu --lib --tests`: **0 new warnings** (`wide_chunk` warning eliminated) - `git diff --check`: clean
Author
Owner

@⁠CopiiDeco on GitHub · 2026-11-29 19:42 UTC · original

Measured a large regression with this PR on Windows.

Rig: Ryzen 5 5600X (6C/12T), RTX 3080 10 GB (driver 616.92), 32 GB DDR4-3600, B450 (PCIe 3.0), Windows 11 26200.
Setup: diagnostics build (--profile diag --features diagnostics), scripts/bench.ps1 -Dlss performance -FrameGen off -RayTracing off, Series S profile, VICTORY_WC_BAR=1 VICTORY_WINDOWS_BAR_MB=2048, the same save and opening cutscene for every run, 30 s warm-up then 120 s measured, pipelines precompiled (0 being made in the window). Each run is main at 829188e9 + this PR merged, nothing else.

median fps ms/frame preparing p99 (1 % low) p99.9
main 18.2 ~55 42.8 ms 131 ms (7.6 fps) 199 ms
this PR 10.9 ~92 40.9 ms 255 ms (3.9 fps) 339 ms

One run each; same-config runs on this rig vary by about ±0.4 fps, so a 40 % drop is far outside the noise. No shader, pipeline or crash differences (0 refused, 0 crashes). Note that the submitting thread's "preparing" time is not worse (40.9 vs 42.8 ms), so the loss seems to be somewhere else in the frame (waits, or another thread).

Happy to rerun with a timeline (VICTORY_TIMELINE) or other switches if that helps narrow it down.

(Side note for anyone benchmarking: scripts/bench.ps1 on current main never detects the world, because its frame-line regex expects dropped N without a host pipeline and the line now reads dropped N draws or dispatches; and the diagnostics build of main does not compile (timing shadowed in host.rs, mb missing in copystat.rs). I patched both locally for these runs.)

**@⁠CopiiDeco** on GitHub · 2026-11-29 19:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7261486627) Measured a large regression with this PR on Windows. **Rig:** Ryzen 5 5600X (6C/12T), RTX 3080 10 GB (driver 616.92), 32 GB DDR4-3600, B450 (PCIe 3.0), Windows 11 26200. **Setup:** diagnostics build (`--profile diag --features diagnostics`), `scripts/bench.ps1 -Dlss performance -FrameGen off -RayTracing off`, Series S profile, `VICTORY_WC_BAR=1 VICTORY_WINDOWS_BAR_MB=2048`, the same save and opening cutscene for every run, 30 s warm-up then 120 s measured, pipelines precompiled (0 being made in the window). Each run is main at 829188e9 + this PR merged, nothing else. | | median fps | ms/frame | preparing | p99 (1 % low) | p99.9 | |---|---|---|---|---|---| | main | 18.2 | ~55 | 42.8 ms | 131 ms (7.6 fps) | 199 ms | | **this PR** | **10.9** | ~92 | 40.9 ms | **255 ms (3.9 fps)** | **339 ms** | One run each; same-config runs on this rig vary by about ±0.4 fps, so a 40 % drop is far outside the noise. No shader, pipeline or crash differences (0 refused, 0 crashes). Note that the submitting thread's "preparing" time is not worse (40.9 vs 42.8 ms), so the loss seems to be somewhere else in the frame (waits, or another thread). Happy to rerun with a timeline (`VICTORY_TIMELINE`) or other switches if that helps narrow it down. (Side note for anyone benchmarking: `scripts/bench.ps1` on current main never detects the world, because its frame-line regex expects `dropped N without a host pipeline` and the line now reads `dropped N draws or dispatches`; and the `diagnostics` build of main does not compile (`timing` shadowed in `host.rs`, `mb` missing in `copystat.rs`). I patched both locally for these runs.)
github-bot force-pushed github-bot/gh-1556 from 05052950f2 to 8bc654b7b2 2026-11-29 20:51:56 +00:00 Compare
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-29 20:48 UTC · original

Thanks @CopiiDeco for the detailed Ryzen 5 5600X / RTX 3080 measurement — that's a very useful data point, and your observation that preparing actually improved (42.8 -> 40.9 ms) while total frame time jumped (~55 -> ~92 ms, +38.7 ms outside preparing) narrows things down a lot.

I audited the full 829188e9..05052950 diff (watch.rs and host.rs) line by line:

  • Every executing change in this PR runs inside preparing (except the equivalent binary search in watch::would_wait), and none of the changes touch GPU shaders, VRAM/descriptor allocation, settle conditions, or non-preparing thread locks.
  • I did find one real tail-latency risk in Batch::flush_all: MANY_CHUNK had been raised from 8 to 64. Unlike the pure-filter SIFT_CHUNK = 64 loops, flush_all's closure performs actual Self::update data copies (including VICTORY_WC_BAR=1 PCIe BAR copies and large take_all copies), so a 64-item grain on a 6-core CPU (wide_threads = 4) can serialize clustered dirty spans onto a single worker and hurt tail latency.

Updated PR (8bc654b7, rebased onto cec481f4)

  1. Restored MANY_CHUNK = 8 in Batch::flush_all (keeping SIFT_CHUNK = 64 for pure-filter sifts) so combined check+copy flushes preserve fine-grained work-stealing across 6-core CPUs.
  2. Rebased cleanly onto origin/main (cec481f4), picking up the post-829188e9 GPU/VRAM fixes (5c262d7b wave64 folding off by default, 1b4b6cd4 idle list trimming / scratch release / fetch buffer shrinking, 4ffb47bb, b214e008, d7c2d8a7, and 1082df39 input replay) — particularly relevant on a 10 GB card with VICTORY_WINDOWS_BAR_MB=2048 where VRAM headroom swings can push non-preparing wait time sharply.

Verification on 8bc654b7

  • cargo test --locked -j 3 -p victory-gpu --lib -- watch:: --test-threads=1 — 63 passed, 0 failed
  • cargo test --locked -j 3 -p victory-gpu --lib -- host::refresh_tests:: --test-threads=1 — 7 passed, 0 failed (3 ignored)
  • git diff --check origin/main..HEAD — clean, 0 new warnings in watch.rs / host.rs

If you're up for re-testing on cec481f4 vs 8bc654b7 (ideally an interleaved A/B/A), sharing the frame breakdown lines (on the GPU, copying back, the card's clock per frame, submissions sent ahead per frame, and video memory / the texture queue's room) would immediately show which bucket outside preparing absorbed the +38.7 ms.

**@⁠steven-seagull27** on GitHub · 2026-11-29 20:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7262367692) Thanks `@CopiiDeco` for the detailed Ryzen 5 5600X / RTX 3080 measurement — that's a very useful data point, and your observation that `preparing` actually improved (`42.8 -> 40.9 ms`) while total frame time jumped (`~55 -> ~92 ms`, `+38.7 ms` outside `preparing`) narrows things down a lot. I audited the full `829188e9..05052950` diff (`watch.rs` and `host.rs`) line by line: - Every executing change in this PR runs inside `preparing` (except the equivalent binary search in `watch::would_wait`), and none of the changes touch GPU shaders, VRAM/descriptor allocation, `settle` conditions, or non-preparing thread locks. - I did find **one real tail-latency risk** in `Batch::flush_all`: `MANY_CHUNK` had been raised from `8` to `64`. Unlike the pure-filter `SIFT_CHUNK = 64` loops, `flush_all`'s closure performs actual `Self::update` data copies (including `VICTORY_WC_BAR=1` PCIe BAR copies and large `take_all` copies), so a 64-item grain on a 6-core CPU (`wide_threads = 4`) can serialize clustered dirty spans onto a single worker and hurt tail latency. ### Updated PR (`8bc654b7`, rebased onto `cec481f4`) 1. **Restored `MANY_CHUNK = 8` in `Batch::flush_all`** (keeping `SIFT_CHUNK = 64` for pure-filter sifts) so combined check+copy flushes preserve fine-grained work-stealing across 6-core CPUs. 2. **Rebased cleanly onto `origin/main` (`cec481f4`)**, picking up the post-`829188e9` GPU/VRAM fixes (`5c262d7b` wave64 folding off by default, `1b4b6cd4` idle list trimming / scratch release / fetch buffer shrinking, `4ffb47bb`, `b214e008`, `d7c2d8a7`, and `1082df39` input replay) — particularly relevant on a 10 GB card with `VICTORY_WINDOWS_BAR_MB=2048` where VRAM headroom swings can push non-preparing wait time sharply. ### Verification on `8bc654b7` - `cargo test --locked -j 3 -p victory-gpu --lib -- watch:: --test-threads=1` — **63 passed, 0 failed** - `cargo test --locked -j 3 -p victory-gpu --lib -- host::refresh_tests:: --test-threads=1` — **7 passed, 0 failed** (3 ignored) - `git diff --check origin/main..HEAD` — clean, 0 new warnings in `watch.rs` / `host.rs` If you're up for re-testing on `cec481f4` vs `8bc654b7` (ideally an interleaved A/B/A), sharing the frame breakdown lines (`on the GPU`, `copying back`, `the card's clock per frame`, `submissions sent ahead per frame`, and `video memory` / `the texture queue's room`) would immediately show which bucket outside `preparing` absorbed the `+38.7 ms`.
github-bot force-pushed github-bot/gh-1556 from 8bc654b7b2 to 25950d3818 2026-11-30 00:23:12 +00:00 Compare
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-30 00:20 UTC · original

Rebased cleanly onto origin/main (41adb551, v2026.11.29.05).

Superseded hunks dropped

  • Dropped crates/victory-gpu/src/watch.rs changes already merged by #2604 (5c604fec): is_kept() fast-path guards in ask_ahead / ask_ahead_done and ahead_contains binary search in would_wait.

Remaining improvements (crates/victory-gpu/src/host.rs)

  • Zero-Arc, single-pass pre-filtered Batch::refresh_front_spans backed by reusable Batch::front_dirty (eliminates per-submission Arc<Shadow> clones/drops and scratch Vec allocation), plus 64-item scoped parallel sifting (sift_indexed / sift_spans) reusing Vec capacity.
  • Wired lock-free Shadow::nothing_new_with(&self.ahead_snap, ...) across refresh_front_spans, refresh_ahead, flush_all, sift_indexed, and sift_spans (avoiding per-span journal locks, redundant snapshots, empty ask_ahead calls, and zero-count FLUSHES[2] atomics).
  • Wired crate::shadow::wide_chunk() across refresh_front_spans, refresh_ahead (migrated from wide_each to wide_each_scoped), and flush_all (!check_noop), while keeping flush_all MANY_CHUNK = 8 for even check+copy work-stealing.
  • Added synthetic unit tests (chunked_nothing_new_with_matches_individual, refresh_front_zero_arc_matches_and_runs_due) and ignored synthetic microbenchmark (frame_of_refresh_front).

Verification

  • cargo test --locked -j 3 -p victory-gpu --lib -- watch:: --test-threads=1: 65 passed, 0 failed.
  • cargo test --locked -j 3 -p victory-gpu --lib -- host::refresh_tests:: --test-threads=1: 7 passed, 0 failed (3 ignored).
  • cargo check --locked -j 3 -p victory-gpu --lib --features diagnostics: passed.
  • cargo clippy --locked -j 3 -p victory-gpu --lib --tests: 0 new warnings in touched files (and clears 5 pre-existing unused/dead-code warnings on ahead_snap, MANY_CHUNK, wide_chunk, and nothing_new_with).
  • git diff --check origin/main..HEAD: clean.
**@⁠steven-seagull27** on GitHub · 2026-11-30 00:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7265181025) Rebased cleanly onto `origin/main` (`41adb551`, `v2026.11.29.05`). ### Superseded hunks dropped - Dropped `crates/victory-gpu/src/watch.rs` changes already merged by `#2604` (`5c604fec`): `is_kept()` fast-path guards in `ask_ahead` / `ask_ahead_done` and `ahead_contains` binary search in `would_wait`. ### Remaining improvements (`crates/victory-gpu/src/host.rs`) - Zero-`Arc`, single-pass pre-filtered `Batch::refresh_front_spans` backed by reusable `Batch::front_dirty` (eliminates per-submission `Arc<Shadow>` clones/drops and scratch `Vec` allocation), plus 64-item scoped parallel sifting (`sift_indexed` / `sift_spans`) reusing `Vec` capacity. - Wired lock-free `Shadow::nothing_new_with(&self.ahead_snap, ...)` across `refresh_front_spans`, `refresh_ahead`, `flush_all`, `sift_indexed`, and `sift_spans` (avoiding per-span journal locks, redundant snapshots, empty `ask_ahead` calls, and zero-count `FLUSHES[2]` atomics). - Wired `crate::shadow::wide_chunk()` across `refresh_front_spans`, `refresh_ahead` (migrated from `wide_each` to `wide_each_scoped`), and `flush_all` (`!check_noop`), while keeping `flush_all` `MANY_CHUNK = 8` for even check+copy work-stealing. - Added synthetic unit tests (`chunked_nothing_new_with_matches_individual`, `refresh_front_zero_arc_matches_and_runs_due`) and ignored synthetic microbenchmark (`frame_of_refresh_front`). ### Verification - `cargo test --locked -j 3 -p victory-gpu --lib -- watch:: --test-threads=1`: 65 passed, 0 failed. - `cargo test --locked -j 3 -p victory-gpu --lib -- host::refresh_tests:: --test-threads=1`: 7 passed, 0 failed (3 ignored). - `cargo check --locked -j 3 -p victory-gpu --lib --features diagnostics`: passed. - `cargo clippy --locked -j 3 -p victory-gpu --lib --tests`: 0 new warnings in touched files (and clears 5 pre-existing unused/dead-code warnings on `ahead_snap`, `MANY_CHUNK`, `wide_chunk`, and `nothing_new_with`). - `git diff --check origin/main..HEAD`: clean.
github-bot changed title from perf(gpu): batch no-op refreshes, lock-free ask_once fast path, and binary-search Journal::ahead to perf(gpu): zero-Arc pre-filtered refresh_front, lock-free ahead_snap checks, and wide_chunk wiring 2026-11-30 11:56:54 +00:00
github-bot changed title from perf(gpu): zero-Arc pre-filtered refresh_front, lock-free ahead_snap checks, and wide_chunk wiring to perf(gpu): restore MANY_CHUNK = 8 in Batch::flush_all for 6-core work-stealing 2026-11-30 18:40:05 +00:00
github-bot force-pushed github-bot/gh-1556 from 25950d3818 to 4a33459221 2026-11-30 18:40:06 +00:00 Compare
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-30 18:35 UTC · original

Since 05052950 already landed on main via 90159db7, this PR has been narrowed and rebased cleanly onto latest main (e1251c31 -> 4a334592) with just the MANY_CHUNK = 8 follow-up in Batch::flush_all (crates/victory-gpu/src/host.rs, +7/-5).

Lowering MANY_CHUNK from 64 back to 8 (while keeping pure-filter SIFT_CHUNK = 64) avoids serializing clustered dirty spans onto a single worker on 6-core hosts (wide_threads = 4, reported by @CopiiDeco on Ryzen 5 5600X) — and is now on the default submission path whenever write-watch is kept since #3762 (30911195) fused refresh sifting into flush_all's check_noop loop.

Verification

  • cargo test -p victory-gpu --lib -- refresh_front & chunked_nothing_new_with_matches_individual — passed.
  • cargo clippy -p victory-gpu --lib — 0 warnings in host.rs.
  • cargo run -p xtask -- policy --staged & git diff --check origin/main..HEAD — clean.
**@⁠steven-seagull27** on GitHub · 2026-11-30 18:35 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1556#issuecomment-7288078647) Since `05052950` already landed on `main` via `90159db7`, this PR has been narrowed and rebased cleanly onto latest `main` (`e1251c31` -> `4a334592`) with just the `MANY_CHUNK = 8` follow-up in `Batch::flush_all` (`crates/victory-gpu/src/host.rs`, `+7/-5`). Lowering `MANY_CHUNK` from `64` back to `8` (while keeping pure-filter `SIFT_CHUNK = 64`) avoids serializing clustered dirty spans onto a single worker on 6-core hosts (`wide_threads = 4`, reported by `@CopiiDeco` on Ryzen 5 5600X) — and is now on the default submission path whenever write-watch is kept since `#3762` (`30911195`) fused refresh sifting into `flush_all`'s `check_noop` loop. ### Verification - `cargo test -p victory-gpu --lib -- refresh_front` & `chunked_nothing_new_with_matches_individual` — passed. - `cargo clippy -p victory-gpu --lib` — 0 warnings in `host.rs`. - `cargo run -p xtask -- policy --staged` & `git diff --check origin/main..HEAD` — clean.
github-bot force-pushed github-bot/gh-1556 from 4a33459221 to e4ab39fddf 2026-12-01 01:08:57 +00:00 Compare
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.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/1556/head:github-bot/gh-1556'
git switch 'github-bot/gh-1556'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1556'
git switch 'github-bot/gh-1556'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1556'
git switch 'github-bot/gh-1556'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1556'
git switch 'main'
git merge --squash 'github-bot/gh-1556'
git switch 'main'
git merge --ff-only 'github-bot/gh-1556'
git switch 'main'
git merge 'github-bot/gh-1556'
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!1556
No description provided.