GPU: fresh tables are sized by their entries, and a capped heap keeps 2^18 dynamic slots #3870
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3870"
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 omarsaifuddin on 2026-11-30T04:01:17Z.
Stacked on #3518 (base
df88467). The change is the last two commits; the rest of the diff is #3518's branch.What
Two things in #3518's capped path cost it most of the world's draws on an NVIDIA card (measurements in #3518, RTX 3070 Ti):
1. A fresh table is sized by the shader register, not by its entries.
UsedResource::lower_boundis the register of the first descriptor the program reads, not a count. #3518 sizes a fresh table withtable_offset_dwords / 8 + lower_bound.max(1), and its "reaches past the host heap" check allowslower_bound - 1extra entries. Over 80,000 fresh tables that took 8,579,260 dynamic slots for 361,283 entries, about 24x too many; the pool was exhausted (used=261,117 of 261,120) and most dropped draws wereno dynamic slots for its tables.This sizes a table by
table_offset_dwords / 8 + 1, main's rule, and checks the last used entry.Heap::total_countexisted only for the old.min(avail)clamp and goes with it: the clamp mixed the title's descriptor count with a host physical index, and could truncate a valid table.2. The capped dynamic pool is 64,512. 2^16 ran out seconds into the world and 2^17 in the opening cutscene on capped NVIDIA hosts, where a frame asks for up to 16,000 tables while the previous frame still holds its own. A capped heap now takes
DYNAMIC(2^18): 410,176 direct + 327,680 overflow + 261,120 dynamic, which isPORTABLE_VIEWSwithNULL_RESERVEkept free. That leaves 737,856 simultaneously usable title slots, above the ~720,000 the title has been seen to use, while keeping #3518's overflow remap for active slots above the direct range.Credits
The dynamic-budget idea is not new here:
[first_used, last_used];DYNAMICon a capped heap, and #3860 repeats it;All are on main's layout, where a capped heap is
(737,856 direct, 262,144 dynamic). This is the #3518-specific form: #3518 carves an overflow pool, so its split has three parts, and its fresh-table size is a separate bug (lower_bound), which none of the above touches.Verified (RTX 3070 Ti, Windows 11)
victory-gpu --lib: 233 passed, 0 failed, 1 ignored; with--all-features: 248 passed, 0 failed, 1 ignored.PORTABLE_VIEWS.victory-shader --lib: 299 passed, 3 failed (the #3445 trio, the same on #3518 and on main), 3 ignored.lower_bound = 278sizes 2, not 279.Not verified in-game from this branch; it reproduces the edits that ran 15-38 minutes on the card in #3518's thread.
ROOT_VIEW_RUN = 16from those experiments is left out (not isolated).Imported from Marvisak/VIctory. Originally posted by omarsaifuddin on 2026-11-30T07:37:37Z.
Run evidence from the RTX 3070 Ti for the capped path, 1440p, full stack (#3330's stack plus the atomic PR):
No change requested here: the split is the best best-effort the 1M cap allows, and the warning did not remove the device in these runs. A
VICTORY_LOG=victory_gpu::descriptor::host=inforun would print the live high-slot peak if the review wants the number.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.