Skip to content

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

Open
notquiteog wants to merge 1 commit into
DexNom:mainfrom
notquiteog:pr-dx-capped-split
Open

notquiteog wants to merge 1 commit into
DexNom:mainfrom
notquiteog:pr-dx-capped-split

Conversation

@notquiteog

Copy link
Copy Markdown

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 pool starts whole: on a capped heap nothing lies between the dynamic slots and the null slot, so there is nothing for HostHeap::dynamic to grow into later (dynamic = null - count equals the split).
  • 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, +61 −0.

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.
  • material_demand.rs takes host.count() as the bound of the slots it looks at. With the split that bound is 393,215 instead of 737,855 on a capped host; whether material demand in this tree reads slots between the two was not checked in a run.

🤖 Generated with Claude Code

…wer 393,215 slots; the rest are dynamic

On a host that caps view heaps at 1,000,000 (NVIDIA) the title's heap
(1,245,184 slots) kept its first 737,855 and left 262,144 dynamic slots
for the tables made afresh per draw. A frame in the open world asks for
about 200,000 and holds them until the GPU has run it: 13,000 to 60,000
tables were refused per 5 s and their draws dropped.

From slot 393,216 on the title's heap is its own ring of per-draw
tables (every 256-slot page of it held views; all 507,205 views seen
past slot 737,855 were in tables made afresh for a draw). Those are made
in dynamic slots anyway, so the host slots kept for the ring stood
unused. Such a heap now keeps the title's lower 393,215 slots and has
606,784 dynamic ones; tables reaching past the title's host slots are
made afresh, as they already were past 737,855.

VICTORY_DYNAMIC_SLOTS=<n> sets the number (at least 2^18, leaving the
title at least 2^16 slots); 262144 is the split as it was. Hosts that do
not cap, and heaps that fit, are as before.

Measured in a fork of avatarmanz/VIctory-7900XTX on an RTX 5060 Ti
(none refused, 350,000 free at the fewest); this tree was not run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Artking175

Artking175 commented Nov 26, 2026 •

Copy link
Copy Markdown

I ran the split unit test and a local hardware fixture against a031353 on RTX 2060, Windows 10, driver 531.41, and Agility 1.614.1. The fixture actually created the 1,000,000-descriptor D3D12 heap for a 1,245,184-slot title heap. The default retained 393,215 title slots and allocated all 606,784 dynamic slots in contiguous requests. With VICTORY_DYNAMIC_SLOTS=262144, it retained 737,855 title slots and exhausted the dynamic pool at 262,144 as expected. The null slot was 999,999 in both runs.

One distinction matters before making this the default on capped cards. A direct heap index in 393,215–737,854 now names the dynamic region. Shader::heap_handle clamps at 999,999, so an index in that interval can read a descriptor belonging to a live table, even though the original title view was omitted. The remapping path for table-relative bindings is separate. I would keep the larger split opt-in until an index-picked material capture covers that interval, or add a bound specifically for title-indexed accesses. This was an allocator test and source review.

I tested an opt-in version on the same RTX 2060. With no override it kept 737,855 title slots and 262,144 dynamic slots. Setting VICTORY_DYNAMIC_SLOTS=606784 kept 393,215 title slots and exercised the full expanded pool. The unit test and both native heap cases passed.

@Artking175

Copy link
Copy Markdown

I followed up on the displaced-range question in the RTX 2060 prologue. A RayTime release binary with the #49 probe and the opt-in split above ran at 262,144 and 606,784 dynamic slots, with material demand off in both. Both saw the one-million-descriptor host limit and reached the scene near the window with very dark clothing. Across those captures and a material-demand variant on the smaller split, the probe returned 26 GPU material records from a402e650d0acbc92. The 40 distinct title indices were in 1–104,981. This sample did not exercise the displaced 393,215–737,854 interval.

I'd keep the larger split opt-in and add an actual shader-read fixture for the boundary before changing the default. In a capped heap, place a known SRV in the first dynamic slot. Verify that a title-originated direct index of 393,214 still reads its title SRV and that 393,215 resolves to the null SRV, while an internal dynamic reference to the physical slot still reads the known value. Check the same title index against the old split as a control. That exercises the difference between a retained title range and a physical host heap limit without changing table-relative remapping.

@Artking175

Copy link
Copy Markdown

I opened a follow-up against the branch used here: notquiteog#1

The wide split remains opt-in. A one-million-slot D3D12 fixture on RTX 2060 verified reads at 393214 and 393215 for both retained counts, including the separate internal read of the live dynamic descriptor. The bound covers direct float-readable Texture2D SRVs, matching the permanent null descriptor. Both deferred material shaders still validated and created PSOs with the cap enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants