perf(gpu): batch nothing_new refresh checks under one JournalRead lock and single-lock watch::writes #1373
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1373"
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 qlfu on 2026-11-28T18:17:38Z.
Summary
Reduces global
JOURNALRwLockcontention and atomic counter cache-line bouncing during per-submission buffer refresh checks (Batch::refresh_front,Batch::refresh_ahead,Batch::flush_all), where ~82–84% (~5,100 of ~6,100 copies/frame) are skipped vianothing_new:nothing_newfiltering (watch.rs,shadow.rs,host.rs):watch::JournalRead+JournalRead::nothing_new_min()with a single-pageBTreeMap::getfast path (avoidingrange()iterator setup for single-page ranges).Shadow::nothing_new_snap()andshadow::filter_nothing_new_chunk()(stack-allocated[CopySnap; 32], zero heap allocations): snapshots each shadow'scopied/rangedlower bound first and releases allShadowlocks before acquiring a single sharedJOURNAL.read()lock for up to 32 spans (eliminating anyJOURNAL <-> Shadow::copiedlock-order inversion), falling back to exactShadow::nothing_newonly for rare multi-page non-uniform spans that fail the conservative check.retain_changed()for small flushes (<= 256) and 32-span chunking insidewide_eachfor large flushes (> 256), cuttingJOURNAL.read()acquisitions andFLUSHES[2]atomic RMWs by ~32x across worker threads.JOURNAL.read()fast path inwatch::writes():aheadlookup andguarded && published(start, end)check under a singlejournal()read guard instead of lockingJOURNALtwice on guarded view-memory refreshes.Verification
cargo +1.98.1-x86_64-pc-windows-msvc test -p victory-gpu --lib --locked -- --test-threads=1 --quiet: 455 passed, 0 failed, 36 ignored (including new testwatch::journal_read_tests::nothing_new_min_matches_single_and_multi_page_writes).cargo +1.98.1-x86_64-pc-windows-msvc clippy -p victory-gpu --lib --tests --locked(default and--all-features): 0 warnings in modified lines.cargo +1.98.1-x86_64-pc-windows-msvc build --release --locked -p victory: exit0.Clean Idle-PC A/B Benchmark (Ryzen 7 5700X + RTX 4070 Ti 12 GB, 1440p Series X, DLSS Quality,
-FrameGen, 90s steady gameplay)main(9ce3cf9,BASE_9ce3cf9_fg_clean)PR8_journal_fg_clean)sub_all) mean / max52.45 / 75.10 ms50.16 / 67.50 msin the lists' stepsmedian / mean19.50 / 20.13 ms18.80 / 19.50 msrefreshesper 1k copies median / mean2.05 / 2.11 ms1.98 / 2.06 ms18.54(13.3/25.8)19.17(14.0/30.6)14.3/25.314.6/26.7copy-back71.0%/16.7 ms73.0%/14.85 ms0 / 00 / 0Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by qlfu on 2026-11-28T20:39:07Z.
Closing after bisecting on current main: batching \ilter_nothing_new_chunk\ inside parallel \wide_each_from\ refreshes serializes adjacent dirty \Self::update\ spans and regresses
efreshes\ vs 1-by-1 work stealing, and \
3055afd\ already removed the global \hold_all\ contention in \watch.rs.Pull request closed