draw: pack active HeapRanges densely and cut heap_buffer_pass overhead #448
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!448
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-448"
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?
@Wiktorxd-1 on GitHub · 2026-11-27 22:41 UTC · original
Wiktorxd-1:perf/heap-buffers-sweep→main· +104 −42 · 1 files · 1 commits · openWhat this fixes
In live gameplay logs,
heap_buffer_pass(crates/victory-gpu/src/draw.rs) took ~18.6 ms/frame on the aside thread while holdinghost.buffer_sweep:HeapRanges<T>stored a sparseVec<Option<(T, u64, u64)>>indexed up to the highest buffer slot (~737k entries). Every frame,ranges.ranges()walked all ~737k entries (with ~72k–83k active) to buildspans, andforget_partstepped through 32-byteOptionslots.each_viewcalledcrate::descriptor::host::device_removed()(GetDeviceRemovedReason()COM query) on every 256-slot chunk.spansstarted at capacity 0, clonedArc<Shadow>a second time intofound, and allocated/swappednext_unwatched = HashMap::new()every frame even whenVICTORY_UNWATCHED_FRAMES == 1(the default).The commits
HeapRangesdensely and cutheap_buffer_passoverhead.HeapRanges<T>now keeps a compactindex: Vec<u32>(u32::MAX= empty, 4 bytes/slot) and a tightly packeddense: Vec<(u32, (T, u64, u64))>of active slots only, soranges()iterates contiguous active entries without scanning hundreds of thousands ofNoneslots.device_removed()out of the per-chunkeach_viewclosure to once aftereach_view.spanstolast_spans, consumedspansdirectly intofoundwithout extraArcclones, and skippednext_unwatchedallocation whenevery <= 1.Tests
cargo test --locked -p victory-gpu --lib draw(11 passed; 0 failed; 3 ignored, includingevery_slot_is_looked_at_again_in_a_round)cargo build --release --locked -p victory(succeeded)target\release\victory.exeviascripts\play-nvidia.ps1(35s,ALIVE_AFTER_35S=True,crashes.log=False).Setup
NVIDIA GeForce RTX 5070, driver
621.14.0, Windows 11 (10.0.26300). Series S profile, DLSS Performance, Frame Generation 6x. My own dump:<game dir>. No game files are attached or quoted.This change and its testing were done with an AI assistant (Antigravity), and I checked the results on my machine.
@Rafa7046 on GitHub · 2026-11-28 01:28 UTC · original
Measured on an RTX 5080 16 GB + Ryzen 9 9950X3D (Series X, 1440p, DLSS Performance, frame generation off, diagnostics build on
64d4931with only this PR applied, pipelines made ahead withvictory warm), same stretch each run: Lucia's arrest cutscenes, then Jason on the boat and a minute standing still.preparingin the cutscenesmain, run 1main, run 2Two runs of plain
maindiffer by about 2.4 fps, so this is within the run-to-run spread on this machine: no measurable change in frame rate here, and no new warnings, faults or crashes in the log. On this card the frame is set by the submitting thread (about 21 ms of a 28 ms frame), which is probably why a saving of this size does not show.Same machine and scene with and without the title's ray tracing: #535.
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.