Cap the host view heap on every GPU: AMD page-faulted at view slot 2^23 #98

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

@⁠sillynocodecat on GitHub · 2026-11-24 21:28 UTC · original
sillynocodecat:amd-view-heap → main · +29 −1 · 4 files · 1 commits · open

On AMD the card is removed early in the opening cutscene, every run, at the same frame. NVIDIA's driver caps the shader-visible view heap at 1,000,000 views, so there set_view_heap_limit clamps every view index to the heap's null slot. AMD's driver takes the title's whole heap, the clamp never turns on, and an index far past the heap's end goes through.

This caps the heap on every GPU, as on NVIDIA. VICTORY_PORTABLE_HEAP=0 gives the whole heap back.

DRED on the failing run (RX 7800 XT, main + nothing else):

host GPU device removed after a submission of 6 lists; page fault at 0x112840000;
view heap 0x102840000+0x2e00000: 0xd200000 past its end (slot 8388608)

Slot 2^23 is about 8x past the end of a heap of ~1.5M views.

before this PR
Opening cutscene device removed at frame ~2230 (3 of 3 runs) plays through
Prologue not reached reached, playable with pad input
Stability — 15 min in the prologue and five 5-minute scripted runs, no device loss
Frame rate (Series X profile) — 3.4 fps; 3.7 with VICTORY_RELAY=2

Tested on Windows 11, RX 7800 XT 16 GB (driver 26.11.2), Ryzen 5 5600, 32 GB RAM, Series X profile. Same picture as the README describes on the RTX 4070: textures, sky, sunlit exterior, shadowed areas black.

Changes

  • emit/shader.rs: portable_heap(), on unless VICTORY_PORTABLE_HEAP=0.
  • descriptor/host.rs: probe_view_limit sets the limit at once when it is on, and HostHeap::new takes the capped branch instead of asking the driver for the whole heap.
  • shader_cache.rs: the switch changes translations, so the cache keys on it.

On NVIDIA nothing changes: the heap was capped there already.

cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: clean.

**@⁠sillynocodecat** on GitHub · 2026-11-24 21:28 UTC · [original](https://github.com/fxceless/victory-fork/pull/98) `sillynocodecat:amd-view-heap` → `main` · +29 −1 · 4 files · 1 commits · open On AMD the card is removed early in the opening cutscene, every run, at the same frame. NVIDIA's driver caps the shader-visible view heap at 1,000,000 views, so there `set_view_heap_limit` clamps every view index to the heap's null slot. AMD's driver takes the title's whole heap, the clamp never turns on, and an index far past the heap's end goes through. This caps the heap on every GPU, as on NVIDIA. `VICTORY_PORTABLE_HEAP=0` gives the whole heap back. **DRED on the failing run (RX 7800 XT, `main` + nothing else):** ``` host GPU device removed after a submission of 6 lists; page fault at 0x112840000; view heap 0x102840000+0x2e00000: 0xd200000 past its end (slot 8388608) ``` Slot 2^23 is about 8x past the end of a heap of ~1.5M views. | | before | this PR | |---|---|---| | Opening cutscene | device removed at frame ~2230 (3 of 3 runs) | plays through | | Prologue | not reached | reached, playable with pad input | | Stability | — | 15 min in the prologue and five 5-minute scripted runs, no device loss | | Frame rate (Series X profile) | — | 3.4 fps; 3.7 with `VICTORY_RELAY=2` | **Tested on** Windows 11, RX 7800 XT 16 GB (driver 26.11.2), Ryzen 5 5600, 32 GB RAM, Series X profile. Same picture as the README describes on the RTX 4070: textures, sky, sunlit exterior, shadowed areas black. **Changes** - `emit/shader.rs`: `portable_heap()`, on unless `VICTORY_PORTABLE_HEAP=0`. - `descriptor/host.rs`: `probe_view_limit` sets the limit at once when it is on, and `HostHeap::new` takes the capped branch instead of asking the driver for the whole heap. - `shader_cache.rs`: the switch changes translations, so the cache keys on it. On NVIDIA nothing changes: the heap was capped there already. `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings`: clean.
NVIDIA's driver refuses a shader-visible view heap past 1,000,000 views, so
there the heap is capped, its last slot kept null and every view index at or
past it clamped to that slot (set_view_heap_limit). AMD's driver takes the
title's whole heap, the clamp never turns on, and an index far past the
heap's end goes through: on an RX 7800 XT (driver 26.11.2, Series X profile)
the card was removed early in the opening cutscene, every run, at the same
frame. DRED named the read:

  page fault at 0x112840000; view heap 0x102840000+0x2e00000:
  0xd200000 past its end (slot 8388608)

With the heap capped as on NVIDIA the same machine plays the opening
cutscene through to the prologue and stays up (15 minutes in the prison,
no device loss, ~3.4-4.3 fps), with textures, sky and sunlight as on the
RTX 4070.

The cap is now the default on every GPU; VICTORY_PORTABLE_HEAP=0 gives the
whole heap back. It changes translations, so the shader cache keys on it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:08 +00:00
Author
Owner

@⁠ThomasHFWright on GitHub · 2026-11-24 21:45 UTC · original

Linux/NVIDIA validation: this PR changes behavior under Proton too. The capacity probe and the actual title heap have different outcomes here.

Setup: RTX 5090, Linux NVIDIA 620.73.4, GE-Proton11-14 / bundled vkd3d-proton cae8353ed7959c4+, base 4e17478b + #20 (14a1f07) + this PR (e8cad1e). Local diagnostics add a 10-second fence timeout and per-command timestamp readback; per-list timing enabled. Runs offline, normal shaders (no debug pixel replacement or shader skips), loop limit 256.

Heap behavior: with VICTORY_PORTABLE_HEAP=0, the 1,000,001-view probe succeeds, but the actual 1,245,184 + 262,144-view allocation fails with E_INVALIDARG. The old fallback then clamps the heap. It therefore misses the early-clamp decision before the first pipeline translations. A separate synthetic Wine/vkd3d device test also accepts the probe-sized heap and verifies that this PR's HostHeap is capped to 1,000,000 with the final slot reserved.

Same-binary comparison:

  • Forced cap on: reaches the first 500+ draw frame (1507), advances to frame 1511, then Xid 13 / MMU fault; 111.1 s, exit 5. Last reached progress marker is a mesh draw (c9dee8dc4ad07dd4 / a2a7199b20d1ae04); next marker is untouched. All 862 dumped SPIR-V modules validate for Vulkan 1.3 with scalar block layout.
  • Forced cap off: fails earlier, frame 1225, before the first 500+ draw frame; 101.2 s, exit 5. The failed list contains an indexed draw (022926508d7aa8ba / c3f65a5eb6b8cbb3). The late heap fallback is explicitly logged.

This supports retaining the early clamp on Proton/NVIDIA, but does not establish normal world visuals or solve the remaining GPU fault: the latest capped capture is blank. This is one on/off pair with retained prefix/data and separate shader-cache keys, not a deterministic replay. Progress timestamps localize an interval, not necessarily the original source of corruption.

Checks: diagnostic build, all-target/all-feature Clippy with -D warnings, and native asset policy pass. Full workspace: 501 passed, 6 existing Wine/vkd3d compatibility failures, 9 ignored (including two local diagnostic tests). The two local marker/heap tests pass when explicitly enabled. Existing failures are nested git/cargo under Wine, missing WSAConnectByList, two pipeline-library checks, and rejection of an intentionally bad container digest. Four console-compiler differential checks remain unavailable. No game data or raw crash logs attached.

**@⁠ThomasHFWright** on GitHub · 2026-11-24 21:45 UTC · [original](https://github.com/fxceless/victory-fork/pull/98#issuecomment-7145354402) Linux/NVIDIA validation: this PR changes behavior under Proton too. The capacity probe and the actual title heap have different outcomes here. Setup: RTX 5090, Linux NVIDIA 620.73.4, GE-Proton11-14 / bundled vkd3d-proton `cae8353ed7959c4+`, base `4e17478b` + #20 (`14a1f07`) + this PR (`e8cad1e`). Local diagnostics add a 10-second fence timeout and per-command timestamp readback; per-list timing enabled. Runs offline, normal shaders (no debug pixel replacement or shader skips), loop limit 256. **Heap behavior:** with `VICTORY_PORTABLE_HEAP=0`, the 1,000,001-view probe succeeds, but the actual 1,245,184 + 262,144-view allocation fails with `E_INVALIDARG`. The old fallback then clamps the heap. It therefore misses the early-clamp decision before the first pipeline translations. A separate synthetic Wine/vkd3d device test also accepts the probe-sized heap and verifies that this PR's `HostHeap` is capped to 1,000,000 with the final slot reserved. **Same-binary comparison:** - Forced cap **on**: reaches the first 500+ draw frame (1507), advances to frame 1511, then Xid 13 / MMU fault; 111.1 s, exit 5. Last reached progress marker is a mesh draw (`c9dee8dc4ad07dd4` / `a2a7199b20d1ae04`); next marker is untouched. All 862 dumped SPIR-V modules validate for Vulkan 1.3 with scalar block layout. - Forced cap **off**: fails earlier, frame 1225, before the first 500+ draw frame; 101.2 s, exit 5. The failed list contains an indexed draw (`022926508d7aa8ba` / `c3f65a5eb6b8cbb3`). The late heap fallback is explicitly logged. This supports retaining the early clamp on Proton/NVIDIA, but **does not establish normal world visuals or solve the remaining GPU fault**: the latest capped capture is blank. This is one on/off pair with retained prefix/data and separate shader-cache keys, not a deterministic replay. Progress timestamps localize an interval, not necessarily the original source of corruption. Checks: diagnostic build, all-target/all-feature Clippy with `-D warnings`, and native asset policy pass. Full workspace: 501 passed, 6 existing Wine/vkd3d compatibility failures, 9 ignored (including two local diagnostic tests). The two local marker/heap tests pass when explicitly enabled. Existing failures are nested git/cargo under Wine, missing `WSAConnectByList`, two pipeline-library checks, and rejection of an intentionally bad container digest. Four console-compiler differential checks remain unavailable. No game data or raw crash logs attached.
Author
Owner

@⁠zGLados on GitHub · 2026-11-24 22:17 UTC · original

Same fault on an RX 7700 XT (RDNA3), Windows 11 26300, driver 32.0.32015.7029, on unmodified 4e17478 (diag build, Series X profile). It came about 9 minutes in, in the prologue (frame ~3027):

host GPU device removed after a submission of 7 lists; page fault at 0x120860000; ...
view heap 0x102860000+0x2e00000: 0x1b200000 past its end (slot 15728640)

Before that it ran stable and lit at up to 3.1 fps. Three other 8-minute runs on the same build did not reach the fault. #134 makes the same fix in a different way. I can run either PR here if that helps decide.

AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and drafted this comment.

**@⁠zGLados** on GitHub · 2026-11-24 22:17 UTC · [original](https://github.com/fxceless/victory-fork/pull/98#issuecomment-7146050712) Same fault on an RX 7700 XT (RDNA3), Windows 11 26300, driver 32.0.32015.7029, on unmodified `4e17478` (diag build, Series X profile). It came about 9 minutes in, in the prologue (frame ~3027): ``` host GPU device removed after a submission of 7 lists; page fault at 0x120860000; ... view heap 0x102860000+0x2e00000: 0x1b200000 past its end (slot 15728640) ``` Before that it ran stable and lit at up to 3.1 fps. Three other 8-minute runs on the same build did not reach the fault. #134 makes the same fix in a different way. I can run either PR here if that helps decide. AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and drafted this comment.
Author
Owner

@⁠ericomeehan on GitHub · 2026-11-25 00:25 UTC · original

Reusing the existing capped path and null-slot clamp keeps this small, and the RX 7800 XT / 7700 XT / 7900 XT reports line up well with the slot numbers.

One small log point: with the cap on, HostHeap::new takes the fallback arm through a synthetic E_OUTOFMEMORY, so every run logs the warn "host view heap capped at 1000000 ... error=E_OUTOFMEMORY" even though no allocation failed. People triaging memory problems often search logs for E_OUTOFMEMORY, so a separate info line for the forced path (or skipping the error field when forced) would keep real failures distinguishable.

Written with an AI assistant (Claude).

**@⁠ericomeehan** on GitHub · 2026-11-25 00:25 UTC · [original](https://github.com/fxceless/victory-fork/pull/98#issuecomment-7148493142) Reusing the existing capped path and null-slot clamp keeps this small, and the RX 7800 XT / 7700 XT / 7900 XT reports line up well with the slot numbers. One small log point: with the cap on, `HostHeap::new` takes the fallback arm through a synthetic `E_OUTOFMEMORY`, so every run logs the `warn` "host view heap capped at 1000000 ... error=E_OUTOFMEMORY" even though no allocation failed. People triaging memory problems often search logs for `E_OUTOFMEMORY`, so a separate `info` line for the forced path (or skipping the `error` field when `forced`) would keep real failures distinguishable. Written with an AI assistant (Claude).
Author
Owner

@⁠zGLados on GitHub · 2026-11-25 08:02 UTC · original

Tested e8cad1e (this PR on 4e17478) on the RX 7700 XT from my comment above: the fault is gone here.

  • Before (4e17478 unmodified, warm cache): device removed at ~545 s, frame ~3027, view-heap page fault past the heap's end.
  • This PR: two runs (12 min cold cache, 15 min warm cache), no device removal. The warm run passed frame 3200 at ~14 min (lit prologue scene at the window); log shows view heap capped at 1000000 on every GPU. ~2.5 fps in the scene, Series X profile, diag build.
  • Same machine and driver (32.0.32015.7029), Windows 11 26300; Windows GPU timeout back at its default this time (the earlier failing run had TdrDelay = 10).
**@⁠zGLados** on GitHub · 2026-11-25 08:02 UTC · [original](https://github.com/fxceless/victory-fork/pull/98#issuecomment-7156530380) Tested `e8cad1e` (this PR on `4e17478`) on the RX 7700 XT from my comment above: the fault is gone here. - **Before** (`4e17478` unmodified, warm cache): device removed at ~545 s, frame ~3027, view-heap page fault past the heap's end. - **This PR:** two runs (12 min cold cache, 15 min warm cache), **no device removal**. The warm run passed frame 3200 at ~14 min (lit prologue scene at the window); log shows `view heap capped at 1000000 on every GPU`. ~2.5 fps in the scene, Series X profile, diag build. - Same machine and driver (32.0.32015.7029), Windows 11 26300; Windows GPU timeout back at its default this time (the earlier failing run had `TdrDelay` = 10).
Author
Owner

@⁠zGLados on GitHub · 2026-11-25 09:13 UTC · original

Follow-up with this PR's build (e8cad1e) on the same RX 7700 XT: the opt-in speed switches, one 15-minute run each, warm cache, Series X profile. fps = frames 2600→3200 in the window scene of the prologue, from capture times.

Switches fps
none 2.8
VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024 4.1
VICTORY_RELAY=2 + the set above 4.2
VICTORY_RELAY=2 4.6

All four runs: no device removal, clean lit picture. On RDNA3 the relay alone gives much more here than the 3.4 → 3.7 measured on the RX 7800 XT above; the two together are not faster than the relay alone. One run per row, so roughly ±5 %.

**@⁠zGLados** on GitHub · 2026-11-25 09:13 UTC · [original](https://github.com/fxceless/victory-fork/pull/98#issuecomment-7158050324) Follow-up with this PR's build (`e8cad1e`) on the same RX 7700 XT: the opt-in speed switches, one 15-minute run each, warm cache, Series X profile. fps = frames 2600→3200 in the window scene of the prologue, from capture times. | Switches | fps | |---|---:| | none | 2.8 | | `VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024` | 4.1 | | `VICTORY_RELAY=2` + the set above | 4.2 | | **`VICTORY_RELAY=2`** | **4.6** | All four runs: no device removal, clean lit picture. On RDNA3 the relay alone gives much more here than the 3.4 → 3.7 measured on the RX 7800 XT above; the two together are not faster than the relay alone. One run per row, so roughly ±5 %.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/shader_cache.rs
  • crates/victory-shader/src/emit/mod.rs
  • crates/victory-shader/src/emit/shader.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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