descriptor: place title view slots past a capped (NVIDIA) host heap through a table #638

Open
github-bot wants to merge 1 commit from github-bot/gh-638 into main AGit
Owner

@⁠chemist6913 on GitHub · 2026-11-28 02:19 UTC · original
chemist6913:fix/nvidia-view-heap-remap → main · +245 −13 · 5 files · 1 commits · open

Summary

On NVIDIA, the host's shader-visible view heap is capped at 1,000,000 descriptors. An RTX 5090 on driver 621.40 refuses 1,000,001 and every larger size. The retail game's view heap has 1,245,184 slots.

HostHeap::new therefore kept title slots 0..737,855 one to one and left the rest out. Slots 737,855..999,998 hold the dynamic tables and slot 999,999 is the null slot. Every shader-computed (bindless) view index past 737,855 read the null slot, or one of the host's own dynamic slots. Tables were fine, because draws copy those into dynamic slots. The code already said "a title that reaches them needs remapping". This PR adds that remap. Details are in #545.

How the game uses its heap: it keeps 400,000–570,000 views past slot 65,536 at once, spread over the whole heap, and turns over about 130,000 a second. Because the views are spread out, a fold (slot mod N) can't keep them apart.

Change

Host side (descriptor/host.rs, Places). On a host whose view heap is capped at PORTABLE_VIEWS, with VICTORY_VIEW_REMAP not 0:

  • Bookkeeping stays in title-slot numbers. The heap's count is now the title's full count, and dynamic slot k is index count + k, as on uncapped (AMD) hosts.
  • Only the place a descriptor is written to is mapped:
    • title slots below 65,536 stay where they are;
    • each title slot from 65,536 on takes a place from a pool of 672,318 when a descriptor is written into it;
    • dynamic slots map linearly after the pool;
    • everything else maps to the null place.
  • A slot gives its place back when it is made null (unmake, make_null, and buffer views left null to wait for a draw). Places are reused oldest-first. If the pool is ever empty, the write goes to a sink place that no index reads, and a warning is logged once.
  • cpu(index) maps through this; cpu_at(place) is the raw handle (used by fill_null); gpu_handle maps too.
  • The strides upload buffer doubles in size. Dword SLOT_STRIDES_COUNT + i holds the place of view index i, and is written when a place is given or given back.

Translator side (emit/shader.rs). With set_view_remap(true):

  • the view limit becomes SLOT_STRIDES_COUNT - 1;
  • heap_handle_at clamps the index as before, then reads its place from that dword, through SLOT_STRIDES if the shader binds it, else SLOT_TABLE_STRIDES, so the heap buffer sweep isn't started by this.
  • Samplers and raw-twin indices are unchanged.

The remap flag is part of the shader cache key (mod.rs) and of host_settings (bit 31 of the limit). victory translate --warm takes VICTORY_VIEW_REMAP=1 alongside VICTORY_VIEW_LIMIT=2097151, to warm for such a host.

Hosts that take bigger heaps (AMD) are unchanged: view_remap() stays false.

Testing

On RTX 5090, Series X profile, 1440p, opening cutscene through the diner, about 15 runs of 90–110 s.

  • Picture: unchanged, and no device removal.
  • Pool: after the world loads, at least about 106,000 places stay free while the give-back of null buffer slots is missing, and about 445,000 with it. It never ran out.
  • Rejected first attempt: an earlier version pooled only from slot 672,319 on (65,536 places). It ran out 33 s in and broke the picture, which is why the pool now starts at 65,536.
  • Builds and tests on this branch:
    • cargo check -p victory --features diagnostics: clean.
    • cargo test -p victory-gpu: 441 passed, 2 failed.
    • cargo test -p victory-shader: 287 passed, 3 failed.
    • The 5 failures fail the same way on unmodified main here: indirect::tests::host_list_budget_starts_empty_at_each_submission, indirect::tests::warp_batch_charges_every_execution, two emit::rect tests and one hardware barycentric test.
  • Ported: the code was written and run on an older base, then ported to current main. The game runs above were on that older base, not on this branch.

Not measured: frame rate. Every view-heap handle now costs one more raw-buffer load, usually uniform. A before/after on another NVIDIA card would be welcome.

Not fixed by this: the phone screen in the diner (#545). That turned out to be an exposure issue, and the findings are in the issue.

🤖 Generated with Claude Code

**@⁠chemist6913** on GitHub · 2026-11-28 02:19 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/638) `chemist6913:fix/nvidia-view-heap-remap` → `main` · +245 −13 · 5 files · 1 commits · open ## Summary On NVIDIA, the host's shader-visible view heap is capped at 1,000,000 descriptors. An RTX 5090 on driver 621.40 refuses 1,000,001 and every larger size. The retail game's view heap has 1,245,184 slots. `HostHeap::new` therefore kept title slots 0..737,855 one to one and left the rest out. Slots 737,855..999,998 hold the dynamic tables and slot 999,999 is the null slot. Every shader-computed (bindless) view index past 737,855 read the null slot, or one of the host's own dynamic slots. Tables were fine, because draws copy those into dynamic slots. The code already said "a title that reaches them needs remapping". This PR adds that remap. Details are in #545. **How the game uses its heap:** it keeps 400,000–570,000 views past slot 65,536 at once, spread over the whole heap, and turns over about 130,000 a second. Because the views are spread out, a fold (slot mod N) can't keep them apart. ## Change **Host side (`descriptor/host.rs`, `Places`).** On a host whose view heap is capped at `PORTABLE_VIEWS`, with `VICTORY_VIEW_REMAP` not `0`: - Bookkeeping stays in title-slot numbers. The heap's `count` is now the title's full count, and dynamic slot `k` is index `count + k`, as on uncapped (AMD) hosts. - Only the place a descriptor is written to is mapped: - title slots below 65,536 stay where they are; - each title slot from 65,536 on takes a place from a pool of 672,318 when a descriptor is written into it; - dynamic slots map linearly after the pool; - everything else maps to the null place. - A slot gives its place back when it is made null (`unmake`, `make_null`, and buffer views left null to wait for a draw). Places are reused oldest-first. If the pool is ever empty, the write goes to a sink place that no index reads, and a warning is logged once. - `cpu(index)` maps through this; `cpu_at(place)` is the raw handle (used by `fill_null`); `gpu_handle` maps too. - The strides upload buffer doubles in size. Dword `SLOT_STRIDES_COUNT + i` holds the place of view index `i`, and is written when a place is given or given back. **Translator side (`emit/shader.rs`).** With `set_view_remap(true)`: - the view limit becomes `SLOT_STRIDES_COUNT - 1`; - `heap_handle_at` clamps the index as before, then reads its place from that dword, through `SLOT_STRIDES` if the shader binds it, else `SLOT_TABLE_STRIDES`, so the heap buffer sweep isn't started by this. - Samplers and raw-twin indices are unchanged. The remap flag is part of the shader cache key (`mod.rs`) and of `host_settings` (bit 31 of the limit). `victory translate --warm` takes `VICTORY_VIEW_REMAP=1` alongside `VICTORY_VIEW_LIMIT=2097151`, to warm for such a host. Hosts that take bigger heaps (AMD) are unchanged: `view_remap()` stays false. ## Testing On RTX 5090, Series X profile, 1440p, opening cutscene through the diner, about 15 runs of 90–110 s. - **Picture:** unchanged, and no device removal. - **Pool:** after the world loads, at least about 106,000 places stay free while the give-back of null buffer slots is missing, and about 445,000 with it. It never ran out. - **Rejected first attempt:** an earlier version pooled only from slot 672,319 on (65,536 places). It ran out 33 s in and broke the picture, which is why the pool now starts at 65,536. - **Builds and tests on this branch:** - `cargo check -p victory --features diagnostics`: clean. - `cargo test -p victory-gpu`: 441 passed, 2 failed. - `cargo test -p victory-shader`: 287 passed, 3 failed. - The 5 failures fail the same way on unmodified `main` here: `indirect::tests::host_list_budget_starts_empty_at_each_submission`, `indirect::tests::warp_batch_charges_every_execution`, two `emit::rect` tests and one hardware barycentric test. - **Ported:** the code was written and run on an older base, then ported to current `main`. The game runs above were on that older base, not on this branch. Not measured: frame rate. Every view-heap handle now costs one more raw-buffer load, usually uniform. A before/after on another NVIDIA card would be welcome. Not fixed by this: the phone screen in the diner (#545). That turned out to be an exposure issue, and the findings are in the issue. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On NVIDIA the host's shader-visible view heap is capped at 1,000,000
descriptors (an RTX 5090 refuses 1,000,001); the retail game's view heap
has 1,245,184 slots. Title slots past 737,855 had no host slot, and every
shader-computed view index past it read the null slot or a dynamic one.

On such a host, title slots from 65,536 on take a place from a pool of
672,318 when a descriptor is written there and give it back when the slot
is made null. Shaders read each view index's place from a second table in
the strides buffer (dword SLOT_STRIDES_COUNT + index). The game keeps
400,000-570,000 views past 65,536 at once, spread over its whole heap.
VICTORY_VIEW_REMAP=0 turns it off; uncapped hosts are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 02:20:58 +00:00
Author
Owner

@⁠ArturoWolff on GitHub · 2026-11-28 02:46 UTC · original

Additional NVIDIA card comparison as requested. Tested your exact PR head b0228f071a4effcc516a3baebec5ef62704791d2 (base a4d05e7fd0af904130809c334a6008d62c24db6a) on an RTX 4060 desktop 8 GB / 16 GB system RAM, Linux, NVIDIA 620.73.04, GE-Proton11-14 / vkd3d-proton 3.2.0 (cae8353ed7959c4+). Both arms use the same locked MSVC release executable, with the previously tested Linux compiler, pipeline-library and physical-backing compatibility integrations retained unchanged (patch SHA-256 a9143500aeb8611e66f90130534831f8f02156299e3133f970224ef50e7ae919, provenance and baseline in #628).

Both actual retail launches used identical cloned profile seed, fresh engine/driver caches, Series X 1080to1440, full requested RT/water passes, no explicit omitted shaders or Bink skip, full write-back and waits, DLSS/FG off for the comparison, same DXC 1.9.2609 and mixed 448 MiB backing allowance. Effective logged graphics settings differed only in VICTORY_VIEW_REMAP.

Observation Remap 0 (old behavior) Remap 1
Capped heap / null-slot warning 1 0
Table remap initialization absent yes
Pool exhaustion warnings 0 0
Minimum sampled host available RAM (MiB) 1,409 1,558
Elapsed including startup (s) 138.42 137.17
Actual title exit 5 5

Enabled arm logged title_slots=1245184 as_is=65536 pool=672318 dynamic_at=737855, and the table was selected from the first shader. Both arms had two successful DXC fallback attempts, no missing clamp/compare/native-library warnings, one unsupported Wave64 translation, and no host guard stop, new OOM kills or kernel GPU faults. Temporary backing retired empty. Both visually reached loading artwork then a black FPS overlay; no recorded input or live world. Both still fail during the same first-story prestream phase described in #628.

This confirms activation of the intended remap path on an 8 GB RTX 4060 under Proton, but does not establish in-world descriptor correctness, reuse safety, peak pool occupancy, or gameplay FPS. It also does not fix this particular loading failure. The new watchdog findings in #628 make normal GPU completion and synchronization a more useful next investigation than removing rendering features. Thanks for making this independently selectable.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).

**@⁠ArturoWolff** on GitHub · 2026-11-28 02:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/638#issuecomment-7232586610) Additional NVIDIA card comparison as requested. Tested your exact PR head `b0228f071a4effcc516a3baebec5ef62704791d2` (base `a4d05e7fd0af904130809c334a6008d62c24db6a`) on an RTX 4060 desktop 8 GB / 16 GB system RAM, Linux, NVIDIA 620.73.04, GE-Proton11-14 / vkd3d-proton 3.2.0 (`cae8353ed7959c4+`). Both arms use the same locked MSVC release executable, with the previously tested Linux compiler, pipeline-library and physical-backing compatibility integrations retained unchanged (patch SHA-256 `a9143500aeb8611e66f90130534831f8f02156299e3133f970224ef50e7ae919`, provenance and baseline in [#628](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/628)). Both actual retail launches used identical cloned profile seed, fresh engine/driver caches, Series X `1080to1440`, full requested RT/water passes, no explicit omitted shaders or Bink skip, full write-back and waits, DLSS/FG off for the comparison, same DXC 1.9.2609 and mixed 448 MiB backing allowance. Effective logged graphics settings differed only in `VICTORY_VIEW_REMAP`. | Observation | Remap 0 (old behavior) | Remap 1 | |---|---:|---:| | Capped heap / null-slot warning | 1 | 0 | | Table remap initialization | absent | yes | | Pool exhaustion warnings | 0 | 0 | | Minimum sampled host available RAM (MiB) | 1,409 | 1,558 | | Elapsed including startup (s) | 138.42 | 137.17 | | Actual title exit | 5 | 5 | Enabled arm logged `title_slots=1245184 as_is=65536 pool=672318 dynamic_at=737855`, and the table was selected from the first shader. Both arms had two successful DXC fallback attempts, no missing clamp/compare/native-library warnings, one unsupported Wave64 translation, and no host guard stop, new OOM kills or kernel GPU faults. Temporary backing retired empty. Both visually reached loading artwork then a black FPS overlay; no recorded input or live world. Both still fail during the same first-story prestream phase described in #628. This confirms activation of the intended remap path on an 8 GB RTX 4060 under Proton, but does not establish in-world descriptor correctness, reuse safety, peak pool occupancy, or gameplay FPS. It also does not fix this particular loading failure. The new watchdog findings in #628 make normal GPU completion and synchronization a more useful next investigation than removing rendering features. Thanks for making this independently selectable. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/638/head:github-bot/gh-638'
git switch 'github-bot/gh-638'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-638'
git switch 'github-bot/gh-638'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-638'
git switch 'github-bot/gh-638'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-638'
git switch 'main'
git merge --squash 'github-bot/gh-638'
git switch 'main'
git merge --ff-only 'github-bot/gh-638'
git switch 'main'
git merge 'github-bot/gh-638'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.