GPU: stop the descriptor view table growing without bound #2099
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2099
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2099"
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?
@0xkn0wh3r3 on GitHub · 2026-11-25 04:59 UTC · original
0xkn0wh3r3:gpu/bounded-view-table→main· +438 −37 · 2 files · 3 commits · openThe problem
The descriptor view table grows for the whole run, by about 1 GB after four minutes of Grand Theft Auto VI.
The table (
Viewsindescriptor.rs) never frees constant buffer views or views of placed memory. They have no resource object, so nothing releases them. Grand Theft Auto VI writes about 14,000 constant buffer views a frame at new addresses, and each is a new entry. Measured on fxceless/victory-fork: about 2.45 million entries (about 1 GB) after four minutes, and 11,000 more every second.The fix
These two kinds of view are no longer table entries. A descriptor's record already holds two 32-bit words; their top two bits now say what they hold:
constant_words).placed_words). A shape is the view's description without the address, kept in a small table of its own (one per kind of texture or buffer, however often the title moves them).Details:
view_at, which decodes all three. The host heap already read records through it;descriptor::viewnow does too.Ported from fxceless/victory-fork (commit
578d459): the view-table change only, not that commit's other descriptor changes.Testing
constant_views_fit_their_records: records round-trip addresses and sizes, and views that do not fit say so.views_at_new_addresses_add_no_entries: 20,000 views at new addresses add no table entries, and one shape stands for all the placed views.released_entries_keep_their_generations_below_the_kind_bits: a table generation wraps without colliding with the new record kinds.cargo test -p victory-gpu --libon an RTX 5070 Ti: all pass except the two tests that already fail onmainfrom the NVIDIA heap cap (#1835).cargo clippy -p victory-gpu --all-targets, with and without--features diagnostics: clean.Not covered
Not run with a game (no game data here); the growth figures are from the fork's run.
Rebased onto
13f91caUpstream's heap sync (
f809521) checks a page's records under one lock withviews_current, which read the table directly instead of going throughview_at. Records holding a constant buffer or placed view were never current, so a sync never made their slots (heap_syncs_make_the_slots_whose_records_changedfailed).views_currentnow decodes records asview_atdoes. Two new tests cover it:views_held_whole_are_current_for_heap_syncs(CPU-only) andheap_syncs_make_the_slots_whose_records_hold_their_views_whole. Test, clippy and policy results are unchanged from above.Rebased onto
f3578e3Only the tests conflicted (beside #2449's
null_cbv_clears_a_stale_view). #2449's null CBV isConstant(0, 0), which a record holds whole like any other constant buffer view. No upstream change since13f91careads record words apart fromview_at/views_current(#1906's view addresses, #2234, #2262 and #2462 work on decoded views).cargo test -p victory-gpu --lib: all pass but the three that fail onmainhere (two NVIDIA heap-cap tests and the flakyviews_bound_while_another_slot_gets_its_texture_do_not_wait). Clippy clean with and without--features diagnostics;cargo xtask policypasses.@desplmfao on GitHub · 2026-11-25 06:21 UTC · original
Tested this in Grand Theft Auto VI's world: RTX 5080, Linux, proton-cachyos 11.0, on
mainplus a few other open PRs (#2153, #2151). I measured VIctory's Rust heap with a counting global allocator and tracked allocations of 1 MiB or more by call site.Vecindescriptor::record(68, then 136, then 272 MB), and blocks under 4 KB grew alongside it, which fits theBTreeMapindex.descriptor::recordwas no longer among the top sites.@0xkn0wh3r3 on GitHub · 2026-11-25 06:35 UTC · original
@catminou4: there's no eviction. When something doesn't fit the new compact form, it stays an ordinary table entry, exactly as before this change. That covers a constant-buffer view past a 47-bit address, or one of 16 KiB or more that isn't a multiple of 256 bytes or reaches 4 MiB, a placed view past 1 TiB, and any placed view once the shape table is full. So hitting the cap only means those views grow the table as they do on
main; nothing is dropped or reused. The shape table holds one entry per kind of texture or buffer description, without the address, so it stays small however often the game moves its views.@Marvisak on GitHub · 2026-11-25 10:37 UTC · original · edited 2026-11-26 01:21 UTC
Automated triage for the maintainers.
Merge candidate (re-checked on
2cad160). This push is a rebase ontomain. A range-diff against the previously reviewed head82d5d11shows the three commits unchanged. The only difference is one context line in an existingdescriptor.rstest, taken frommain.The change itself is unchanged. Constant buffer and placed views are encoded whole in their descriptor records (
constant_words,placed_wordsplus the smallshapestable), so they no longer add aViewstable entry each time.view_atandviews_currentdecode all three record kinds, and table generations wrap below the kind bits. An independent NVIDIA/Wine check of the previous head passed the five focused tests, including the host heap-sync test.CI: passing (
check).Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-25 18:37 UTC · original
Thanks, both done in b0af626:
Viewsdoc comment now says only what the code does: constant buffer and placed views are named whole in their records, and the table keeps only placed-view shapes and the views that don't fit. The run figures and the fork reference are now only in the description. The same trim applies toviews_at_new_addresses_add_no_entries's doc comment.VICTORY_VIEW_INLINEis gone. Nothing depended on it, and the test that skipped when it was off now always runs.@pickles976 on GitHub · 2026-11-25 20:25 UTC · original
Independent Wine/NVIDIA check of 82d5d117b71808d2cd82fc7e367371c320cf9eb4, including the
views_current/ heap-sync follow-up. This used a separate checkout of the exact PR head, not our older title-integration tree.Environment: RTX 4060 Laptop 8 GiB, 16 GiB system RAM; Linux 6.17.0-40-generic; Wine 11.0; NVIDIA 590.48.01; DXVK 3.1.1-209-g1039f682058fa71; stock vkd3d-proton 3.2.0 (
2576c0b4adfae4a). Rust 1.98.1 Windows-MSVC cross-build, Wine Cargo runner,VICTORY_ADAPTER=nvidia,DXVK_CONFIG='dxgi.hideNvidiaGpu = False'. No Microsoft D3D12 debug-layer validation.After configuring the Windows SDK/linker and runner environment:
5 passed, 0 failed, 0 ignored. This covers compact CBV round-trips/boundaries, 20,000 changing addresses without table growth, generation wrapping/stale views, current-record classification, and the host-heap synchronization path for byte-copied compact records.
To rule out the GPU fixture's silent
host().is_none()return, I temporarily replaced only that return withassert!(host().is_some(), ...)and reranheap_syncs_make_the_slots_whose_records_hold_their_views_whole: 1 passed. The real NVIDIA device and host descriptor heap were used. That test-only change was then reverted; no runtime code was altered.Limits: the host test checks descriptor creation/synchronization, not shader execution or pixel readback. No full-suite result, in-title memory-growth measurement, VRAM saving, world-entry pass, or 15-minute stability claim follows from these checks. Those remain separate from the focused compatibility result above.
AI-assisted: omp with
openai-codex/gpt-6-astrainspected the PR, ran the checks and temporary no-skip probe, and prepared this report from the observed output.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.