GPU: Graceful degradation and dynamic recycling for descriptor heaps exceeding 1,000,000 slots #2187
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2189"
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 Xvania7 on 2026-11-25T07:21:22Z.
Fixes #887 (supersedes tracking issue #902; related to #871, #876, #562).
Summary
280d033+ @MichaelSmithAI's review feedback).Verification
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:02:59Z.
Review: COMMENTED
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Graceful degradation + dynamic recycling for descriptors — resource-exhaustion handling; relates to #2099's bounded view table.
Imported from Marvisak/VIctory. Originally posted by MamaLeVrai on 2026-11-25T08:52:12Z.
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head
7e1292d6intomain940d32fin a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with--all-features: clean.cargo test --workspace --locked: 704 passed, 0 failed, 10 ignored, two runs (mainalone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:28:28Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-gpu/src/descriptor/host.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs-work) was for an older state ofmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T14:16:01Z.
Addressed the triage points in (
364c675):Removed the 500k/250k loops. The cap is anchored directly to D3D12 Tier 1 limits (
D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1 = 1_000_000) enforced by NVIDIA drivers (Ampere, Ada, Blackwell). KeepingPORTABLE_VIEWS = 1_000_000preserves the invariant that translated shaders can safely clamp belowHEAP_VIEWS.Restored
return Noneon plain allocation failure (Err(e)whencount + MIN_DYNAMIC <= PORTABLE_VIEWS), avoiding retrying larger heaps when the device ran out of memory.Updated
heap_request_over_one_million_caps_gracefullyto assert both the zero-tag fallback and theVIEW_TAGbranch without host heap indexing.All checks pass cleanly: unit tests 148 passed, Clippy 0 warnings, asset policy ok.
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-26T19:54:47Z.
Rebased cleanly onto latest
main(63bcca4):crates/victory-gpu/src/descriptor/host.rsandcrates/victory-gpu/src/draw.rs(integrated with placed texture view tests).dynamic_slots_are_held_until_released(num >= HEAP_VIEWS || num >= MIN_DYNAMIC).cargo test -p victory-gpu --lib -- dynamic_,heap_request_over_one_million_caps_gracefully, andexhausted_heap_keeps_existing_descriptor_tables_reserved).-D warnings),cargo xtask policy191 files clean.Imported from Marvisak/VIctory. Originally posted by kalberts0089-hash on 2026-11-27T10:46:52Z.
Test report on NVIDIA Ada hardware: RTX 4070 Ti, driver 621.01, Windows 11.
Tested: head
0ff9d5f(base63bcca4, which is currentmain, so nothing was merged locally). Compared withmain63bcca4on the same machine.Confirmed
cargo test -p victory-gpu --lib -- --test-threads=1main63bcca40ff9d5f--exact --nocapture:heap_request_over_one_million_caps_gracefully,dynamic_cursor_wraparound_finds_contiguous_span,exhausted_heap_keeps_existing_descriptor_tables_reserved.count934,464 +dynamic65,536), soexhausted_heap_keeps_existing_descriptor_tables_reserveddoes not take its early return.dynamic_slots_are_held_until_released: fails onmain, passes on this head.lists_share_a_table_and_copies_keep_their_views: fails onmainand on this head, same assertion (memory.rs:1030, "past the dynamic slots"). Unchanged by this PR.cargo test -p victory-shader --lib --no-fail-fast -- --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index: 298 passed, 3 failed, 3 ignored on bothmainand this head. The three are the known NVIDIA failures and are unrelated to this PR (it does not touchvictory-shader):a_heap_buffer_read_by_element_takes_the_views_stride,a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,gathers_at_a_level_match_the_hardware.heap_direct_texture_reads_mark_their_heap_indexwas skipped because it crashes the test process on this card (#2571).Why
dynamic_slots_are_held_until_releasednow passesAs a fact about the diff: the heap code that test exercises is unchanged; its first assertion changed from
NumDescriptors >= HEAP_VIEWStonum >= HEAP_VIEWS || num >= MIN_DYNAMIC. On this card the values arenum= 65,540,HEAP_VIEWS= 2,097,152,MIN_DYNAMIC= 65,536.Local check (uncommitted edit, discarded afterwards): with only that assertion put back to the
mainform on this head, the test fails exactly as onmain.Local check of the new tests against the
mirrorchangeThe diff against
mainhas one behavioural change outside tests, as far as I can read it:HostHeap::mirrorreturns the title's view forindex >= self.countinstead ofNone. The cap branch inHostHeap::newis the same expression split over two lines, and thedraw.rschange outside tests is a comment.Local check (uncommitted edit, discarded afterwards): with that
mirrorhunk put back toreturn None;, all three new tests still pass on this card.Questions
MIN_DYNAMICdynamic slots, so cannum >= MIN_DYNAMICever be false? If not, is it intended that the test no longer checks anything about heap size on a capped host, given the comment above it still says every index a translated shader can reach exists?Some(view)return frommirrorpast the cap? TheVIEW_TAGcase inheap_request_over_one_million_caps_gracefullyuses generation 0, which givesNonebefore and after the change.63bcca4does not changedynamicorrelease, and the capped heap measured here has 65,536 dynamic slots.Not tested
mirrorpast the cap helps or harms a real frame.Some(view)path ofmirrorforindex >= countwas not exercised by any test I ran.cargo xtask policyand the other crates were not run.Synthetic tests only, no game files. AI-assisted (Claude Code).
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.