Repository navigation
GPU: heap buffer pass looks only at marked slots; time split in the fps line - #467
LeonardoS11 wants to merge 2 commits into
Conversation
5a3dfa4 to
37272ae
Compare
|
A dormant descriptor heap can accumulate freed indices indefinitely in I reproduced this on A per-heap cap that switches to the existing full-rescan state on overflow fixed the regression locally. The next bind enumerated all slots, and the four existing tests still passed. This was an AI-assisted synthetic Rust test using the PR's heap_pass.rs; it needs no game files or GPU. |
…t counts in the fps line The pass for shaders that pick buffers by index looked again at every buffer view of the heap (81,000 in the world) every 16 passes and rebuilt every copy's span from all views every pass. Now (heap_pass.rs) a slot is looked at again when its view was written, its view table entry was freed (descriptor::forget, which leaves the record as it was), its record in title memory differs from the one last seen (a 12-byte compare), or it found no host copy (every 16 passes); all slots every 256 passes as a safety net. A copy's span is worked out again only when one of its slots went. VICTORY_HEAP_PASS_FULL=1 brings back the old pass for A/B. The fps line now splits the pass's time: slots looked at, copies refreshed, and the texture side (heap_textures, bounded at 250 ms a pass), with the slots and copies per frame and the mode (marked/full). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… not run Every heap's pass is told of the freed view table entries at the pass of the heap that asks, but only the heap whose pass runs drains its list: a heap the title stopped drawing with kept every entry (a review reproduced 2,097,152). Now only entries some slot's record named at its last look are kept (the others change nothing), at most 65,536; past that the list is dropped and that heap's next pass looks at all its slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@ryotdev thank you — that is a real leak, and it is fixed in dfb8ee3, now on this branch:
The branch is also rebased onto 0b0074e (two commits: the pass, then this fix); the only conflict was the counters of the frame line, where I kept Where the PR stands on speed, so nobody takes it for more than it is yet: on our branches over current (Fix and rebase with Claude Code; tests run by me on the hardware above.) |
37272ae to
dfb8ee3
Compare
Draft until the still-scene A/B and the whole test suite on a GPU are done (see Not tested).
Problem
The heap buffer pass (
heap_buffersindraw.rs, once a frame, inside a list call of a recording thread) serves shaders that pick a buffer by its index in the descriptor heap. Every 16 passes it looked at every view in the heap again (about 81,000 in the title's world, each with amirror, a lock and ashadow::find), and on every pass it rebuilt the spans of the roughly 4,100 host copies from all the views. Its time was reported as one number that also contains the textures picked by index, so it could not be told what the buffer part cost.What is in it
One commit on
main(c96b4f2), five files:crates/victory-gpu/src/heap_pass.rs(new, no D3D12, unit tested): which slots a pass has to look at. A slot is looked at again only whenchangedset, as before),descriptor::forgetnow notes the entries;take_forgotten),A copy's span is recomputed only when one of its slots leaves it.
draw.rs,descriptor.rs,host.rs,lib.rs: the pass uses it; the fps line splits the pass:heap buffers N passes X ms (marked|full: S slots looked at A ms, C copies refreshed B ms, textures T ms).VICTORY_HEAP_PASS_FULL=1keeps the old pass, for comparison.Tested
diagprofile withdiagnostics, rebased ontomainc96b4f2 (head37272ae).cargo build --profile diag -p victory --features diagnostics: no warnings.cargo test -p victory-gpu heap_pass: 4 passed, 0 failed —only_slots_changed_since_the_last_pass_are_looked_at_again(an API write, a copy made outside the API and a freed entry are each looked at again; unchanged slots are not),a_slot_that_went_shrinks_its_copy_span,orphans_are_tried_again_every_16_passes_and_all_slots_now_and_then,the_old_pass_looks_at_all_every_16_passes.Result
No measurable change in frame time so far. In the same runs the pass took 105–456 ms a frame, of it 88–338 ms the textures picked by index (
heap_textures, 1,700–4,000 slots waiting each pass), which this PR does not touch, and 14–218 ms the slots. The runs before and after did not go through the same scene, so no frame-time number is claimed. What the PR gives today is the buffer part bounded by what changed, and the split that shows the texture part is the one to look at next.Not tested
VICTORY_HEAP_PASS_FULL=1on a still scene (a checkpoint for that exists now; to be added here).cargo test --workspace); before the rebase it passed with the stack named above.AI use
Claude Code: Claude Opus 5.5 wrote the change and its tests; Claude Fable 5.2 rebased it, ran the measurements and wrote this description. Run in the title by the author on the hardware above.