victory-gpu: segregate single-slot and table dynamic descriptors (#747) #949

Closed
github-bot wants to merge 1 commit from gh-pr/949/head into gh-pr/949/base
Owner

@⁠Sakura-Byte on GitHub · 2026-11-24 14:25 UTC · original
Sakura-Byte:pr/dynamic-slots-segregated → main · +286 −34 · 1 files · 1 commits · closed without merging

Summary

  • Track top-down single-slot (n == 1) and bottom-up multi-slot table (n > 1) cursors inside DynamicPool so single-slot churn does not fragment multi-slot table space while preserving release reuse.
  • Bump MIN_DYNAMIC from 1 << 16 (65,536) to 1 << 17 (131,072) for capped heaps while preserving PORTABLE_VIEWS clamping.
  • Add synthetic unit and HostHeap tests covering free_space/free_table, non-fragmentation between n == 1 and n > 1, exhaustion without overlap, release reuse, and 128K MIN_DYNAMIC.

Verification

  • cargo xtask policy and cargo clippy --locked -- -D warnings: clean
  • Verified on Windows 11 (NVIDIA GeForce RTX 5090 D & WARP)

AI-assisted; synthetic tests only, zero game assets.

**@⁠Sakura-Byte** on GitHub · 2026-11-24 14:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/949) `Sakura-Byte:pr/dynamic-slots-segregated` → `main` · +286 −34 · 1 files · 1 commits · closed without merging ### Summary - Track top-down single-slot (`n == 1`) and bottom-up multi-slot table (`n > 1`) cursors inside `DynamicPool` so single-slot churn does not fragment multi-slot table space while preserving release reuse. - Bump `MIN_DYNAMIC` from `1 << 16` (65,536) to `1 << 17` (131,072) for capped heaps while preserving `PORTABLE_VIEWS` clamping. - Add synthetic unit and `HostHeap` tests covering `free_space`/`free_table`, non-fragmentation between `n == 1` and `n > 1`, exhaustion without overlap, release reuse, and 128K `MIN_DYNAMIC`. ### Verification - `cargo xtask policy` and `cargo clippy --locked -- -D warnings`: clean - Verified on Windows 11 (NVIDIA GeForce RTX 5090 D & WARP) *AI-assisted; synthetic tests only, zero game assets.*
- Track top-down single-slot (n == 1) and bottom-up multi-slot table (n > 1) cursors inside DynamicPool so single-slot churn does not fragment multi-slot table space while preserving release reuse.

- Bump MIN_DYNAMIC from 1 << 16 (65,536) to 1 << 17 (131,072) for capped heaps while preserving PORTABLE_VIEWS clamping.

- Add unit and HostHeap tests covering free_space/free_table, non-fragmentation between n == 1 and n > 1, exhaustion without overlap, release reuse, and 128K MIN_DYNAMIC.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:14:45 +00:00
github-bot closed this pull request 2026-11-26 04:14:45 +00:00
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 14:46 UTC · original

With capacity held at eight slots, the same allocation sequence and three table releases left six free slots in both allocators. The baseline’s longest contiguous run was two slots. With the two search directions, all six free slots were contiguous. This isolates a placement effect from the separate increase in the capped heap reserve.

All nine descriptor tests on the author revision passed on RTX 4090 under Wine/vkd3d-proton 3.2. An allocator-only port that retained our comparison build’s existing capacity and guard passed twelve tests, including a free range straddling the search cursor. The eight-slot trace is synthetic. To attribute a title allocation failure to fragmentation, the useful measurements at that failure are the request width, total free slots, and largest contiguous run in the same heap.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 14:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/949#issuecomment-7134925923) With capacity held at eight slots, the same allocation sequence and three table releases left six free slots in both allocators. The baseline’s longest contiguous run was two slots. With the two search directions, all six free slots were contiguous. This isolates a placement effect from the separate increase in the capped heap reserve. All nine descriptor tests on the author revision passed on RTX 4090 under Wine/vkd3d-proton 3.2. An allocator-only port that retained our comparison build’s existing capacity and guard passed twelve tests, including a free range straddling the search cursor. The eight-slot trace is synthetic. To attribute a title allocation failure to fragmentation, the useful measurements at that failure are the request width, total free slots, and largest contiguous run in the same heap.
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 15:40 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at db91a48: cargo test -p victory-gpu passes, 56 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 15:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/949#issuecomment-7136426448) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at db91a48: `cargo test -p victory-gpu` passes, 56 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠R0D4X on GitHub · 2026-11-24 15:45 UTC · original

RTX 5080 (Blackwell, Wave32) A/B Test of #949 and #1024

Environment:

  • GPU: NVIDIA GeForce RTX 5080 (Wave32: min=32, max=32, 1M capped shader-visible view heap), Windows 11
  • Base stack (Run B): main ffe310e + #439, #578, #334, #492, #646, #635, #987, #669, #984, #986, #452, #946, #948, #688
  • Added in Run C: #949 (minor test-only merge conflict in crates/victory-gpu/src/descriptor/host.rs) + #1024 (clean merge)
  • Title: GTA VI Xbox Series X build 1.0.2.1, scripted menu entry (VICTORY_KEYS), no VICTORY_SKIP_WAVE64, no VICTORY_SHADER_LOOP_LIMIT override (no game assets attached)
Metric (world steady-state, 0 being made, ~440–480 draws/frame) Run B (diag + DRED + Debug Layer) Run C (+ #949 + #1024, diag + DRED + Debug Layer) Run C (+ #949 + #1024, no DRED / no Debug Layer, release codegen)
Runtime / crashes 210.1 s, 0 crashes 210.1 s, 0 crashes 150.0 s, 0 crashes
Dynamic descriptor drops (1M heap) dropped=512 (n=254, even with #688) 0 0
slow host submission (>250 ms) 0 0 0
Runtime D3D12 Debug Layer errors 0 0 (disabled)
World FPS (steady / peak) 1.5 (peak 1.6) 1.4–1.6 (peak 1.6) 1.3–1.6 (peak 1.6)
preparing (copies) 251 ms (115 ms) 241 ms (104 ms) 184–229 ms (68–90 ms)
on the GPU 122 ms 131 ms 106–134 ms
copying back 301 ms (35.1 MB/frame) 322 ms (14.1 MB/frame, tail 264–285 ms) 315–385 ms (13.1–14.9 MB/frame)

Findings:

  1. #949 completely eliminates dynamic descriptor exhaustion on NVIDIA's 1M view heap — drops fell from 512+ (n=254, triggered by #986's fresh tables even with #688) down to 0 across both the 210 s debug-layer run and the 150 s no-debug run.
  2. #1024 cuts copied-back volume by ~60% (35.1 MB/frame → 14.1 MB/frame) with zero hangs or debug-layer errors. However, copying back wall time remained ~264–322 ms (with Debug Layer) and ~315–385 ms (without DRED/Debug Layer), indicating that copy-back latency at ~28 submissions/frame is dominated by per-submission readback sync / write-watch overhead rather than memcpy bandwidth.
**@⁠R0D4X** on GitHub · 2026-11-24 15:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/949#issuecomment-7136567659) ### RTX 5080 (Blackwell, Wave32) A/B Test of #949 and #1024 **Environment:** - GPU: NVIDIA GeForce RTX 5080 (Wave32: `min=32, max=32`, 1M capped shader-visible view heap), Windows 11 - Base stack (Run B): `main` `ffe310e` + `#439`, `#578`, `#334`, `#492`, `#646`, `#635`, `#987`, `#669`, `#984`, `#986`, `#452`, `#946`, `#948`, `#688` - Added in Run C: `#949` (minor test-only merge conflict in `crates/victory-gpu/src/descriptor/host.rs`) + `#1024` (clean merge) - Title: GTA VI Xbox Series X build `1.0.2.1`, scripted menu entry (`VICTORY_KEYS`), **no** `VICTORY_SKIP_WAVE64`, **no** `VICTORY_SHADER_LOOP_LIMIT` override (no game assets attached) | Metric (world steady-state, `0 being made`, ~440–480 draws/frame) | Run B (`diag` + DRED + Debug Layer) | Run C (+ `#949` + `#1024`, `diag` + DRED + Debug Layer) | Run C (+ `#949` + `#1024`, **no DRED / no Debug Layer**, release codegen) | |---|---|---|---| | Runtime / crashes | 210.1 s, **0 crashes** | 210.1 s, **0 crashes** | 150.0 s, **0 crashes** | | Dynamic descriptor drops (1M heap) | `dropped=512` (`n=254`, even with `#688`) | **`0`** | **`0`** | | `slow host submission` (>250 ms) | `0` | `0` | `0` | | Runtime D3D12 Debug Layer errors | `0` | `0` | *(disabled)* | | World FPS (steady / peak) | `1.5` (peak `1.6`) | `1.4–1.6` (peak `1.6`) | `1.3–1.6` (peak `1.6`) | | `preparing` (`copies`) | `251 ms` (`115 ms`) | `241 ms` (`104 ms`) | `184–229 ms` (`68–90 ms`) | | `on the GPU` | `122 ms` | `131 ms` | `106–134 ms` | | `copying back` | `301 ms` (**`35.1 MB/frame`**) | `322 ms` (**`14.1 MB/frame`**, tail `264–285 ms`) | `315–385 ms` (**`13.1–14.9 MB/frame`**) | **Findings:** 1. **`#949` completely eliminates dynamic descriptor exhaustion on NVIDIA's 1M view heap** — drops fell from **`512+`** (`n=254`, triggered by `#986`'s fresh tables even with `#688`) down to **`0`** across both the 210 s debug-layer run and the 150 s no-debug run. 2. **`#1024` cuts copied-back volume by ~60% (`35.1 MB/frame` → `14.1 MB/frame`)** with zero hangs or debug-layer errors. However, `copying back` wall time remained ~`264–322 ms` (with Debug Layer) and ~`315–385 ms` (without DRED/Debug Layer), indicating that copy-back latency at ~28 submissions/frame is dominated by per-submission readback sync / write-watch overhead rather than memcpy bandwidth.
Author
Owner

@⁠hamdog0203 on GitHub · 2026-11-24 16:26 UTC · original

Tested unmodified db91a48 independently on Windows 11 (Build 26200), NVIDIA GeForce RTX 4060 (driver 621.35, 32-lane waves), and Rust 1.98.1:

Verification results

  • cargo clippy --workspace --all-targets --locked -- -D warnings: pass
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: pass
  • cargo test -p victory-gpu --locked -- --nocapture descriptor::host::tests: 9/9 passed on RTX 4060 (free_table_chooses_the_first_contiguous_fit_in_cursor_order, dynamic_pool_segregates_singles_and_tables_to_exhaustion_without_overlap, a_free_table_can_straddle_the_search_cursor, single_slot_allocations_do_not_fragment_multi_slot_tables, capped_view_heap_uses_128k_min_dynamic, and all existing tests)
  • cargo test --workspace --locked (RTX 4060): all workspace tests pass (victory-gpu: 56 passed, 0 failed, 1 benchmark ignored; victory-shader: 89 passed, 1 ignored; xtask policy: 4 passed)
  • Empirical RTX 4060 capped-heap probe (HostHeap::new(false, PORTABLE_VIEWS + 1)):
    • main (ffe310e): capped at 1,000,000 with count = 934,464, dynamic = 65,536
    • PR #949 (db91a48): capped at 1,000,000 with count = 868,928, dynamic = 131,072
  • Negative control on main (ffe310e): both a_free_table_can_straddle_the_search_cursor (returned None instead of Some(4)) and single_slot_allocations_do_not_fragment_multi_slot_tables fail against main.

Non-blocking review notes

  1. Doubling MIN_DYNAMIC from 1 << 16 (65,536) to 1 << 17 (131,072) reduces static count on a 1,000,000-capped NVIDIA heap from 934,464 to 868,928; worth noting if any title accesses heap slots in 868,928..934,464 before full view remapping lands.
  2. Minor rustfmt --check formatting diffs exist in crates/victory-gpu/src/descriptor/host.rs (not gated by CI).

Synthetic tests and RTX 4060 hardware only; no game data. AI-assisted.

**@⁠hamdog0203** on GitHub · 2026-11-24 16:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/949#issuecomment-7137672753) Tested unmodified `db91a48` independently on Windows 11 (Build 26200), **NVIDIA GeForce RTX 4060** (driver `621.35`, 32-lane waves), and Rust `1.98.1`: ### Verification results - `cargo clippy --workspace --all-targets --locked -- -D warnings`: pass - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: pass - `cargo test -p victory-gpu --locked -- --nocapture descriptor::host::tests`: **9/9 passed** on RTX 4060 (`free_table_chooses_the_first_contiguous_fit_in_cursor_order`, `dynamic_pool_segregates_singles_and_tables_to_exhaustion_without_overlap`, `a_free_table_can_straddle_the_search_cursor`, `single_slot_allocations_do_not_fragment_multi_slot_tables`, `capped_view_heap_uses_128k_min_dynamic`, and all existing tests) - `cargo test --workspace --locked` (RTX 4060): all workspace tests pass (`victory-gpu`: 56 passed, 0 failed, 1 benchmark ignored; `victory-shader`: 89 passed, 1 ignored; `xtask` policy: 4 passed) - **Empirical RTX 4060 capped-heap probe** (`HostHeap::new(false, PORTABLE_VIEWS + 1)`): - `main` (`ffe310e`): capped at `1,000,000` with `count = 934,464`, `dynamic = 65,536` - PR `#949` (`db91a48`): capped at `1,000,000` with `count = 868,928`, `dynamic = 131,072` - **Negative control on `main` (`ffe310e`):** both `a_free_table_can_straddle_the_search_cursor` (returned `None` instead of `Some(4)`) and `single_slot_allocations_do_not_fragment_multi_slot_tables` fail against `main`. ### Non-blocking review notes 1. Doubling `MIN_DYNAMIC` from `1 << 16` (`65,536`) to `1 << 17` (`131,072`) reduces static `count` on a `1,000,000`-capped NVIDIA heap from `934,464` to `868,928`; worth noting if any title accesses heap slots in `868,928..934,464` before full view remapping lands. 2. Minor `rustfmt --check` formatting diffs exist in `crates/victory-gpu/src/descriptor/host.rs` (not gated by CI). Synthetic tests and RTX 4060 hardware only; no game data. AI-assisted.
Author
Owner

@⁠NuraadGit on GitHub · 2026-11-24 16:26 UTC · original

On the size: 2^17 may be too small for the full world on a capped heap. @⁠R0D4X's zero drops were at ~440–480 draws per frame, and the world runs several times that once more programs translate.

  • RTX 5090 D v2 (@⁠timorjay, #747): a peak of 151,326 dynamic slots in use with a 2^18 reserve. 2^17 is 131,072.
  • RTX 2080: with 2^16, the no dynamic slots for its tables counter reached 524,288 while 422–440 draws ran per frame. With 2^18, no such drop in any world run since, up to ~2,830 draws per frame and 12 minutes (heap line: capped at 1000000, count=1245184).
  • I haven't run 2^17, nor this allocator.

Less fragmentation may lower the need, so I'd judge the two parts apart: this allocator at 2^18, logging peak occupied slots in the world, would show whether 2^17 is enough. If it isn't, AimLogin's layout (#747) gives the 1M heap 262,144 dynamic slots without cutting uncapped hosts. #902 also uses 2^17, so the same question applies there.

AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's.

**@⁠NuraadGit** on GitHub · 2026-11-24 16:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/949#issuecomment-7137676721) On the size: **2^17 may be too small for the full world on a capped heap.** @⁠R0D4X's zero drops were at ~440–480 draws per frame, and the world runs several times that once more programs translate. - **RTX 5090 D v2** (@⁠timorjay, #747): a peak of **151,326 dynamic slots in use** with a 2^18 reserve. 2^17 is 131,072. - **RTX 2080:** with 2^16, the `no dynamic slots for its tables` counter reached 524,288 while 422–440 draws ran per frame. With 2^18, **no such drop in any world run since**, up to ~2,830 draws per frame and 12 minutes (heap line: `capped at 1000000`, `count=1245184`). - I haven't run 2^17, nor this allocator. Less fragmentation may lower the need, so I'd judge the two parts apart: this allocator at 2^18, logging peak occupied slots in the world, would show whether 2^17 is enough. If it isn't, AimLogin's layout (#747) gives the 1M heap 262,144 dynamic slots without cutting uncapped hosts. #902 also uses 2^17, so the same question applies there. *AI-assisted (Claude Code): the runs and log analysis were automated. The hardware, title copy and runs are the user's.*
Author
Owner

@⁠MartinIndra02 on GitHub · 2026-11-24 17:25 UTC · original

Independent verification at db91a48 on Windows 11, NVIDIA GeForce RTX 3080 (driver 621.24, 1M-capped view heap) + WARP, Rust 1.98.1:

  • cargo test -p victory-gpu --lib -- --test-threads=1 (RTX 3080): 56 passed, 0 failed, 1 ignored (including all new dynamic-pool segregation and 128K MIN_DYNAMIC tests).
  • VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib -- --test-threads=1 (WARP): 56 passed, 0 failed, 1 ignored.
  • VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib -- --test-threads=1 (D3D12 Debug Layer): 59 passed, 0 failed, 1 ignored (0 debug-layer errors).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): 0 warnings.
  • cargo xtask policy: 153 files ok.

No game data used. AI-assisted; all builds and GPU tests executed on my machine.

**@⁠MartinIndra02** on GitHub · 2026-11-24 17:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/949#issuecomment-7139178012) Independent verification at `db91a48` on **Windows 11, NVIDIA GeForce RTX 3080 (driver `621.24`, 1M-capped view heap) + WARP, Rust `1.98.1`**: - `cargo test -p victory-gpu --lib -- --test-threads=1` (RTX 3080): **56 passed, 0 failed, 1 ignored** (including all new dynamic-pool segregation and 128K `MIN_DYNAMIC` tests). - `VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --lib -- --test-threads=1` (WARP): **56 passed, 0 failed, 1 ignored**. - `VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib -- --test-threads=1` (D3D12 Debug Layer): **59 passed, 0 failed, 1 ignored** (0 debug-layer errors). - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): **0 warnings**. - `cargo xtask policy`: **153 files ok**. *No game data used. AI-assisted; all builds and GPU tests executed on my machine.*
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:28 UTC · original

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #1548. Main avoids single-slot fragmentation of the dynamic range another way (root views take runs of 256, memory pairs sit past the dynamic slots); the larger dynamic range on capped heaps is #1548's.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/949#issuecomment-7148548158) Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1548. Main avoids single-slot fragmentation of the dynamic range another way (root views take runs of 256, memory pairs sit past the dynamic slots); the larger dynamic range on capped heaps is #1548's. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

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/Marvisak--VIctory!949
No description provided.