perf(gpu): FastTls, lock-free keep_ref, O(1) SAME_ENTRIES, MISS_GAPS cache, and 8MiB list stack #4838
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!4838
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4837"
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?
@Pototoooo on GitHub · 2026-12-01 10:46 UTC · original
Pototoooo:perf/low-frame-optimizations→main· +634 −167 · 20 files · 3 commits · closed without mergingSummary
This PR bundles five rounds of CPU/low-frame optimizations and community-requested fixes targeting
1% low/0.1% lowframe times and list-translation overhead on Windows (x86_64-pc-windows-gnu):1. Native Win32
FastTls(crates/victory-gpu/src/fast_tls.rs)x86_64-pc-windows-gnu,std::thread_local!emits aSeqCstmfence+guard::windows::enable()on every access, accounting for ~29% ofvictory-list-*worker CPU time in profiles.TlsAlloc/TlsGetValue/TlsSetValuewrapper (FastTls<T>) withFlsAllocthread-exit destructor cleanup and migrated the hot thread-locals acrossdraw.rs,shadow.rs,descriptor/host.rs,descriptor.rs,residency.rs,facewatch.rs,list.rs,host.rs,host/send.rs,heap_marks.rs, andqueue/behind.rs.atomic::fence+guard::windows::enablesamples invictory-list-*by 85–86%.2. Descriptor & Draw Hot-Path Optimizations
HostHeap::kept_rawmirror (descriptor/host.rs): eliminates mutex contention onkeep,keep_ref,take_kept, andslots_showing.SAME_ENTRIEScache (draw.rs): replaces linearVecscan with a 512-slot epoch-tagged direct-mapped cache.sampled::HotLookupsnapshot +VICTORY_DUE_INDEXon by default (sampled.rs,descriptor/host.rs): hoistsOnceLock+Acquireloads out ofDue::orderedandcollect_due_and_census.draw.rs): removes thedue_index()gate onPASS_FRAME_NANOS >= max_capand adds a byte-budget early-out.3. Buffer Lookup
MISS_GAPSCache & No-Bump First Touch (related to #4818)FastTlsMISS_GAPSinterval cache inshadow::lookup_buffer, validated byBUFFERS_CHANGED, computing sound buffer-free[gap_lo, gap_hi)intervals viafind_miss_gap.buffers_no_bump()forNone -> Some(shadow)first-touch population inlookup_bufferso populating a shadow copy does not invalidateFOUNDorMISS_GAPSacross all worker threads.4. Community Fixes & Launcher Defaults
list/thin.rs): set.stack_size(8 * 1024 * 1024)onvictory-list-*worker threads to prevent 2 MiB default stack overflows.shadow.rs): added optionalVICTORY_SEND_GAP(default0= off) to coalesce nearby changed runs inShadow::take.apps/victory/src/play.rs): enabledVICTORY_SEND_BESIDE=1,VICTORY_LATE_WAIT_LISTS=384,VICTORY_DUE_INDEX=1, and the four #4816 switches (VICTORY_CARD_STEPS_LEARN=1,VICTORY_LATE_FILLS=1,VICTORY_SEND_FREE_FIRST=1,VICTORY_SWEEP_AHEAD=1).scripts/bench.ps1): updated frame-line regex to match bothwithout a host pipelineanddraws or dispatches.Benchmark Results
Controlled stationary A/B runs (
scripts/bench.ps1,-Warmup 30 -Seconds 45 -CaptureEvery 0, same checkpoint, ~9,500 draws/frame, RTX 5070 12 GB + Ryzen 5 9600X, thin-LTOdiagbuild):5fabb46e)bd0b5a96)d5230f51)Testing
cargo test -p victory-gpu --lib -- wave5_tests max_size_tracks fast_tls::tests sampled::tests due_buckets keep_ref_skips_clone: 16 passed, 0 failed.cargo build --release -p victory(linked withlld) verified and smoke-tested live.d4728864fato06dbed219f06dbed219fto81d7cc3d96@trustno1-coder on GitHub · 2026-12-01 18:30 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed