GPU: stop the descriptor view table growing without bound #2097

Open
0xkn0wh3r3 wants to merge 3 commits from upstream-pr/2099 into main
0xkn0wh3r3 commented 2026-11-25 04:59:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T04:59:02Z.


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 (Views in descriptor.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:

  • A table entry, as before (other views).
  • A constant buffer view: its address and size, stored directly (constant_words).
  • A placed view: its address and a shape number (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:

  • Views too large to fit stay table entries: a constant buffer view past a 47-bit address, or of 16 KiB or more that is not a multiple of 256 bytes or reaches 4 MiB; a placed view past 1 TiB; any placed view once the shape table is full.
  • Readers go through view_at, which decodes all three. The host heap already read records through it; descriptor::view now does too.
  • A table entry's generation now wraps below the two kind bits, so a released view's record never reads as a constant buffer or placed view.

Ported from fxceless/victory-fork (commit 578d459): the view-table change only, not that commit's other descriptor changes.

Testing

  • Three new CPU-only tests:
    • 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 --lib on an RTX 5070 Ti: all pass except the two tests that already fail on main from 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 13f91ca

Upstream's heap sync (f809521) checks a page's records under one lock with views_current, which read the table directly instead of going through view_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_changed failed). views_current now decodes records as view_at does. Two new tests cover it: views_held_whole_are_current_for_heap_syncs (CPU-only) and heap_syncs_make_the_slots_whose_records_hold_their_views_whole. Test, clippy and policy results are unchanged from above.

Rebased onto f3578e3

Only the tests conflicted (beside #2449's null_cbv_clears_a_stale_view). #2449's null CBV is Constant(0, 0), which a record holds whole like any other constant buffer view. No upstream change since 13f91ca reads record words apart from view_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 on main here (two NVIDIA heap-cap tests and the flaky views_bound_while_another_slot_gets_its_texture_do_not_wait). Clippy clean with and without --features diagnostics; cargo xtask policy passes.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5485458665 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T04:59:02Z. --- ## 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 (`Views` in `descriptor.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: - **A table entry**, as before (other views). - **A constant buffer view**: its address and size, stored directly (`constant_words`). - **A placed view**: its address and a shape number (`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: - Views too large to fit stay table entries: a constant buffer view past a 47-bit address, or of 16 KiB or more that is not a multiple of 256 bytes or reaches 4 MiB; a placed view past 1 TiB; any placed view once the shape table is full. - Readers go through `view_at`, which decodes all three. The host heap already read records through it; `descriptor::view` now does too. - A table entry's generation now wraps below the two kind bits, so a released view's record never reads as a constant buffer or placed view. Ported from fxceless/victory-fork (commit 578d459): the view-table change only, not that commit's other descriptor changes. ## Testing - Three new CPU-only tests: - `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 --lib` on an RTX 5070 Ti: all pass except the two tests that already fail on `main` from 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 13f91ca Upstream's heap sync (f809521) checks a page's records under one lock with `views_current`, which read the table directly instead of going through `view_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_changed` failed). `views_current` now decodes records as `view_at` does. Two new tests cover it: `views_held_whole_are_current_for_heap_syncs` (CPU-only) and `heap_syncs_make_the_slots_whose_records_hold_their_views_whole`. Test, clippy and policy results are unchanged from above. ### Rebased onto f3578e3 Only the tests conflicted (beside #2449's `null_cbv_clears_a_stale_view`). #2449's null CBV is `Constant(0, 0)`, which a record holds whole like any other constant buffer view. No upstream change since 13f91ca reads record words apart from `view_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 on `main` here (two NVIDIA heap-cap tests and the flaky `views_bound_while_another_slot_gets_its_texture_do_not_wait`). Clippy clean with and without `--features diagnostics`; `cargo xtask policy` passes.
catminou4 commented 2026-11-25 05:02:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T05:02:22Z.

Review: COMMENTED


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).

<!-- greyfinch-sync:Marvisak/VIctory:review:6052105303 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#pullrequestreview-6052105303). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T05:02:22Z. **Review:** COMMENTED --- 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 commented 2026-11-25 05:36:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T05:36:58Z.

Review: APPROVED


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 failed
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo 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).

<!-- greyfinch-sync:Marvisak/VIctory:review:6052375009 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#pullrequestreview-6052375009). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T05:36:58Z. **Review:** APPROVED --- 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 failed** - `cargo clippy -p victory-gpu --all-targets` — 0 warnings - `cargo 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).
desplmfao commented 2026-11-25 07:03:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by desplmfao on 2026-11-25T06:21:30Z.


Tested this in Grand Theft Auto VI's world: RTX 5080, Linux, proton-cachyos 11.0, on main plus 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.

  • Without this PR, VIctory's heap grew about 200 MB every 30 s in the world. The top growing site was the Vec in descriptor::record (68, then 136, then 272 MB), and blocks under 4 KB grew alongside it, which fits the BTreeMap index.
  • With this PR, the heap stayed flat at about 1.4 GB over several minutes in the world. descriptor::record was no longer among the top sites.
  • Frame time didn't change: 428–452 ms per frame, against 442–451 ms without it.
  • It merged into that stack without conflicts.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7154707953 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#issuecomment-7154707953). Originally posted by [desplmfao](https://github.com/desplmfao) on 2026-11-25T06:21:30Z. --- Tested this in Grand Theft Auto VI's world: RTX 5080, Linux, proton-cachyos 11.0, on `main` plus 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. - Without this PR, VIctory's heap grew about 200 MB every 30 s in the world. The top growing site was the `Vec` in `descriptor::record` (68, then 136, then 272 MB), and blocks under 4 KB grew alongside it, which fits the `BTreeMap` index. - With this PR, the heap stayed flat at about 1.4 GB over several minutes in the world. `descriptor::record` was no longer among the top sites. - Frame time didn't change: 428–452 ms per frame, against 442–451 ms without it. - It merged into that stack without conflicts.
0xkn0wh3r3 commented 2026-11-25 07:03:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T06:35:31Z.


@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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154951478 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#issuecomment-7154951478). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T06:35:31Z. --- @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 commented 2026-11-25 11:05:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:37:38Z.


Automated triage for the maintainers.

Merge candidate (re-checked on 2cad160). This push is a rebase onto main. A range-diff against the previously reviewed head 82d5d11 shows the three commits unchanged. The only difference is one context line in an existing descriptor.rs test, taken from main.

The change itself is unchanged. Constant buffer and placed views are encoded whole in their descriptor records (constant_words, placed_words plus the small shapes table), so they no longer add a Views table entry each time. view_at and views_current decode 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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7159952855 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#issuecomment-7159952855). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T10:37:38Z. --- <!-- victory-triage v1 head=2cad1608b26f2c83679d762f23b1653cb10da61f verdict=merge-candidate at=2026-11-26T01:21:13Z --> Automated triage for the maintainers. **Merge candidate (re-checked on `2cad160`).** This push is a rebase onto `main`. A range-diff against the previously reviewed head `82d5d11` shows the three commits unchanged. The only difference is one context line in an existing `descriptor.rs` test, taken from `main`. The change itself is unchanged. Constant buffer and placed views are encoded whole in their descriptor records (`constant_words`, `placed_words` plus the small `shapes` table), so they no longer add a `Views` table entry each time. `view_at` and `views_current` decode 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](https://claude.ai/code)_
0xkn0wh3r3 commented 2026-11-25 19:06:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T18:37:11Z.


Thanks, both done in b0af626:

  • The Views doc 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 to views_at_new_addresses_add_no_entries's doc comment.
  • VICTORY_VIEW_INLINE is gone. Nothing depended on it, and the test that skipped when it was off now always runs.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7171159276 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#issuecomment-7171159276). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T18:37:11Z. --- Thanks, both done in b0af626: - The `Views` doc 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 to `views_at_new_addresses_add_no_entries`'s doc comment. - `VICTORY_VIEW_INLINE` is gone. Nothing depended on it, and the test that skipped when it was off now always runs.
pickles976 commented 2026-11-25 21:03:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pickles976 on 2026-11-25T20:25:12Z.


Independent Wine/NVIDIA check of 82d5d117b7, 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:

cargo +1.98.1 test --locked --target x86_64-pc-windows-msvc \
  -p victory-gpu --lib -- --nocapture --test-threads=1 \
  constant_views_fit_their_records \
  views_at_new_addresses_add_no_entries \
  released_entries_keep_their_generations_below_the_kind_bits \
  views_held_whole_are_current_for_heap_syncs \
  heap_syncs_make_the_slots_whose_records_hold_their_views_whole

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 with assert!(host().is_some(), ...) and reran heap_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-astra inspected the PR, ran the checks and temporary no-skip probe, and prepared this report from the observed output.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173643380 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#issuecomment-7173643380). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-25T20:25:12Z. --- 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: ```sh cargo +1.98.1 test --locked --target x86_64-pc-windows-msvc \ -p victory-gpu --lib -- --nocapture --test-threads=1 \ constant_views_fit_their_records \ views_at_new_addresses_add_no_entries \ released_entries_keep_their_generations_below_the_kind_bits \ views_held_whole_are_current_for_heap_syncs \ heap_syncs_make_the_slots_whose_records_hold_their_views_whole ``` **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 with `assert!(host().is_some(), ...)` and reran `heap_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-astra` inspected the PR, ran the checks and temporary no-skip probe, and prepared this report from the observed output.
fuzeofficlal commented 2026-11-26 19:11:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:11:34Z.

Review: APPROVED


Reviewed 2cad1608b26f merged cleanly onto 63bcca43.

Inlining constant buffer views and title-memory placed views directly into the 64-bit (i, generation) slot record (crates/victory-gpu/src/descriptor.rs:484-640) eliminates unbounded Views::list growth without introducing eviction or stale-slot UAF risk:

  • Bit layout & round-trip exactness (descriptor.rs:484-590): Using the top 2 bits of generation (KIND_SHIFT = 30) gives 62 payload bits for CONSTANT (47-bit address + 15-bit exact/256B-scaled size) and PLACED (40-bit title-memory address + 22-bit deduplicated Shape index), with out-of-range addresses/sizes or full shape tables falling back cleanly to normal table entries.
  • Generation & non-zero key invariants (descriptor.rs:675-727): Wrapping table generations via ((generation + 1) & GENERATIONS).max(1) keeps table entries strictly within 1..=0x3FFF_FFFF (never colliding with 0 or CONSTANT/PLACED kind bits), while CONSTANT/PLACED records always have non-zero generation. view_at (descriptor.rs:688) and views_current (descriptor.rs:708) match across all four kind values, including unknown shape indices and untagged records.

Hardware & D3D12 Debug Layer verification (RTX 5090 + Microsoft WARP, VICTORY_D3D12_DEBUG=1):

  • cargo xtask policy and cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features) pass cleanly.
  • descriptor::tests:: (11/11) and descriptor::host::tests::heap_syncs_make_the_slots_whose_records_hold_their_views_whole pass on both RTX 5090 and WARP under VICTORY_D3D12_DEBUG=1.
  • Verified an additional Debug Layer probe churning 51,200 distinct CBV addresses across a 64-slot host descriptor heap with periodic sync_slots calls: zero D3D12 Debug Layer messages (host.log_messages() == None) and device healthy on both RTX 5090 and WARP.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6079358813 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#pullrequestreview-6079358813). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T19:11:34Z. **Review:** APPROVED --- Reviewed `2cad1608b26f` merged cleanly onto `63bcca43`. Inlining constant buffer views and title-memory placed views directly into the 64-bit `(i, generation)` slot record (`crates/victory-gpu/src/descriptor.rs:484-640`) eliminates unbounded `Views::list` growth without introducing eviction or stale-slot UAF risk: - **Bit layout & round-trip exactness (`descriptor.rs:484-590`)**: Using the top 2 bits of `generation` (`KIND_SHIFT = 30`) gives 62 payload bits for `CONSTANT` (47-bit address + 15-bit exact/256B-scaled size) and `PLACED` (40-bit title-memory address + 22-bit deduplicated `Shape` index), with out-of-range addresses/sizes or full shape tables falling back cleanly to normal table entries. - **Generation & non-zero key invariants (`descriptor.rs:675-727`)**: Wrapping table generations via `((generation + 1) & GENERATIONS).max(1)` keeps table entries strictly within `1..=0x3FFF_FFFF` (never colliding with `0` or `CONSTANT`/`PLACED` kind bits), while `CONSTANT`/`PLACED` records always have non-zero `generation`. `view_at` (`descriptor.rs:688`) and `views_current` (`descriptor.rs:708`) match across all four kind values, including unknown shape indices and untagged records. **Hardware & D3D12 Debug Layer verification** (RTX 5090 + Microsoft WARP, `VICTORY_D3D12_DEBUG=1`): - `cargo xtask policy` and `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`) pass cleanly. - `descriptor::tests::` (11/11) and `descriptor::host::tests::heap_syncs_make_the_slots_whose_records_hold_their_views_whole` pass on both RTX 5090 and WARP under `VICTORY_D3D12_DEBUG=1`. - Verified an additional Debug Layer probe churning 51,200 distinct CBV addresses across a 64-slot host descriptor heap with periodic `sync_slots` calls: zero D3D12 Debug Layer messages (`host.log_messages() == None`) and device healthy on both RTX 5090 and WARP. LGTM.
upipibi commented 2026-11-28 02:29:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T02:29:56Z.


One gap that may let the shape table fill (read from this head 2cad160 and another tree's measurements; not run here).

shape_of (descriptor.rs:547-555) keys a placed view's shape on the whole 14-word resource description, (unordered, *resource, rest). Two of those words are padding in D3D12_RESOURCE_DESC:

  • word 1, before the 8-aligned Alignment;
  • word 13, after Flags at offset 48, padding the struct to 56 bytes.

trustno1-coder/VIctory-NVIDIA#58 found that the title sometimes leaves exactly words 1 and 13 unwritten when it calls device methods 0x230/0x238. The same view then arrives with different bytes. Before its fix, their view table reached 2.3 million kept views (about 2.1 GB) in a 15-minute session at 1440p, Series X. With padding-only differences, Views::shape here would hand out a new shape for each variant until SHAPES (2^22) is reached, and then every further placed view goes back to being a table entry.

Their fix, from JMAN730/project-flamingo b1e0cd1d by way of Vice-Tay (GPL-3): copy only the named fields and zero the padding, with const asserts on the D3D12 offsets (alignment at 8, flags at 48, size 56). Here that would be zeroing resource[1] and resource[13] in shape_of, or in create_placed_srv/create_placed_uav before record. They also fixed a test, views_at_new_addresses_add_no_entries, that had built its description with non-zero padding words.

A second, independent count of the same title behaviour, from another project's view-by-address textures (xcl-dev/xcl, GPL-2.0; numbers only): its key cleared bytes 0x34..0x38 but not 0x04..0x08 of the same 0x38-byte description (words 1 and 13 here). There, 24,844 of 80,953 textures in a 200 s run were padding twins (31 %, xcl-dev/xcl#2762). With both ranges cleared, runs kept 29-31 % fewer such textures (RTX 4070 under Wine, RX 7900 XT under RADV).

AI-assisted (Claude Code, Claude Opus 5.5 read this head and #58 there).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7232401944 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2099#issuecomment-7232401944). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-28T02:29:56Z. --- One gap that may let the shape table fill (read from this head `2cad160` and another tree's measurements; not run here). `shape_of` (`descriptor.rs:547-555`) keys a placed view's shape on the whole 14-word resource description, `(unordered, *resource, rest)`. Two of those words are padding in `D3D12_RESOURCE_DESC`: - word 1, before the 8-aligned `Alignment`; - word 13, after `Flags` at offset 48, padding the struct to 56 bytes. trustno1-coder/VIctory-NVIDIA#58 found that the title sometimes leaves exactly words 1 and 13 unwritten when it calls device methods `0x230`/`0x238`. The same view then arrives with different bytes. Before its fix, their view table reached 2.3 million kept views (about 2.1 GB) in a 15-minute session at 1440p, Series X. With padding-only differences, `Views::shape` here would hand out a new shape for each variant until `SHAPES` (2^22) is reached, and then every further placed view goes back to being a table entry. Their fix, from JMAN730/project-flamingo `b1e0cd1d` by way of Vice-Tay (GPL-3): copy only the named fields and zero the padding, with const asserts on the D3D12 offsets (alignment at 8, flags at 48, size 56). Here that would be zeroing `resource[1]` and `resource[13]` in `shape_of`, or in `create_placed_srv`/`create_placed_uav` before `record`. They also fixed a test, `views_at_new_addresses_add_no_entries`, that had built its description with non-zero padding words. A second, independent count of the same title behaviour, from another project's view-by-address textures (xcl-dev/xcl, GPL-2.0; numbers only): its key cleared bytes `0x34..0x38` but not `0x04..0x08` of the same 0x38-byte description (words 1 and 13 here). There, 24,844 of 80,953 textures in a 200 s run were padding twins (31 %, xcl-dev/xcl#2762). With both ranges cleared, runs kept 29-31 % fewer such textures (RTX 4070 under Wine, RX 7900 XT under RADV). AI-assisted (Claude Code, Claude Opus 5.5 read this head and #58 there).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2099:upstream-pr/2099'
git switch 'upstream-pr/2099'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2099'
git switch 'upstream-pr/2099'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2099'
git switch 'upstream-pr/2099'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2099'
git switch 'main'
git merge --squash 'upstream-pr/2099'
git switch 'main'
git merge --ff-only 'upstream-pr/2099'
git switch 'main'
git merge 'upstream-pr/2099'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2097
No description provided.