Repository navigation
Reduce CPU lock contention across shadow merges, refreshes, and card sync - #1561
Conversation
…tant_slot updates
175c954 to
c2ed656
Compare
Held in the fork until upstream takes them; each switch keeps the old behaviour by default: - trustno1-coder#1937 the placed-texture span lock is skipped by default (VICTORY_SPANS_QUICK on), VICTORY_QUEUE_BATCH_MAX; - trustno1-coder#1556 no-op refreshes batched, the lock-free ask_once fast path, a binary search in Journal::ahead; - trustno1-coder#1561 less CPU lock contention in shadow merges, refreshes and card sync; - trustno1-coder#2049 the sparse copy_stale fast path, the Batch/card_steps hot caches, the RT reserve's settle-decay, the depth plan; - trustno1-coder#1971 the launcher's shader warm and preload runs apply what play applies; - trustno1-coder#1911 Series S keeps 1,536 MB for render targets, not 3,072; - trustno1-coder#1985 the XMA decoder thread runs at the helpers' priority (VICTORY_XMA_PRIORITY=-2..2); - trustno1-coder#1912 flights in the air are settled before a bake reads title memory (VICTORY_BAKE_SETTLE); - trustno1-coder#1274 room for a full-size 3840x2160 scene (VICTORY_NATIVE_4K, VICTORY_RT_HEAP_MB, VICTORY_SCENE_POOL).
|
We ran a test of this PR on current main (it still merges cleanly), on a CPU-bound machine (about 66 ms of CPU preparation per frame).
The difference is on the good side but inside the noise (the controls alone spread over 9 ms). Picture: in round 1, one frame had the palms and the potted plants by the house missing. The game was at 8 fps at that moment, so that frame was on screen for about 140 ms. We saw none in the 320 control frames of this session nor in 800 earlier ones on this base, and we saw the same one-frame vegetation gap with #3502, #3476 and #3411. It may be a timing-sensitive problem in main rather than this PR alone. Setup:
Picture check: a burst of 10 captures a second at the end of each run (80 frames), looked at frame by frame. AI Assisted |
…w merges, refreshes, and card sync
Rebased replacement for #1157 onto
main(923e38c), cleanly composed with upstream #1400 (UnderSlots+ batchedcard.dirty) andVICTORY_FAULT_UNLOCKED(dropping already-merged hunks).Summary of Changes
Shadow::merging([RwLock<()>; 64], lazily allocated): replaces the single per-ShadowRwLock<()>so concurrentland_card_piecesandmerge_under_writeson disjoint 64 KiB pages do not serialize each other; acquires only the touched stripe mask in ascending order and skipsself.before.lock()on card-backed copies.CopyState(RwLock<CopyState>): replaces separatecopied+rangedmutexes for concurrent lock-free reader sharing innothing_new_with.JournalRead+Shadow::nothing_new_with: acquiresJOURNALread lock once per refresh/span batch instead of per copy, with binary-searchedahead_contains.descriptor::constant_slots_batch+HostHeap::constant_at_with_base: resolvesSHADER_HEAPSonce and reuses cachedbuffer_gpuacrosscard_stepsconstant slots.Batchfast paths:Batch::note_gpu_writededuplicates repeated GPU writes and accumulatesdeclareddirectly (avoidingdeclared_writes(runs)rescan); 1-entrylast_aheadcache;Blocks::all_setword-level bitmap check inwatch::guard;CARD_WORKlocked aftersend::take.Verification & Re-Measurement on
main(923e38c)shadow+ 51/51watchtests pass; 0 new warnings.diagbuild, warm cache, 1440p DLSS Performance, FG off, 115 s scripted run):main(923e38c, ~7,650 draws)175c954, ~8,000–8,690 draws)lists' stepsTOTAL (copies & fills)planning card_stepsasking write watch