perf(gpu): batch no-op buffer refresh checks and reduce lock contention #318

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

@⁠wike1701 on GitHub · 2026-11-27 20:58 UTC · original
wike1701:perf/batched-noop-refreshes → main · +168 −28 · 3 files · 1 commits · open

Summary

Reduces CPU overhead in the open-world buffer refresh hot path (Batch::refresh_front and Batch::flush_all), where real open-world captures spend ~28–32 ms/frame checking ~10,000 buffer refreshes of which ~85–90% are unchanged no-ops.

Changes

  • watch::JournalRead +
    ead_journal()
    (crates/victory-gpu/src/watch.rs): allows holding one JOURNAL read guard across a chunk of
    othing_new checks instead of acquiring/releasing the global RwLock ~10,000 times per frame.
  • Shadow::pending_any / Shadow::ranged_any atomic fast paths + Shadow::nothing_new_with (crates/victory-gpu/src/shadow.rs): skips pending and
    anged mutex locks on read-only / non-ranged buffers in
    othing_new_with, writes_pending, writes_pending_in, and
    anged.
  • shadow::wide_chunks (crates/victory-gpu/src/shadow.rs + crates/victory-gpu/src/host.rs): processes
    efresh_front and lush_all in 32-item chunks per worker claim (1 atomic increment + 1 JournalRead + 1 FLUSHES[2] atomic increment per chunk instead of per item). JournalRead is always dropped before calling Self::update, preventing any RwLock upgrade deadlock.

Verification

  • cargo test -p victory-gpu --lib -- shadow:: watch:: host:: — 193 passed, 0 failed, 17 ignored (including new tests wide_chunks_visits_every_index_once and journal_read_matches_watch_nothing_new)
  • cargo check -p victory-gpu --features diagnostics — ok (0 new warnings)
  • cargo xtask policy — 287 files ok
**@⁠wike1701** on GitHub · 2026-11-27 20:58 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/318) `wike1701:perf/batched-noop-refreshes` → `main` · +168 −28 · 3 files · 1 commits · open ## Summary Reduces CPU overhead in the open-world buffer refresh hot path (Batch::refresh_front and Batch::flush_all), where real open-world captures spend ~28–32 ms/frame checking ~10,000 buffer refreshes of which ~85–90% are unchanged no-ops. ### Changes - **watch::JournalRead + ead_journal()** (crates/victory-gpu/src/watch.rs): allows holding one JOURNAL read guard across a chunk of othing_new checks instead of acquiring/releasing the global RwLock ~10,000 times per frame. - **Shadow::pending_any / Shadow::ranged_any atomic fast paths + Shadow::nothing_new_with** (crates/victory-gpu/src/shadow.rs): skips pending and anged mutex locks on read-only / non-ranged buffers in othing_new_with, writes_pending, writes_pending_in, and anged. - **shadow::wide_chunks** (crates/victory-gpu/src/shadow.rs + crates/victory-gpu/src/host.rs): processes efresh_front and lush_all in 32-item chunks per worker claim (1 atomic increment + 1 JournalRead + 1 FLUSHES[2] atomic increment per chunk instead of per item). JournalRead is always dropped before calling Self::update, preventing any RwLock upgrade deadlock. ## Verification - cargo test -p victory-gpu --lib -- shadow:: watch:: host:: — **193 passed, 0 failed, 17 ignored** (including new tests wide_chunks_visits_every_index_once and journal_read_matches_watch_nothing_new) - cargo check -p victory-gpu --features diagnostics — **ok** (0 new warnings) - cargo xtask policy — **287 files ok**
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:01:17 +00:00
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/318/head:github-bot/gh-318'
git switch 'github-bot/gh-318'

Merge

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