GPU: a title heap a capped host heap does not hold whole keeps its lower 393,215 slots; the rest are dynamic #1255

Open
notquiteog wants to merge 1 commit from upstream-pr/1258 into main
notquiteog commented 2026-11-26 03:50:27 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by notquiteog on 2026-11-26T03:50:27Z.


Problem

On a host that caps the shader-visible CBV/SRV/UAV heap at exactly 1,000,000 views (NVIDIA), the host heap cannot hold the title's heap (1,245,184 slots) plus the dynamic slots. HostHeap::new (crates/victory-gpu/src/descriptor/host.rs) then gives the title's first 737,855 slots a host slot and leaves DYNAMIC = 262,144 dynamic slots for the tables made afresh per draw (draw.rs, tables(): every table that holds a constant buffer, and every table reaching past the host heap's title slots).

In the open world a frame asks for about 200,000 dynamic slots and holds them until the GPU has run it. 262,144 ran dry: tables were refused (no free dynamic descriptor slots: a table is not made) and their draws dropped, seen as flicker and vegetation popping in and out.

Measurement

Not measured on this tree. Measured on notquiteog/victory-nvidia, a tree based on avatarmanz/VIctory-7900XTX, where the capped heap is laid out the same way (title slots, then DYNAMIC dynamic slots, then the null slot at 999,999). RTX 5060 Ti 16 GB, i5-13600K, 32 GB RAM, Windows 11, open-world free roam.

Before (737,855 title slots, 262,144 dynamic):

  • 13,000 to 60,000 tables refused per 5 s, each a dropped draw

Which title slots ever hold a view, counted by 256-slot page and by band of 131,072 slots (512 pages a band). Pages used per band, from slot 0:

  • 512, 22, 179, then 512 (every page) for every band from slot 393,216 up
  • all 507,205 views seen past slot 737,855 were in tables made afresh for a draw; none was a view that only a shader picking by index reads

So from slot 393,216 on the title's heap is its own ring of per-draw tables. Those tables are copied into dynamic slots anyway, so the host slots reserved for the ring were not used.

After (393,215 title slots, 606,784 dynamic):

  • 0 tables refused
  • 350,000 dynamic slots free at the fewest
  • 0 index-picked views left without a host slot
  • about 40,000 more small tables per 5 s made afresh because they reach past the title's host slots (about 120,000 slots per 5 s, a few percent of what the pool hands out)

Change

  • A title heap that does not fit, with DYNAMIC more, in a host heap capped below PORTABLE_VIEWS keeps its lower 393,215 slots; the rest up to the null slot (606,784) are dynamic (capped_dynamic_slots).
  • VICTORY_DYNAMIC_SLOTS=<n> sets the number of dynamic slots for such a heap: at least 262,144, and leaving the title at least 65,536 slots. This tree had no such variable; it is read only for such a heap.
  • The dynamic slots' bookkeeping follows the heap's own number: the taken-slot list, the free count, the search bound and the cursor's wrap in HostHeap::dynamic used the constant DYNAMIC, which would have left the added slots unused.
  • Title slots past the ones kept have no host slot. A table reaching there is made afresh for its draw, which is the path tables past slot 737,855 already took (index >= host.count() in tables()); nothing new is needed for them.
  • Not changed: hosts that do not cap (AMD), and heaps that fit in a capped host heap with DYNAMIC more. draw.rs still refuses a fresh table of more than DYNAMIC slots; that is a limit on one table, not on the pool.
  • One unit test of the split.

One file, +68 −5.

Switch

VICTORY_DYNAMIC_SLOTS=262144 restores the split as it was (737,855 title slots, 262,144 dynamic).

Not tested

  • This tree was not run in game. The branch passes cargo check --locked -p victory-gpu, with and without --features diagnostics, and with --tests; the unit test itself was not run. The numbers above are from the fork named under Measurement.
  • One NVIDIA card only (RTX 5060 Ti 16 GB). No other NVIDIA card or driver, and open-world free roam only; cutscenes and interiors were not measured separately.
  • Not tested on AMD. A host that takes more than 1,000,000 views does not reach the changed code.
  • 393,215 is where the ring began in that play. A build or scene of the title that keeps long-lived, index-picked views above it would lose them (they would read the null view); the measurement found none.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6619098240 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1258). Originally posted by [notquiteog](https://github.com/notquiteog) on 2026-11-26T03:50:27Z. --- ## Problem On a host that caps the shader-visible CBV/SRV/UAV heap at exactly 1,000,000 views (NVIDIA), the host heap cannot hold the title's heap (1,245,184 slots) plus the dynamic slots. `HostHeap::new` (`crates/victory-gpu/src/descriptor/host.rs`) then gives the title's first 737,855 slots a host slot and leaves `DYNAMIC` = 262,144 dynamic slots for the tables made afresh per draw (`draw.rs`, `tables()`: every table that holds a constant buffer, and every table reaching past the host heap's title slots). In the open world a frame asks for about 200,000 dynamic slots and holds them until the GPU has run it. 262,144 ran dry: tables were refused (`no free dynamic descriptor slots: a table is not made`) and their draws dropped, seen as flicker and vegetation popping in and out. ## Measurement Not measured on this tree. Measured on notquiteog/victory-nvidia, a tree based on avatarmanz/VIctory-7900XTX, where the capped heap is laid out the same way (title slots, then `DYNAMIC` dynamic slots, then the null slot at 999,999). RTX 5060 Ti 16 GB, i5-13600K, 32 GB RAM, Windows 11, open-world free roam. Before (737,855 title slots, 262,144 dynamic): - 13,000 to 60,000 tables refused per 5 s, each a dropped draw Which title slots ever hold a view, counted by 256-slot page and by band of 131,072 slots (512 pages a band). Pages used per band, from slot 0: - 512, 22, 179, then 512 (every page) for every band from slot 393,216 up - all 507,205 views seen past slot 737,855 were in tables made afresh for a draw; none was a view that only a shader picking by index reads So from slot 393,216 on the title's heap is its own ring of per-draw tables. Those tables are copied into dynamic slots anyway, so the host slots reserved for the ring were not used. After (393,215 title slots, 606,784 dynamic): - 0 tables refused - 350,000 dynamic slots free at the fewest - 0 index-picked views left without a host slot - about 40,000 more small tables per 5 s made afresh because they reach past the title's host slots (about 120,000 slots per 5 s, a few percent of what the pool hands out) ## Change - A title heap that does not fit, with `DYNAMIC` more, in a host heap capped below `PORTABLE_VIEWS` keeps its lower 393,215 slots; the rest up to the null slot (606,784) are dynamic (`capped_dynamic_slots`). - `VICTORY_DYNAMIC_SLOTS=<n>` sets the number of dynamic slots for such a heap: at least 262,144, and leaving the title at least 65,536 slots. This tree had no such variable; it is read only for such a heap. - The dynamic slots' bookkeeping follows the heap's own number: the taken-slot list, the free count, the search bound and the cursor's wrap in `HostHeap::dynamic` used the constant `DYNAMIC`, which would have left the added slots unused. - Title slots past the ones kept have no host slot. A table reaching there is made afresh for its draw, which is the path tables past slot 737,855 already took (`index >= host.count()` in `tables()`); nothing new is needed for them. - Not changed: hosts that do not cap (AMD), and heaps that fit in a capped host heap with `DYNAMIC` more. `draw.rs` still refuses a fresh table of more than `DYNAMIC` slots; that is a limit on one table, not on the pool. - One unit test of the split. One file, +68 −5. ## Switch `VICTORY_DYNAMIC_SLOTS=262144` restores the split as it was (737,855 title slots, 262,144 dynamic). ## Not tested - This tree was not run in game. The branch passes `cargo check --locked -p victory-gpu`, with and without `--features diagnostics`, and with `--tests`; the unit test itself was not run. The numbers above are from the fork named under Measurement. - One NVIDIA card only (RTX 5060 Ti 16 GB). No other NVIDIA card or driver, and open-world free roam only; cutscenes and interiors were not measured separately. - Not tested on AMD. A host that takes more than 1,000,000 views does not reach the changed code. - 393,215 is where the ring began in that play. A build or scene of the title that keeps long-lived, index-picked views above it would lose them (they would read the null view); the measurement found none. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
EgoraWyn commented 2026-11-26 15:04:09 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by EgoraWyn on 2026-11-26T14:57:06Z.


Data point from a different approach to the same 1,000,000-view cap. This is a port of ScarlettPort's "VIcky" heap map onto a cool_fox-based branch:

  • Title slots below an identity window (131,072) keep their own index.
  • Each title slot past the window that holds a view takes a slot from a 606,782-slot pool.
  • Translated shaders look up resource-heap indices past the window in a per-title-slot map.

Results on an RTX 3060 Laptop 6 GB (Windows 11), warm caches, 120 s window after the first frame with ≥1000 draws, one run each:

median ms p90 ms fps draws
heap map on 181.7 410 5.5 4,546
heap map off 177.0 401 5.65 4,544
  • With the map on, host view heap capped at 1000000; views past it read a null slot count=1245184 no longer appears. No pool slots were refused and nothing crashed.
  • Frame time is unchanged within noise. n=1 per side, so treat that as a rough check only.
  • The map changes shader translation, so the shader cache (and the pipeline warm) has to be rebuilt for it. Before we did that, our first A/B looked about 2x slower than it really is.
  • No visual comparison yet.

Happy to share the diff if it's useful as a cross-check.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7195567221 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1258#issuecomment-7195567221). Originally posted by [EgoraWyn](https://github.com/EgoraWyn) on 2026-11-26T14:57:06Z. --- Data point from a different approach to the same 1,000,000-view cap. This is a port of ScarlettPort's "VIcky" heap map onto a cool_fox-based branch: - Title slots below an identity window (131,072) keep their own index. - Each title slot past the window that holds a view takes a slot from a 606,782-slot pool. - Translated shaders look up resource-heap indices past the window in a per-title-slot map. Results on an RTX 3060 Laptop 6 GB (Windows 11), warm caches, 120 s window after the first frame with ≥1000 draws, one run each: | | median ms | p90 ms | fps | draws | |---|---|---|---|---| | heap map on | 181.7 | 410 | 5.5 | 4,546 | | heap map off | 177.0 | 401 | 5.65 | 4,544 | - With the map on, `host view heap capped at 1000000; views past it read a null slot count=1245184` no longer appears. No pool slots were refused and nothing crashed. - Frame time is unchanged within noise. n=1 per side, so treat that as a rough check only. - The map changes shader translation, so the shader cache (and the pipeline warm) has to be rebuilt for it. Before we did that, our first A/B looked about 2x slower than it really is. - No visual comparison yet. Happy to share the diff if it's useful as a cross-check.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1258:upstream-pr/1258'
git switch 'upstream-pr/1258'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/1258'
git switch 'upstream-pr/1258'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1258'
git switch 'upstream-pr/1258'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1258'
git switch 'main'
git merge --squash 'upstream-pr/1258'
git switch 'main'
git merge --ff-only 'upstream-pr/1258'
git switch 'main'
git merge 'upstream-pr/1258'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1255
No description provided.