perf(gpu): single-pass ask_once, sorted ahead lookup, ask_once_active skip, and merged Shadow copied/ranged lock #1676
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1676
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1676"
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?
@qlfu on GitHub · 2026-11-28 23:21 UTC · original
qlfu:pr/watch-and-refresh-perf→main· +280 −99 · 3 files · 1 commits · closed without mergingWhat it changes
Removes redundant submitting-thread write-watch work and lock/atomic contention across
watch,shadow, andhostrefresh flushes:crates/victory-gpu/src/watch.rs:ASK_ONCE_ACTIVE(AtomicBoolmirror ofJournal::kept) and exposesask_once_active()soask_ahead()/ask_ahead_done()andBatch::refresh_front/Batch::flush_allskip building, filtering (published), sorting, and discarding thousands of ranges on every flush whileask_onceis already active.ask_onceinto a single pass overranges(onepublished()filter, one sort, oneAskings::hold_or_all, onejournal_mut()lock) instead of runningask_aheadfollowed by a second full scan andahead.clone()inask_rest.Journal::aheadsorted and merged into disjoint intervals and replaces linearj.ahead.iter().any(...)scans innothing_new,writes,asked,ask_more, andask_restwith O(log N)ahead_contains(partition_point).copiedpage bounds / zero-marks innothing_newbefore takingJOURNAL.read().ahead_containsparity andask_onceactive-flag / sorted-aheadinvariants.crates/victory-gpu/src/shadow.rs:Shadow::rangedintoCopiedPagesunderShadow::copied(all callers already heldcopied's lock), removing a second mutex per buffer check/update.Shadow::update'sself.pending.lock()andVecallocation behind the existing lock-freeself.has_pending.load(Acquire)check.watch::parts_written(&again_at)(and itsJOURNAL.read()) inShadow::copy_stalewhenagain_atis empty.wide_each_chunksso parallel flush workers receive(from, to)ranges directly.crates/victory-gpu/src/host.rs:ranges: Vec<(usize, usize)>beforewatch::ask_aheadinBatch::refresh_frontandBatch::flush_allwhenwatch::ask_once_active()is true.wide_each_chunksinBatch::refresh_frontandBatch::flush_allto flushFLUSHES[2](nothing_newcount) once per worker chunk instead of per buffer.How it was tested
game_scarlett_master.exe), 1440p DLSS Balanced,-NoFrameGenReady,VICTORY_PORT_CONSTANTS=1,VICTORY_WAIT_RESIDENT=textures, clean 90s gameplay runs (0 WARNs / 0 ERRORs).stack8v2without this PR):22.00/ mean23.15(p10 18.0, max31.2),frame_timesmed43.7 ms/ mean43.5 ms,>50 ms: 24.9%sub_all: median36.25 ms/ mean37.35 ms(watch 5.00 ms,refreshes 10.75 ms,ASYNC_SUBMIT worked 39.4 ms)stack9with this PR):22.80/ mean23.64(p10 19.2, max32.2),frame_timesmed42.7 ms/ mean42.7 ms,>50 ms: 24.0%sub_all: median35.30 ms/ mean36.12 ms(-1.23 ms mean;watch 4.65 ms-7%,refreshes 10.55 ms,ASYNC_SUBMIT worked 37.05 ms-2.35 ms)cargo clippy -p victory-gpu --lib --tests --locked(default &--all-features): 0 new warnings.cargo testpassed for the crates it touches: yes (551 passed; 0 failedincargo test -p victory-gpu --lib --locked -- --test-threads=1).Checked for overlap
Journal::ahead; this PR additionally adds theask_once_active()skip inwatch/host, single-passask_once,Shadow::updatehas_pendingguard,Shadow::rangedmerged intoShadow::copied, and chunk-batchedFLUSHES[2]updates).@qlfu on GitHub · 2026-11-29 10:14 UTC · original
Closing in favor of the focused lock-free refresh rewiring PR on \main\ (\
829188e9), since \head_contains, lock-free \Shadow::copied/anged_lockfree, and \watch::is_kept\ have already landed on \main.
Pull request closed