GPU: a capped view heap keeps room for its page table's view pairs #3122
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3122
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Indy2l on GitHub · 2026-11-26 09:05 UTC · original
Indy2l:gpu/capped-view-heap→main· +26 −7 · 2 files · 2 commits · openWhat
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
@Dukestar69 on GitHub · 2026-11-26 09:07 UTC · original · approved these changes
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).
@Indy2l on GitHub · 2026-11-26 09:14 UTC · original
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.@Marvisak on GitHub · 2026-11-26 09:20 UTC · original
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
@fuzeofficlal on GitHub · 2026-11-26 09:27 UTC · original · approved these changes
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.
@Indy2l on GitHub · 2026-11-26 09:32 UTC · original
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.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.