Keep draw-table buffer slots out of heap_buffer_pass and reclaim unmapped loose-window slots #4983

Open
github-bot wants to merge 1 commit from github-bot/gh-4982 into main AGit
Owner

@⁠danielibabet on GitHub · 2026-12-01 16:25 UTC · original
danielibabet:perf/tabled-and-unmapped-buffer-windows → main · +750 −28 · 5 files · 1 commits · open

Refs #4774, #4463

What it changes

Fixes two compounding causes of unbounded BufferSweep growth and un-reclaimable 6 MiB shadow::LOOSE windows in victory-gpu:

  1. Keep draw-table buffer slots out of heap_buffer_pass (VICTORY_TABLED_BUFFERS=1 by default, =0 disables):
    Draw-table descriptor slots are claimed via slot_tabled, which previously expired from copied_tabled after COPIED_FRAMES = 8 frames. Once expired (or during low-FPS stalls before the draw-table ring wraps), heap_buffer_pass adopted thousands of transient draw-table buffer slots as permanent bindless entries, keeping Shadow::used fresh every frame and pinning LOOSE window ID3D12Resources in HostHeap::kept.

    • HostHeap now tracks tabled_key (the exact VIEW_BOOK (generation << 32) | i record last claimed by a draw table via slot_tabled_at / mirror_tabled_batched).
    • heap_buffer_pass and HostHeap::note_buffer_at leave a slot to draws as long as is_tabled_record matches that exact record; overwriting the slot with any new record immediately clears the match so heap_buffer_pass picks up repurposed bindless slots normally.
  2. Skip and unmake unmapped address-only buffer slots & release stale window holds (VICTORY_SWEEP_UNMAPPED_BUFFERS=1 by default, =0 disables):
    Unlike placed textures (resource::let_go_idle + wholly_unmapped), address-only buffer views (View::Placed buffer SRVs/UAVs and View::Constant outside registered title buffers) continued to allocate or pin 6 MiB shadow::LOOSE windows over decommitted/unmapped title memory.

    • heap_buffer_pass skips unmapped address-only buffer slots (avoiding fresh LOOSE allocations) and unmakes already-made slots (unmake_if_made) if their backing is decommitted.
    • shadow::let_go_idle now also identifies idle or wholly-unmapped LOOSE windows pinned only by HostHeap::kept (references(&s.buffer) > 1, Arc::strong_count == 1, no pending shader writes) and calls descriptor::release_idle_window_slots (scanning only HostHeap::kept_buffers with 1 s / 5 s backoff) to reset stale View::Constant, unmapped, or long-idle draw-table buffer slots so the underlying LOOSE window can be retired.

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Headless D3D12 unit & regression tests on NVIDIA GeForce RTX 4070 12 GB (Windows 11, 32 GB RAM); live gameplay A/B session not yet run on this branch (baseline play logs on this machine hit 131k+ BufferSweep views / 4,606 copies / 2,691 MB refreshed and 13.0 GB shared GPU memory before commit exhaustion).
  • Before: copied_tabled expired after 8 frames and let_go_idle never released LOOSE windows still referenced in HostHeap::kept by stale constant/tabled/unmapped buffer slots.
  • After:
    • VICTORY_BURY_LAG=0 cargo test --locked -p victory-gpu --lib -j 16 -- audit_regressions --test-threads=1 — 7 passed, 0 failed (including 3 new D3D12 tests: tabled_buffer_slot_stays_out_of_heap_pass_past_copied_frames_until_repurposed, unmapped_placed_buffer_slot_skips_loose_window_until_mapped_and_unmakes_on_decommit, and let_go_idle_unmakes_constant_slot_and_reclaims_unmapped_root_window).
    • cargo test --locked -p victory-gpu --lib -j 16 -- descriptor:: shadow:: draw:: --test-threads=4 — 240 passed, 0 failed, 10 ignored.
    • cargo test --locked -p victory-gpu --lib -j 16 -- resource::tests:: — 65 passed, 0 failed, 1 ignored.
    • cargo clippy --workspace --all-targets --locked & --all-features: 0 warnings/errors in touched files (pre-existing origin/main errors in host/{font,menu,panel}.rs tracked in #4708).
    • cargo xtask policy: 464 files ok.
    • cargo build --release --locked -p victory -j 16: clean.
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): n/a (not a shader change).
  • cargo test passed for the crates it touches: yes (descriptor::, shadow::, draw::, resource::tests:: in victory-gpu).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #4774 (open root-view window growth question), #4463, #3502, #3503, #4737, #4708.
**@⁠danielibabet** on GitHub · 2026-12-01 16:25 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4982) `danielibabet:perf/tabled-and-unmapped-buffer-windows` → `main` · +750 −28 · 5 files · 1 commits · open Refs #4774, #4463 ## What it changes Fixes two compounding causes of unbounded `BufferSweep` growth and un-reclaimable 6 MiB `shadow::LOOSE` windows in `victory-gpu`: 1. **Keep draw-table buffer slots out of `heap_buffer_pass` (`VICTORY_TABLED_BUFFERS=1` by default, `=0` disables):** Draw-table descriptor slots are claimed via `slot_tabled`, which previously expired from `copied_tabled` after `COPIED_FRAMES = 8` frames. Once expired (or during low-FPS stalls before the draw-table ring wraps), `heap_buffer_pass` adopted thousands of transient draw-table buffer slots as permanent bindless entries, keeping `Shadow::used` fresh every frame and pinning `LOOSE` window `ID3D12Resource`s in `HostHeap::kept`. - `HostHeap` now tracks `tabled_key` (the exact `VIEW_BOOK` `(generation << 32) | i` record last claimed by a draw table via `slot_tabled_at` / `mirror_tabled_batched`). - `heap_buffer_pass` and `HostHeap::note_buffer_at` leave a slot to draws as long as `is_tabled_record` matches that exact record; overwriting the slot with any new record immediately clears the match so `heap_buffer_pass` picks up repurposed bindless slots normally. 2. **Skip and unmake unmapped address-only buffer slots & release stale window holds (`VICTORY_SWEEP_UNMAPPED_BUFFERS=1` by default, `=0` disables):** Unlike placed textures (`resource::let_go_idle` + `wholly_unmapped`), address-only buffer views (`View::Placed` buffer SRVs/UAVs and `View::Constant` outside registered title buffers) continued to allocate or pin 6 MiB `shadow::LOOSE` windows over decommitted/unmapped title memory. - `heap_buffer_pass` skips unmapped address-only buffer slots (avoiding fresh `LOOSE` allocations) and unmakes already-made slots (`unmake_if_made`) if their backing is decommitted. - `shadow::let_go_idle` now also identifies idle or wholly-unmapped `LOOSE` windows pinned only by `HostHeap::kept` (`references(&s.buffer) > 1`, `Arc::strong_count == 1`, no pending shader writes) and calls `descriptor::release_idle_window_slots` (scanning only `HostHeap::kept_buffers` with 1 s / 5 s backoff) to reset stale `View::Constant`, unmapped, or long-idle draw-table buffer slots so the underlying `LOOSE` window can be retired. ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): Headless D3D12 unit & regression tests on NVIDIA GeForce RTX 4070 12 GB (Windows 11, 32 GB RAM); live gameplay A/B session not yet run on this branch (baseline play logs on this machine hit 131k+ `BufferSweep` views / 4,606 copies / 2,691 MB refreshed and 13.0 GB shared GPU memory before commit exhaustion). - Before: `copied_tabled` expired after 8 frames and `let_go_idle` never released `LOOSE` windows still referenced in `HostHeap::kept` by stale constant/tabled/unmapped buffer slots. - After: - `VICTORY_BURY_LAG=0 cargo test --locked -p victory-gpu --lib -j 16 -- audit_regressions --test-threads=1` — **7 passed, 0 failed** (including 3 new D3D12 tests: `tabled_buffer_slot_stays_out_of_heap_pass_past_copied_frames_until_repurposed`, `unmapped_placed_buffer_slot_skips_loose_window_until_mapped_and_unmakes_on_decommit`, and `let_go_idle_unmakes_constant_slot_and_reclaims_unmapped_root_window`). - `cargo test --locked -p victory-gpu --lib -j 16 -- descriptor:: shadow:: draw:: --test-threads=4` — **240 passed, 0 failed, 10 ignored**. - `cargo test --locked -p victory-gpu --lib -j 16 -- resource::tests::` — **65 passed, 0 failed, 1 ignored**. - `cargo clippy --workspace --all-targets --locked` & `--all-features`: 0 warnings/errors in touched files (pre-existing `origin/main` errors in `host/{font,menu,panel}.rs` tracked in #4708). - `cargo xtask policy`: 464 files ok. - `cargo build --release --locked -p victory -j 16`: clean. - For shader changes, the wave sizes tested (32 and/or 64 lanes): n/a (not a shader change). - `cargo test` passed for the crates it touches: yes (`descriptor::`, `shadow::`, `draw::`, `resource::tests::` in `victory-gpu`). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #4774 (open root-view window growth question), #4463, #3502, #3503, #4737, #4708.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 16:29:07 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/shadow.rs
View 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.
git fetch -u origin '+refs/pull/4983/head:github-bot/gh-4982'
git switch 'github-bot/gh-4982'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4982'
git switch 'github-bot/gh-4982'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4982'
git switch 'github-bot/gh-4982'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4982'
git switch 'main'
git merge --squash 'github-bot/gh-4982'
git switch 'main'
git merge --ff-only 'github-bot/gh-4982'
git switch 'main'
git merge 'github-bot/gh-4982'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4983
No description provided.