Repository navigation
GPU: walk only dirty gaps when refreshing guarded views - #181
Conversation
Repeated checks of clean view heaps collect one entry per 64 KiB block while holding the guard mutex. If most blocks are clean, that allocates and scans thousands of entries to find just a few dirty gaps. Track the same clean blocks as contiguous half-open runs. The fully clean path needs a single lookup and the mixed path visits only dirty gaps. Keep the existing mapping queries, alias protection, and dirty notifications. Compare the interval operations with the old per-block representation and retain the existing guard and mapping tests. Based-on: fxceless/victory-fork#824 Tested-on: RX 6800, Fedora Linux 45, Wine (14 guard and mapping tests) Assisted-by: gpt-6.2 sol xhigh (cherry picked from commit ac6e475108f0e82ed6efb657e4f0b7552c0275f7)
|
No actionable comments were generated in the recent review. Walkthrough
Change: Refactor Merge Risk:
|
What
Repeated checks of clean view heaps in
crates/victory-gpu/src/watch.rscollect one entry per 64 KiB block while holding the guard mutex, then scan that vector to find the few dirty gaps. This keeps the same clean blocks as contiguous half-open runs (CleanBlocks: aBTreeMapoffrom..to), so the fully clean range is one lookup and the mixed range visits only its dirty gaps. Mapping queries, alias protection and dirty notifications are unchanged.CleanBlocks::insert/remove/uncoveredwith the interval arithmetic the guard loop needs.guards().cleanbecomesCleanBlocks;protect,open,title_memory_remappedand the write-watch path call the run operations.watch::tests::clean_runs_match_per_block_tracking: every intervalfrom..toover 36 blocks, for a sequence of inserts and removes, equals the old per-blockBTreeSetreference.Credit
fxceless/victory-fork PR #979 by gmanka, GPL-3.0. Cherry-picked with
-x, author kept. Conflicts: this tree keeps its ownmappedblock set (the fork'saliased/viewedsets are not here), so the clean set alone was rebased onto it. CREDITS.md line added.Gates
cargo xwin clippy --target x86_64-pc-windows-msvc --workspace --all-targets -- -D warnings: clean.VICTORY_TEST_ADAPTER=hw, nativedxgi):197 passed; 0 failed; 2 ignored(both ignored are pre-existing:clean_copies_benchand the handle-opened section test).clean_runs_match_per_block_trackingok.cargo xtask policy: 244 files ok;git grep -iE "gta ?(vi|6)|grand theft|rockstar"empty.Off switch
None: same set of blocks, same notification order and same results, only fewer entries allocated and scanned. No env switch, no new behaviour to turn off.
Not tested in a game run.
Summary by CodeRabbit