Batch relay dynamic/shared table releases, reuse RelayScratch, and fast-path Flights::done #2881
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!2881
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2881"
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?
@steven-seagull27 on GitHub · 2026-11-29 18:29 UTC · original
steven-seagull27:perf/relay-land-batch-release-and-scratch→main· +794 −106 · 4 files · 1 commits · openSummary
Eliminates redundant lock acquisitions, per-entry HashMap double-lookups, and per-landing heap allocations on the relay landing thread's
COPY_BACK[0]andstat::READ_BACKShot paths:draw.rs,list.rs,host.rs):draw::State::release_dynamic_slotsanddraw::State::resetto calldescriptor::release_dynamic_batchinstead of loopingdescriptor::release_dynamicper range.State::take_landed_slots/Detached::take_landed_slotsand drained all detached lists across all landed flights inHost::relay_landinto a reusable scratchVecbefore invokingdescriptor::release_dynamic_batchonce per landing.SharedTables::let_go,SharedTables::unpark, andSharedTables::give_back(draw.rs,list.rs,host.rs):SharedTables::dropped_batch,SharedTables::let_go_batch_into,SharedTables::let_go_batch, anddraw::release_tables_batchto acquireSHARED_TABLESonce per batch, drop that lock before touching descriptor heaps (preserving exact lock ordering), and issue a singledescriptor::release_dynamic_batchcall with exactretire_resourcessemantics.SharedTables::unparkto callHostHeap::release_batchandSharedTables::give_backto calldescriptor::release_dynamic_batch.SharedTables::droppedandSharedTables::unparkedfrom separateget/get_mut+removepairs toHashMap::entry, halving HashMap lookups on removals.State::drop,State::reset,State::tables_done,Host::relay_land(READ_BACKS), andHost::settleto batch shared and remaining dynamic table releases across each flight's detached lists.Host::relay_card_backandHost::relay_land(host.rs):RelayScratchonRelayFetchreusingseen,fetched,pieces,ordered_pieces,keys,titles,dynamic_slots, andshared_tables.relay_card_back_with_scratchwith an RAII drop guard so allArc<Shadow>references are cleared immediately on every exit path (normal return, early return, or unwind) and capacities aboveRELAY_SCRATCH_MAX_CAP(4096) are trimmed back down so outlier spikes never pin unbounded memory.shadow::Flights::done(shadow.rs):FreedRanges(None/One/ inlineSmallup to 4 ranges / sortedMany) andFlights::done_ranges(using single-lookupHashMap::entry), skipping heap allocation and sorting for 0-, 1-, and small-range landings while keeping exact sortedbinary_searchsemantics for larger sets inShadow::copy_back_done.Synthetic
--releaseMicrobenchmark (Before55d06914vs After, 3-run median)Measured with
cargo test --release --locked -j 2 -p victory-gpu --libusing synthetic workloads withstd::hint::black_box:55d06914)SharedTablesrelease (let_go→release_tables_batch)SharedTables::unparkrelay_card_backscratch collections (RelayScratch)Flights::done(0freed, held by another flight)Flights::done(1freed, common case)Flights::done(3freed, inline small buffer)Flights::done(16freed,Many+Entry)Verification
draw::tests::shared_tables_dropped_batch_matches_single_drop_semanticsdraw::tests::batched_dynamic_and_shared_release_reclaims_all_host_heap_slotsshadow::relay_tests::flights_done_ranges_matches_reference_across_zero_one_small_and_manyhost::batch::relay_scratch_reuses_buffers_caps_outliers_and_drops_shadowscargo test --locked -j 2 -p victory-gpu --lib -- draw:: --test-threads=1— 27 passed, 0 failed (2 ignored)cargo test --locked -j 2 -p victory-gpu --lib -- shadow:: --test-threads=1— 72 passed, 0 failed (5 ignored)cargo test --locked -j 2 -p victory-gpu --lib -- host:: --test-threads=1— 213 passed, 0 failed (23 ignored)cargo clippy --locked -j 2 -p victory-gpu --lib --tests— 0 new warnings in touched filesgit diff --check— clean@Yuanzer on GitHub · 2026-11-29 19:43 UTC · original
In-game fixed-clock A/B on the reporter's Windows 11 machine (AI-assisted local runs):
55d06914and fresh PR head65e11b31, each built in a separate clean worktree with the same toolchain and release profile.Aggregate: the PR reduced submit-thread work from about 37.0 to 36.2 ms, list steps from 21.0 to 20.6 ms, and relay landing from 13.8 to 13.0 ms. The frame median was 54.2 ms on base versus 54.8 ms on PR, and median FPS was unchanged within this scene. Draw counts were similar (5,272-5,408); there were no OOMs or device removals in any run.
This validates the targeted code paths and matches the direction of the synthetic result, but not the synthetic magnitude. At this ~5.3k-draw scene the reduced CPU work is under the run-to-run frame noise. I would report it as a low-risk CPU-overhead reduction rather than a gameplay FPS gain until it is measured on a scene with more landings or slower release work.
One process note: GitHub currently shows this PR as CONFLICTING, although its head is one commit above
55d06914and built cleanly here from the head itself. It will need a rebase/merge before it can be tested as a merge result.Runs and readings are from the reporter's machine; analysis and wording are AI-assisted.
@Yuanzer on GitHub · 2026-11-29 19:53 UTC · original
Series X / higher-load addendum: two order-reversed pairs on the same machine (AI-assisted local runs).
65e11b31; logs at the same host-info filter.Raw median frame time was 1.6 ms lower on the PR, but it also drew about 135 fewer objects per frame. Normalized to draws, the result is effectively neutral: 10.74 ms per 1,000 draws on base versus 10.72 on the PR. The aggregate P90 and P99 are lower on the PR, but the run order still matters and this is one pair per order.
Taken with the 720p four-run result, the evidence supports a small CPU/relay work reduction and a possible tail improvement, not a normalized FPS gain in these scenes. No OOMs or device removals occurred.
Runs and readings are from the reporter's machine; analysis and wording are AI-assisted.
65e11b319ctofca85edf04@steven-seagull27 on GitHub · 2026-11-29 20:42 UTC · original
Thanks @Yuanzer for running both fixed-clock A/B series (720p and 1440p) and flagging the rebase conflict!
Rebased cleanly onto latest
main(cec481f4, new headfca85edf) while preserving all recent upstream fixes in the touched paths:1b4b6cd4'sHost::resize_fetch(andmembench::RELAY_FETCH) insiderelay_card_back_with_scratch,detached.release_scratch()at landing in both relay and non-relay landing loops, and idle list trimming inlist.rs.b214e008(plain next-fit scan default) andd7c2d8a7(393,216 dynamic slots), as batched slot release routes throughDynamicSlots::release_batchfor both plain and bitmap modes.Verification (rebased on
cec481f4)cargo test --locked -j 3 -p victory-gpu --lib -- descriptor:: --test-threads=1— 102 passed, 0 failed (2 ignored)cargo test --locked -j 3 -p victory-gpu --lib -- host:: --test-threads=1— 213 passed, 0 failed (26 ignored), includinghost::batch::relay_scratch_reuses_buffers_caps_outliers_and_drops_shadowscargo test --locked -j 3 -p victory-gpu --lib -- draw:: --test-threads=1— 27 passed, 0 failed (2 ignored), includingdraw::tests::batched_dynamic_and_shared_release_reclaims_all_host_heap_slotscargo test --locked -j 3 -p victory-gpu --lib -- shadow::relay_tests:: --test-threads=1— 8 passed, 0 failed, includingshadow::relay_tests::flights_done_ranges_matches_reference_across_zero_one_small_and_manycargo test --locked -j 3 -p victory-gpu --lib -- list:: --test-threads=1— 20 passed, 0 failedcargo check --locked -j 3 -p victory-gpu --libandcargo clippy --locked -j 3 -p victory-gpu --lib --tests— 0 new warnings in touched files (--features diagnosticshas pre-existing unrelated errors onmainincopystat.rsandhost.rs:9355, with 0 errors/warnings in lines touched by this PR)git diff --check origin/main..HEAD— clean@DoubleD17 on GitHub · 2026-11-30 07:58 UTC · original · edited 2026-11-30 09:57 UTC
We ran a test of this PR on current main (
41adb551with this PR merged), on a CPU-bound machine.We compare only the seconds where the idle camera shows the same lighter views (about 7,500 draws a frame). Its heavier view (about 15,000 draws, half the frame rate) takes 10 to 60 s of each 150 s run, and it moved whole-run means by several ms.
No difference we can measure. The five main runs of the session agreed within 1.3 ms on these seconds. But we also ran main again, built in another folder, eight times: it ranged from 57.5 to 65.5 ms. Its first four runs were 2.4 ms slower than main on average, and the last four 4.2 ms faster. All nine PRs we tested in this session came out 0.4 to 3.9 ms slower than main, and fps moved with it. So we read the difference as a newly built executable, not as this PR.
The relay thread was landing 32.8 and 36.1 ms a frame, against 30.9 to 38.0 on main.
Picture: 0 defects in 160 frames.
Setup:
41adb551(only its own commits on top), against41adb551itself;Picture check: a burst of 10 captures a second at the end of each run (80 frames), looked at frame by frame.
AI Assisted
@steven-seagull27 on GitHub · 2026-11-30 11:52 UTC · original
Thanks @DoubleD17 for running the two-round interpolated comparison on
41adb551and checking the 160 captured frames for visual defects! Good to have independent confirmation that the batched descriptor-slot/shared-table releases andRelayScratchreuse are defect-free under 1440p DLAA load.fca85edf04toef735ec9f0@steven-seagull27 on GitHub · 2026-11-30 18:27 UTC · original
Rebased cleanly onto latest
main:#3498(VICTORY_LAND_CAPTURE) and#3480(batchedland::Notes::flush_all) alongsideRelayScratchinHost::relay_card_back/Host::relay_land, batched dynamic/shared descriptor releases, andFlights::done_ranges.relay_scratchandflightsunit tests,--features diagnosticscheck,clippy --lib --tests, andxtask policy.@tyr0nsur on GitHub · 2026-12-01 00:09 UTC · original
I isolated dynamic slot release on current
7d93ee07, motivated by the landing profile in #4592. The raw merge currently conflicts in the inheritedxmem.rshistory, but a three-way application of your single commitef735ec9to7d93ee07is clean and touches just the four files in its diff.On Windows with a Ryzen 7 5800X and a live D3D12 host heap, I compared the current per-range release loop with
release_dynamic_batchfor one heap, all one-slot ranges and retirement enabled. Nine paired runs of 1,000 landings per size, alternating execution order, optimized test profile (opt-level=2). Allocation and free-count checks were outside the timed interval. Median ns per landing:Every landing restored the initial slot count, and the existing wrong-ID/stale-heap batch test passed. The measurement isolates slot release and does not include populated descriptors, allocation, or the rest of the relay. The 24- and 128-range results support checking just the landing-side batching in the #4592 gameplay comparison.
[pr-perf] Batch relay dynamic/shared table releases, reuse RelayScratch, and fast-path Flights::doneto Batch relay dynamic/shared table releases, reuse RelayScratch, and fast-path Flights::doneef735ec9f0toa1b0257ab7View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.