gpu: scale dynamic descriptor pool on capped heaps (NVIDIA) #3300

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

@⁠AdvaitPalve11 on GitHub · 2026-11-26 16:24 UTC · original
AdvaitPalve11:feat/gpu-capped-heap-dynamic-pool → main · +109 −21 · 1 files · 1 commits · open

On NVIDIA hardware, shader-visible CBV/SRV/UAV heaps fail creation past PORTABLE_VIEWS (1,000,000). Previously, HostHeap::new skipped count + DYNAMIC whenever (count + DYNAMIC).max(HEAP_VIEWS) failed, and capped large heaps down to MIN_DYNAMIC (65,536) dynamic slots.

Because 2^16 dynamic slots can exhaust in seconds in the world (#59) and high-index tables also spill into dynamic slots on capped heaps, draws can be dropped or trigger device removal.

  • Extract allocate_view_heap() to try count + DYNAMIC before capping.

  • Reserve CAPPED_DYNAMIC (2^17 = 131,072) dynamic slots when capping huge heaps at PORTABLE_VIEWS, preserving all title slots up to PORTABLE_VIEWS - CAPPED_DYNAMIC.

  • Probe HEAP_VIEWS support in dynamic_slots_are_held_until_released so capped NVIDIA GPUs assert >= 4 + DYNAMIC instead of panicking on the 2M Tier-3 check.

  • Add unit test view_heap_allocation_scales_on_capped_hosts covering Tier 3, NVIDIA capped layouts, and fallback behavior.

**@⁠AdvaitPalve11** on GitHub · 2026-11-26 16:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3300) `AdvaitPalve11:feat/gpu-capped-heap-dynamic-pool` → `main` · +109 −21 · 1 files · 1 commits · open On NVIDIA hardware, shader-visible CBV/SRV/UAV heaps fail creation past PORTABLE_VIEWS (1,000,000). Previously, HostHeap::new skipped count + DYNAMIC whenever (count + DYNAMIC).max(HEAP_VIEWS) failed, and capped large heaps down to MIN_DYNAMIC (65,536) dynamic slots. Because 2^16 dynamic slots can exhaust in seconds in the world (#59) and high-index tables also spill into dynamic slots on capped heaps, draws can be dropped or trigger device removal. - Extract allocate_view_heap() to try count + DYNAMIC before capping. - Reserve CAPPED_DYNAMIC (2^17 = 131,072) dynamic slots when capping huge heaps at PORTABLE_VIEWS, preserving all title slots up to PORTABLE_VIEWS - CAPPED_DYNAMIC. - Probe HEAP_VIEWS support in dynamic_slots_are_held_until_released so capped NVIDIA GPUs assert >= 4 + DYNAMIC instead of panicking on the 2M Tier-3 check. - Add unit test view_heap_allocation_scales_on_capped_hosts covering Tier 3, NVIDIA capped layouts, and fallback behavior.
On NVIDIA hardware, shader-visible CBV/SRV/UAV heaps fail creation past PORTABLE_VIEWS (1,000,000). Previously, HostHeap::new skipped count + DYNAMIC whenever (count + DYNAMIC).max(HEAP_VIEWS) failed, and capped large heaps down to MIN_DYNAMIC (65,536) dynamic slots.

Because 2^16 dynamic slots can exhaust in seconds in the world (#59) and high-index tables also spill into dynamic slots on capped heaps, draws can be dropped or trigger device removal.

- Extract allocate_view_heap() to try count + DYNAMIC before capping.

- Reserve CAPPED_DYNAMIC (2^17 = 131,072) dynamic slots when capping huge heaps at PORTABLE_VIEWS, preserving all title slots up to PORTABLE_VIEWS - CAPPED_DYNAMIC.

- Probe HEAP_VIEWS support in dynamic_slots_are_held_until_released so capped NVIDIA GPUs assert >= 4 + DYNAMIC instead of panicking on the 2M Tier-3 check.

- Add unit test view_heap_allocation_scales_on_capped_hosts covering Tier 3, NVIDIA capped layouts, and fallback behavior.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:27:50 +00:00
Author
Owner

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

A hardware data point for the capped-heap sizes here, from the fork (fxceless/victory-fork), not main or this PR:

  • On an RTX 5070 Ti (driver 616.64), the largest shader-visible CBV/SRV/UAV heap that can be made is exactly 1,000,000 views (measured by trying sizes up to 2^21). That matches PORTABLE_VIEWS.
  • The fork keeps 2^18 dynamic slots on that heap, so title indices past about 737,856 read the null slot. With that split, 0 dynamic tables were refused in 3 runs of 210 s in the first gameplay scene (Series S profile, about 275k tables asked per run).

Limits: one early scene, a different tree, and we have not run this PR. Demand varies by scene: #747 has a 600 s scripted cell-block walk on another fork that still refused 944 tables a frame at 2^18. So 2^17 may be tight in places our runs don't reach.

**@⁠HLVM04** on GitHub · 2026-11-26 16:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/3300#issuecomment-7197651210) A hardware data point for the capped-heap sizes here, from the fork (fxceless/victory-fork), not `main` or this PR: - On an RTX 5070 Ti (driver 616.64), the largest shader-visible CBV/SRV/UAV heap that can be made is exactly 1,000,000 views (measured by trying sizes up to 2^21). That matches `PORTABLE_VIEWS`. - The fork keeps 2^18 dynamic slots on that heap, so title indices past about 737,856 read the null slot. With that split, 0 dynamic tables were refused in 3 runs of 210 s in the first gameplay scene (Series S profile, about 275k tables asked per run). Limits: one early scene, a different tree, and we have not run this PR. Demand varies by scene: #747 has a 600 s scripted cell-block walk on another fork that still refused 944 tables a frame at 2^18. So 2^17 may be tight in places our runs don't reach.
github-bot force-pushed github-bot/gh-3300 from aeeb3cb251 to 01f91fea96 2026-11-26 16:45:59 +00:00 Compare
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 16:49 UTC · original · approved these changes

Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP):

  • allocate_view_heap cleanly scales the (kept, dynamic) split on 1M-capped NVIDIA heaps (reserving the full DYNAMIC pool on capped heaps while falling back to MIN_DYNAMIC on smaller caps) and fixes dynamic_slots_are_held_until_released on RTX 5090.
  • cargo test -p victory-gpu --lib descriptor::host::tests:: -- --test-threads=1 (RTX 5090): 16 passed, 0 failed (including dynamic_slots_are_held_until_released and view_heap_allocation_scales_on_capped_hosts).
  • VICTORY_FORCE_WARP=1 cargo test -p victory-gpu --lib descriptor::host::tests:: -- --test-threads=1 (WARP): 16 passed, 0 failed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 16:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3300#pullrequestreview-6077823637) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP): - `allocate_view_heap` cleanly scales the `(kept, dynamic)` split on 1M-capped NVIDIA heaps (reserving the full `DYNAMIC` pool on capped heaps while falling back to `MIN_DYNAMIC` on smaller caps) and fixes `dynamic_slots_are_held_until_released` on RTX 5090. - `cargo test -p victory-gpu --lib descriptor::host::tests:: -- --test-threads=1` (RTX 5090): 16 passed, 0 failed (including `dynamic_slots_are_held_until_released` and `view_heap_allocation_scales_on_capped_hosts`). - `VICTORY_FORCE_WARP=1 cargo test -p victory-gpu --lib descriptor::host::tests:: -- --test-threads=1` (WARP): 16 passed, 0 failed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠upipibi on GitHub · 2026-11-26 17:52 UTC · original

Verified #3300 at 01f91fea96 on Ampere: RTX 3070 8 GB, driver 616.56, Windows 11, rustc 1.98.1. main 63bcca43 as control, each tree in its own target dir, --locked, --test-threads=1. Synthetic tests only.

test main PR
memory:: x3 7 passed, 1 failed (x3) 7 passed, 1 failed (x3)
view_heap_allocation_scales_on_capped_hosts x5 not on main (0 run) 5/5 pass
dynamic_slots_are_held_until_released x5 0/5 (HEAP_VIEWS assert, host.rs:2234) 5/5 pass
cargo test -p victory-gpu --lib 229 passed, 2 failed, 1 ignored 231 passed, 1 failed, 1 ignored

So the PR fixes dynamic_slots_are_held_until_released on this card. The remaining failure is memory::tests::lists_share_a_table_and_copies_keep_their_views ("past the dynamic slots", memory.rs:1030), identical on main (#3178, #1744). No nvlddmkm resets.

AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).

**@⁠upipibi** on GitHub · 2026-11-26 17:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/3300#issuecomment-7199783321) Verified #3300 at 01f91fea96de7c6fe47d5dd9f302e51a2403cac7 on Ampere: RTX 3070 8 GB, driver 616.56, Windows 11, rustc 1.98.1. main 63bcca43 as control, each tree in its own target dir, `--locked`, `--test-threads=1`. Synthetic tests only. | test | main | PR | |---|---|---| | `memory::` x3 | 7 passed, 1 failed (x3) | 7 passed, 1 failed (x3) | | `view_heap_allocation_scales_on_capped_hosts` x5 | not on main (0 run) | 5/5 pass | | `dynamic_slots_are_held_until_released` x5 | 0/5 (HEAP_VIEWS assert, host.rs:2234) | 5/5 pass | | `cargo test -p victory-gpu --lib` | 229 passed, 2 failed, 1 ignored | 231 passed, 1 failed, 1 ignored | So the PR fixes `dynamic_slots_are_held_until_released` on this card. The remaining failure is `memory::tests::lists_share_a_table_and_copies_keep_their_views` ("past the dynamic slots", memory.rs:1030), identical on main (#3178, #1744). No nvlddmkm resets. AI-assisted (Claude Code, Claude Sonnet 5.5 ran the tests; Claude Opus 5.5 checked and posted).
Author
Owner

@⁠borosf on GitHub · 2026-11-26 19:03 UTC · original

Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head 01f91fe:

cargo test -p victory-gpu --lib --locked --no-fail-fast -- --test-threads=1
cargo clippy -p victory-gpu --all-targets --locked -- -D warnings
cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings

Result: victory-gpu lib: 231 passed / 1 failed (memory::tests::lists_share_a_table_and_copies_keep_their_views, known baseline). Notably descriptor::host::tests::dynamic_slots_are_held_until_released now PASSES on this B580 with the PR in, and the new view_heap_allocation_scales_on_capped_hosts test passes too.

Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. This PR appears to fix one of the two #1744/#1829 heap-cap failures on capped (1,000,000-view) Intel heaps.

Synthetic tests only; no game data used. Full log kept locally. — borosf

**@⁠borosf** on GitHub · 2026-11-26 19:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/3300#issuecomment-7201151753) Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head `01f91fe`: ``` cargo test -p victory-gpu --lib --locked --no-fail-fast -- --test-threads=1 cargo clippy -p victory-gpu --all-targets --locked -- -D warnings cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings ``` Result: victory-gpu lib: 231 passed / 1 failed (memory::tests::lists_share_a_table_and_copies_keep_their_views, known baseline). Notably descriptor::host::tests::dynamic_slots_are_held_until_released now PASSES on this B580 with the PR in, and the new view_heap_allocation_scales_on_capped_hosts test passes too. Both clippy runs exit 0 (-D warnings, both feature sets). The B580 baseline failures pristine main also hits are: victory-gpu descriptor::host::tests::dynamic_slots_are_held_until_released + memory::tests::lists_share_a_table_and_copies_keep_their_views (#1744/#1829); victory-shader emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros + emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products. This PR appears to fix one of the two #1744/#1829 heap-cap failures on capped (1,000,000-view) Intel heaps. Synthetic tests only; no game data used. Full log kept locally. — borosf
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3300/head:github-bot/gh-3300'
git switch 'github-bot/gh-3300'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3300'
git switch 'github-bot/gh-3300'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3300'
git switch 'github-bot/gh-3300'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3300'
git switch 'main'
git merge --squash 'github-bot/gh-3300'
git switch 'main'
git merge --ff-only 'github-bot/gh-3300'
git switch 'main'
git merge 'github-bot/gh-3300'
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/Marvisak--VIctory!3300
No description provided.