perf(gpu): batch no-op buffer refresh checks and reduce lock contention #318
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/318"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wike1701 on 2026-11-27T20:58:22Z.
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
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.
anged mutex locks on read-only / non-ranged buffers in
othing_new_with, writes_pending, writes_pending_in, and
anged.
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
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-11-28T03:06:54Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
66dfa778b9145a5eb86650e5c7fd7862f4c54882, base (single-commit parent)0cef07e9d766df48f0e95f13ce3bbbe2290fe9d3.cargo test --locked -p victory-gpu --lib -- shadow::land_tests::wide_chunks_visits_every_index_once --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 456 filtered, exit 0.cargo test --locked -p victory-gpu --lib -- shadow::land_tests::journal_read_matches_watch_nothing_new --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 456 filtered, exit 0.git grep -Ffor both test names on the base returned no hits (tests are new on this PR);git diff --check 0cef07e9 HEADclean (3 files, +168/-28).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.