perf(gpu): optimize land dirty-page scan, job/note batching, and texback readback throughput #15
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/MahanYTT--VIctory-MA!15
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-15"
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?
@MahanYTT on GitHub · 2026-12-04 18:51 UTC · original
MahanYTT:perf/land-relay-readback→mega-upgrade-v3· +931 −113 · 3 files · 1 commits · merged 2026-12-04 20:18 UTCSummary
Optimizes relay landing piece merging, dirty-page scanning, readback/list cleanup, and texture readback throughput based on
victory-ma-play-20261204-165800-18832.log(227 pieces (207 dirty), 1,549 pages -> 731 dirty,read-backs and lists 0.78 ms,merging 0.57 ms / 1.07 ms all threads).crates/victory-gpu/src/land.rsfirst_diff_offset,diff_bounds): Skipssafecopy::mergeentirely on clean 4 KiB pages (~53% of landed pages) and trims clean 32-byte prefixes and suffixes on dirty 32-byte-aligned pages before merging. Replaces[bool; 17]with au32bitmask on the direct path and avoids callingwatch::changes()on the beside path.PieceStats& O(N log N)Notes::flush/ pre-sizedNotes::flush_all: Accumulates per-pieceSTATS/PUTcounters locally insideNotesand flushes once per landing instead of ~2,200 cross-core atomic RMWs/frame. Replaces quadraticO(B * L)self.landedscanning with in-placecollapse_landed+ binary search, and pre-allocatesflush_allbuffers.jobs()scaling & in-placeordered(): Scales job chunk targets down toBLOCK(64 KiB) for mid-size landings (~516 KiB/landing) so all worker threads stay utilized instead of only 2 jobs leaving threads idle. Useschunk_by_mut+ in-placesort_unstable_by_keyinordered()to eliminate per-blockto_vec()heap allocations.Pool::running_nowspin & allocation-freeHad: PollsAtomicUsizeinspin_forinstead of contending onstate.try_lock(). Replaces per-fetchHashMapinHadwith recycled sortedVecs + binary search.crates/victory-gpu/src/texback.rsVICTORY_TEXBACK_FULL_OVERWRITE+ zero-scratch linear fast path: Skips redundant full-texture reads of old title bytes on addressable single-subresource full overwrites (retaining per-pagesafecopyhole probing;=0opts out), and copies tightly packedSwizzle::LINEARfull overwrites straight from the mapped readback buffer.ReadBackPoolwith oldest-first cap eviction: Replaces linearrposition+removewith 28 power-of-two buckets for O(1) LIFO reuse; evicts oldest idle buffers on cap pressure rather than destroying newly-active buffers; skips pool locking whenmost == 0.VICTORY_TEXBACK_SAMEdiff & immediateTICKETSpruning: Reuses thread-localTILED_PREVscratch with AVX2diff_bytes_range, prunes invalidated tickets immediately, and resetsTRACKINGwhen empty.Verification
cargo clippy -p victory-gpu --target x86_64-pc-windows-gnu -- -D warnings: pass (0 warnings)cargo clippy -p victory-gpu --tests --target x86_64-pc-windows-gnu -- -D warnings: pass (0 warnings)rustc --edition=2024 --test -O): 6/6 passed (AVX2 detected: true).