gpu(descriptor): atomic sparse candidate index for HostHeap::slots_showing (#1644) #2720
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2720"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by HailLucifer666 on 2026-11-29T16:33:24Z.
Addresses #1644
What it changes
HostHeap::slots_showingwalked every slot inHostHeap::keptacquiring each slot'sMutexon everysweep()call (~28–79 ms stalls on the submitting thread on 8 GB cards,[Reported]in #1644).Split into two commits on
829188e9:refactor(descriptor): encapsulate HostHeap::kept in KeptSlots submodule— moveskeptbehind private fields indescriptor/kept.rs(includingraw_at()forHostHeap::showsandkeep(..., None)fortake_kept).perf(descriptor): add atomic sparse candidate index for slots_showing (#1644)— maintains a 64-slot atomic occupancy bitmap (bits) and atomic raw-identity shadow (raw) updated under the slot lock, skipping empty 64-slot words in one load and re-verifying every candidate hit underslots[i].lock()(zero TOCTOU/ABA). Kill switch:VICTORY_SLOT_EVICT_BITMAP=0falls back to the full locked scan.How it was tested
sweep()frame-time benchmark.cargo test -p victory-gpu --lib descriptor::kept→ 5 passed, 0 failed (empty set, zero-clone identity, TOCTOU stale-candidate re-verification, differential oracle random ops + non-64-aligned lengths, concurrent same-word writers + scanner).cargo clippy -p victory-gpu --lib --tests→ exit 0, 0 warnings indescriptor/kept.rsand touched lines. (Pre-existingdiagnosticsfeature errors on829188e9untouched.)cargo testpassed for the crates it touches: yesChecked for overlap
829188e9. Related: #2075 (timing log only for #1644, non-colliding), #2361 (touchesdescriptor/host.rsto reclaim dead RTs —KeptSlotspreserves identical slot-lock semantics and does not change slot liveness, so both compose cleanly).Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by icdmkg2 on 2026-11-29T19:21:34Z.
The live 8 GB measurement the PR notes as not done yet.
Setup: RTX 5060 Laptop GPU (8 GB), Ryzen 7 H 260, 32 GB, Windows 11. Build:
main55d06914+ #2549 + #2783 + #2647 + #2795 + this PR, release, Series S, DLSS performance, the prologue's cell, about 90 s per run. I added one timer around thedescriptor::evictable_slotscall inslot_evictand changed onlyVICTORY_SLOT_EVICT_BITMAPbetween runs:evictable_slotsmedianVICTORY_SLOT_EVICT_BITMAP=0So there's no measurable difference here. Earlier (#1644) I counted about 1,000,127 slots in 2 heaps. If the bitmap only skips empty 64-slot words, a mostly-filled heap leaves little to skip, and the per-slot
raws.containslookup against 45–60k candidates probably dominates. I haven't confirmed the fill ratio. A count of skipped words per pass would show it.Separately, with #2549 merged, the pass ran only 5–6 times in about 90 s, where it was about 84 before (once a second). So on this machine #2549's back-off is what removes most of the #1644 cost. Both A/B'd against a build without this PR: fps unchanged within noise (18.9 / 16.9 against 18.7 / 18.6 median).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yoruiopz on 2026-11-30T08:02:50Z.
Independent same-binary test on an RTX 5070 Laptop GPU (8 GB), Windows 11, Series X at 1920×1080 output with DLSS Performance and 2× FG, cap 15 rendered FPS. I used both commits from this PR on
41adb551plus the 1080p startup fix, sweep timers, and the allocation-pruning change from #3811. The warm cache, copied checkpoint, input tape, and all renderer switches were held fixed, exceptVICTORY_SLOT_EVICT_BITMAP=0versus1. Sampled eviction and sweep slicing were held off. I bypassed the periodic diagnostic full-scan audit in both arms so the audit would not enter the timing series. Both arms still maintained the bitmap/raw metadata.Both runs saw zero eligible textures, descriptor resets, and evictions. This confirms a CPU-side scan reduction in this active 8 GB case. The one A/B pair did not establish better frame tails or correctness during nonzero eviction. The control and variant both had a logical heap capacity of 1,000,127 slots; that counter is capacity, so does not measure the bitmap’s physical lock attempts.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tyr0nsur on 2026-11-30T08:24:43Z.
I measured the diagnostic audit that the RTX 5070 Laptop A/B above bypassed. With diagnostics and the sparse index enabled, the first call to
slots_showingtakes every slot lock in that heap. The global counter repeats that full audit every 64 calls and can keep selecting the same heap when heaps are visited in a fixed order.Follow-up commit
fa8a5d0is based on2d5663a. It checks one balanced slice per heap per call, retaining the locked checks of raw identity and occupancy. Each heap checks all its slots over 64 calls. Deliberate raw and bitmap drift tests cover uneven sizes and interleaved heaps.Synthetic Windows CPU test on a Ryzen 7 5800X, optimized Rust, 1,000,127 slots, 25% occupied, one thread, 4,096 calls per arm after warm-up. Audit work only, with the candidate scan outside the timer.
cargo test --locked -p victory-gpu --lib descriptor::kept::testspassed all six tests. The full diagnostics test build still hits the pre-existingmbandtimingerrors on this head. Gameplay frame times and VRAM were outside this check.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.