GPU: a capped view heap keeps room for its page table's view pairs #3120
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3122"
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 Indy2l on 2026-11-26T09:05:12Z.
What
On hosts that cap shader-visible view heaps below
HEAP_VIEWS(NVIDIA: 1,000,000),HostHeap::newmade the heap exactlycount + MIN_DYNAMICslots.HostHeap::pairthen had no range of its own (pairs_end == count + dynamic), so every page-table view pair fell back toself.dynamic(2)and drained the per-draw dynamic pool. When that pool runs out, tables are refused and draws are dropped.lists_share_a_table_and_copies_keep_their_viewsalready guards against this ("none takes a per-draw dynamic slot"). On an RTX 3060 its pairs came back as slots 2 and 4, which are dynamic slots.Change
CAPPED_PAIRSslots past its dynamic range, as an uncapped heap has betweencount + DYNAMICandHEAP_VIEWS. The overflow branch (title count pastPORTABLE_VIEWS) takes that reservation from the title's kept-in-place slots.dynamic_slots_are_held_until_releasedaccepts the capped layout and checks that the pair room exists.address_slots()instead of a hard-coded1 << 18.VICTORY_DYNAMIC_SLOTS(from the first revision) is split out, per review, to come back in its own PR with measurements from this repo.Testing
cargo test -p victory-gpu --lib --locked: 231 passed. On main, 2 victory-gpu tests fail on this card.cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings: clean.cargo xtask policy: clean.Refs #1744.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T09:07:56Z.
Review: APPROVED
Verified on RTX 5090 (1M view-heap cap) & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib descriptor::host:: -- --test-threads=1: 15/15 passed on RTX 5090 (includingdynamic_slots_are_held_until_released, which fails on cleanorigin/mainunder#1744).cargo test -p victory-gpu --lib memory:: -- --test-threads=1: 8/8 passed on RTX 5090 and WARP (includinglists_share_a_table_and_copies_keep_their_views, also previously failing on RTX 5090 under#1744).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly reserves room for the page table's view pairs on capped 1M view heaps (NVIDIA).
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T09:27:35Z.
Review: APPROVED
Clean, well-scoped fix for NVIDIA's 1,000,000-descriptor view-heap cap.
Reviewed
crates/victory-gpu/src/descriptor/host.rsandcrates/victory-gpu/src/memory.rs:count + MIN_DYNAMIC + CAPPED_PAIRS <= PORTABLE_VIEWS) allocateCAPPED_PAIRS(65,536) slots past[count, count + MIN_DYNAMIC), soHostHeap::pairstops falling back toself.dynamic(2)and draining per-draw dynamic slots.VICTORY_DYNAMIC_SLOTSto[MIN_DYNAMIC, PORTABLE_VIEWS / 2 - CAPPED_PAIRS]([65_536, 434_464]), preserving at least 500,000 in-place title slots plus 65,536 pair slots with no underflow.(count + DYNAMIC).max(HEAP_VIEWS)path unchanged.memory.rsto assert>= views.address_slots()validates the real invariant (pairs live past dynamic slots) across both capped and uncapped layouts.Verified locally on Windows 11 with a 1M-capped RTX 5090 and WARP:
cargo clippy --workspace --all-targets [--all-features] -- -D warnings: cleancargo xtask policy:191 files okdescriptor::host::tests::15/15 passed (dynamic_slots_are_held_until_releasednow passes) andmemory::tests::8/8 passed (lists_share_a_table_and_copies_keep_their_viewsnow passes)VICTORY_D3D12_DEBUG=1: both previously failing tests pass with zero debug layer errorsVICTORY_DYNAMIC_SLOTS=0,524288,999999999:dynamic_slots_are_held_until_releasedpasses in all cases--features diagnostics,VICTORY_D3D12_WARP=1) +VICTORY_D3D12_DEBUG=1:descriptor::host::tests::15/15 passed,memory::tests::8/8 passedTwo minor non-blocking notes:
count + MIN_DYNAMIC + CAPPED_PAIRSatdescriptor/host.rs:180,182(like the existingcount + DYNAMICat line 175) uses uncheckedu32addition; usingsaturating_addwould guard against a wild title descriptor count.VICTORY_DYNAMIC_SLOTScould be documented alongside the otherVICTORY_*environment variables if desired.LGTM.
Imported from Marvisak/VIctory. Originally posted by Indy2l on 2026-11-26T09:14:00Z.
Refs #1744. This should cover the failures there that come from the 1,000,000 view heap cap:
dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_viewspass on an RTX 3060 here and on an RTX 5090 per the review above. I haven't confirmed the other two failures in that report; if the reporter can re-runcargo test -p victory-gpu --libon this branch, that would settle it.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T09:20:41Z.
Automated triage for the maintainers.
Needs work: please split it. The core fix is right. On a capped heap
pairs_end == count + dynamic, soHostHeap::pairalways fell back toself.dynamic(2). ReservingCAPPED_PAIRSpast the dynamic range inHostHeap::new(crates/victory-gpu/src/descriptor/host.rs) fixes that, and the updatedaddress_slots()assertion inmemory.rsis good. Before merge:capped_dynamic/VICTORY_DYNAMIC_SLOTSto their own PR. It is a separate behaviour change with no test. It can take up to about half the heap from the title's kept-in-place slots, and its comment cites numbers from another fork. It can come back with measurements from this repo.let asked = ...line.A PR with only the pair reservation, sized with a stated reason, would be a merge candidate. This does not overlap #3119.
CI:
checkpassing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Indy2l on 2026-11-26T09:32:50Z.
Thanks for the review. Addressed in
69618cf:capped_dynamic/VICTORY_DYNAMIC_SLOTSremoved from this PR. I'll bring it back separately with in-world measurements from this repo.CAPPED_PAIRSis now 2^14, with the reason beside the constant: about 4,700 world copies take about 9,400 pair slots, so 2^14 gives about 1.7x headroom while taking fewer title slots in the overflow branch. Pairs past it still fall back to dynamic slots.cargo test -p victory-gpu --lib(231 passed), both clippy configurations andcargo xtask policyare clean on an RTX 3060. The PR description is updated to match.Imported from Marvisak/VIctory. Originally posted by Indy2l on 2026-11-27T11:52:55Z.
Could this get a re-review when someone has time? The triage points are addressed in
69618cf: theVICTORY_DYNAMIC_SLOTSknob is split out,CAPPED_PAIRSis 2^14 with the reason beside the constant, and the long line went with the knob. CI passes, it merges cleanly, and it has been confirmed on RTX 3060 and RTX 5090 since.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.