Repository navigation
GPU: stop the descriptor view table growing without bound - #2099
0xkn0wh3r3 wants to merge 1 commit into
Conversation
Every view a title writes is kept in one table, and a descriptor's record (the tag and two words) names its entry and generation, which survives titles copying descriptors as bytes. Views of resource objects are freed with their resource, but views without one (constant buffers, views of placed memory) have nothing that releases them, so their entries were kept for the run. Grand Theft Auto VI writes some 14,000 constant buffer views a frame, each at the address its constants have that frame: on fxceless/victory-fork, 2,450,139 entries after four minutes of play, about 1 GB with the index, growing by 11,000 a second. The record's two words now say what they hold in the generation's top two bits: 0, a table entry as before (generations stay below those bits); a constant buffer view whole (a 47-bit address and a 15-bit size: bytes below 16 KiB, else 256-byte units below 4 MiB); or a view of placed memory whole (a 40-bit title address and the number of its "shape", the view's description without its address, kept in a table of their own: as many as the title has kinds of textures and buffers). Views that do not fit (larger addresses or sizes, shapes past 2^22) stay table entries. Every reader goes through `view_at`, which decodes all three; the host heap keys its slots by the same two words, which stay equal for equal views and differ for different ones. `VICTORY_VIEW_INLINE=0` keeps every view a table entry. Ported from fxceless/victory-fork (commit 578d459), the view-table part only (not that commit's other descriptor changes). Tests (no GPU needed): - `constant_views_fit_their_records`: addresses and sizes round-trip, and those that do not fit say so. - `views_at_new_addresses_add_no_entries`: 20,000 constant buffer and placed views at new addresses add no entries and one shape. - `released_entries_keep_their_generations_below_the_kind_bits`: a generation bumped past the top wraps to 1, and the released view's record goes stale. Co-authored-by: fxceless <36782933+fxceless@users.noreply.github.com>
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Descriptor view table bounded — stops unbounded growth; check the eviction policy when the cap is hit (LRU vs fail).
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib descriptor::tests::— 8 passed, 0 failedcargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean bounded inline/generational representation stopping unbounded growth of the descriptor view table. Looks good.
AI-assisted (Gemini 4 Neon).
|
Tested this in Grand Theft Auto VI's world: RTX 5080, Linux, proton-cachyos 11.0, on
|
|
@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 |
|
Automated triage for the maintainers. The change in
Generated by Claude Code |
The 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.VICTORY_VIEW_INLINE=0restores the old behaviour.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, with the change on and withVICTORY_VIEW_INLINE=0: all pass except the two tests that already fail onmainfrom the NVIDIA heap cap (NVIDIA D3D12 (70564ae): stride_tests & synthetic_tests fail due to HEAP_VIEWS (2M > 1M NVIDIA limit) and Stride::Structured with rawBufferLoad #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.