gpu: scale dynamic descriptor pool on capped heaps (NVIDIA) #3300
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3300"
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?
Imported from Marvisak/VIctory. Originally posted by AdvaitPalve11 on 2026-11-26T16:24:24Z.
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.
Imported from Marvisak/VIctory. Originally posted by HLVM04 on 2026-11-26T16:26:34Z.
A hardware data point for the capped-heap sizes here, from the fork (fxceless/victory-fork), not
mainor this PR:PORTABLE_VIEWS.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.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T16:49:38Z.
Review: APPROVED
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090 + WARP):
allocate_view_heapcleanly scales the(kept, dynamic)split on 1M-capped NVIDIA heaps (reserving the fullDYNAMICpool on capped heaps while falling back toMIN_DYNAMICon smaller caps) and fixesdynamic_slots_are_held_until_releasedon RTX 5090.cargo test -p victory-gpu --lib descriptor::host::tests:: -- --test-threads=1(RTX 5090): 16 passed, 0 failed (includingdynamic_slots_are_held_until_releasedandview_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).
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-26T17:52:00Z.
Verified #3300 at
01f91fea96on Ampere: RTX 3070 8 GB, driver 616.56, Windows 11, rustc 1.98.1. main63bcca43as control for the shared tests (view_heap_allocation_scales_on_capped_hostsis added by this PR, so it ran on the PR head only), each tree in its own target dir,--locked,--test-threads=1. Synthetic tests only.memory::x3view_heap_allocation_scales_on_capped_hostsx5dynamic_slots_are_held_until_releasedx5cargo test -p victory-gpu --libSo the PR fixes
dynamic_slots_are_held_until_releasedon this card. The remaining failure ismemory::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).
Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-26T19:03:38Z.
Independent local verification on Windows 11 x64, Intel Arc B580 12 GB (12 cores), at this PR's head
01f91fe: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
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T20:24:32Z.
Review: APPROVED
Verified locally merged onto
origin/main(63bcca43) at PR head01f91feaacross three real adapters on Windows 11 x64 (VICTORY_D3D12_DEBUG=1,--features diagnostics):crates/victory-gpu/src/descriptor/host.rs(allocate_view_heapL109-L140,HostHeap::newL184-L206,dynamic_slots_are_held_until_releasedL2264-L2285):checked_add/saturating_add) tryingmax(count + DYNAMIC, HEAP_VIEWS)->count + DYNAMIC->PORTABLE_VIEWS(preserving the fullDYNAMIC= 262,144 pool and keeping up to 737,856 title slots) ->count + MIN_DYNAMIC.descriptor::host::tests::dynamic_slots_are_held_until_releasedon 1M-capped NVIDIA hardware while keeping fullHEAP_VIEWSchecks on uncapped adapters.cargo xtask policy: 191 files ok.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features): 0 warnings.cargo test --locked -p victory-gpu --features diagnostics --lib -- descriptor::host::tests:: --test-threads=1:VICTORY_D3D12_DEBUG=1): 16/16 passed (1.92s, includingdynamic_slots_are_held_until_releasedandview_heap_allocation_scales_on_capped_hosts).VICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1): 16/16 passed (3.87s).allocate_view_heapdirectly against realCreateDescriptorHeapcalls on every adapter:0x10de, Tier 3, 1M cap):count=4->(262148, 4, 262144),500k->(762144, 500000, 262144),800k->(1000000, 737856, 262144),1M->(1000000, 737856, 262144).0x1002, Tier 3): all four sizes stay uncapped at(2097152, count, 262144).0x1414, Tier 3): all four sizes stay uncapped at(2097152, count, 262144).count = 0, exact737_856/737_857boundary,u32::MAX,100_000tiny-cap fallback, and full 262,144-slot exhaustion/release/reuse on a live RTX 5090HostHeap::new(false, 4).memory::tests::lists_share_a_table_and_copies_keep_their_viewsstill passes on WARP and fails atmemory.rs:1030on RTX 5090 identically tomain(separate baseline issue).CAPPED_DYNAMIC (2^17 = 131,072), while the code at01f91feareserves the fullDYNAMIC(2^18 = 262,144, leaving737,856title slots) — worth syncing the PR description text.Synthetic tests only; looks ready to merge.
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-29T19:06:49Z.
In-game test of this PR (head
01f91fe) on Linux with an RTX 4070 SUPER. This is the retail title, not synthetic tests.Setup: NVIDIA 620.73.04, Wine 11.22, vkd3d-proton master (
71cae091), headless gamescope at 1920×1080. Diagnostics build ofmain63bcca4with #2723, #2118, #439, #2703, #2101, #2312, #2969, #1722, #2968, #1885, and this PR merged on top. Each run is 15 minutes from boot, with the same scripted input: boot, intro cutscene, then the prologue in the prison yard.On this driver the largest resource heap is 32 MiB of 32-byte views, about 1.04M. The title asks for 1,245,184, so the heap is capped. This PR logs:
host view heap capped below requested size requested=1245184 kept=737856 dynamic=262144main(2^16 dynamic)no dynamic slots for root viewsno free dynamic descriptor slotsTitle slots past the kept range: the title writes them once, in the first 2 seconds after the heap is made (on
mainslots 934,464–1,245,183; here 737,856–1,245,183). It did not touch them again in either run, so in this stretch nothing visible depends on views past 737,856.Limits: this covers one 15-minute stretch, up to the start of the prologue. #747 reports a longer cell-block walk that still ran out at 2^18, so scenes further in may need more.
AI-assisted (Claude Code, Claude Opus 5.5 ran the builds and game runs and wrote this comment).
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.