GPU: never give a shader a table offset past the host heap #550
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/550"
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 edsuuu on 2026-11-24T04:46:44Z.
What
On NVIDIA the shader-visible view heap is capped at 1,000,000 descriptors (
CreateDescriptorHeapfails above it; the RTX 4060 Ti also reportsMaxViewDescriptorHeapSize= 1,000,000), while Grand Theft Auto VI asks for 1,245,184.HostHeap::newthen mirrors the title's first slots one to one and leaves the rest out, so title slots past the cap have no host slot.Tables that reach past the cap are made afresh (
State::tables), but when that fails — no free dynamic slot (the 65,536 of a capped heap run out seconds into the world), or the table's entries reach past the title heap's end — the draw fell back to the title's offset as its user data. The shader then indexedResourceDescriptorHeappast the end of the host heap, read garbage descriptors, and the device hung (DXGI_ERROR_DEVICE_HUNG, the world hang in #71).DRED evidence from three hangs on an RTX 4060 Ti: 13 of 14, 22 of 29 and 20 of 29 of the tables bound by the unfinished draws started past slot 1,000,000 (the title's per-draw tables sit at the top of its heap, around 1.2 million).
This change drops such a draw or dispatch (warned once) instead of giving the shader an offset past the heap: a missing draw instead of a removed device. Since #336,
State::bindreturns whether the draw may run and its callers skip it when it may not; this adds the past-heap case there. It does not make those draws render; that needs the title's slots past the cap to be remapped (the existingshortcut:inHostHeap::new).Relates to #71.
Tested
cargo build --profile diag -p victory --features diagnostics,VICTORY_D3D12_DRED=1andVICTORY_NO_WATCHDOG=1(#454). Before this change every world run hung the device 30 to 90 s after the first mesh draws. After it, two runs of several minutes each reached the world's first frames with no device hung and no DRED report.cargo test --workspace(264 passed, 0 failed),cargo clippy --workspace --all-targets(no new warnings; the one left,host.rs:267unsafe block without a safety comment, is on main too),cargo xtask policy(151 files ok).cargo fmt --checkreports differences that are already on main (#502 reformats them); this change adds none. After merging main @ffe310e(to resolve the conflict with #336):cargo test -p victory-gpu50 passed, 0 failed;cargo clippy -p victory-gpu --all-targetsno warnings. Not run in game on main alone: main does not reach the world on NVIDIA without the wave64 PRs.Checklist
cargo fmt,cargo clippy --workspace --all-targetsandcargo test --workspacepass (fmt and clippy: only what main already reports, see above).cargo xtask policypasses. The change adds no game files or data taken from them (docs/asset-policy.md).The change, the investigation of the DRED reports and this description were written with Claude Code (Claude Opus 5.5) and tested on the machine above.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T04:56:51Z.
Review: APPROVED
Verified on Windows 11 D3D12 (WARP):
Imported from Marvisak/VIctory. Originally posted by rpmaster2 on 2026-11-24T08:32:15Z.
Tested on top of
main@1f858b0(diag profile): Radeon RX 9070 XT 16 GB (RDNA4), Adrenalin 26.11.2 (32.0.32029.2010), Windows 11 26300, Ryzen 5 5600, 32 GB RAM, pagefile 32/48 GB.Result: this change does not trigger on this host and the crash is unchanged.
past the host heapappears 0 times in the full log (it did appear on an earlier build, so the guard itself works).no free dynamic descriptor slots: a table is not made n=133still appears right before the removal.Timeline of the run: menus at 30 fps; world entry; 0.7-0.9 fps at 500-2400 draws/frame with 390-590 pipelines being made and 800-2700 indirect;
n=133; TDR ~4 s later.So on this GPU/driver the failing table does not sit past the host heap - it cannot be created at all because the dynamic slot pool is already full. The diagnostics in
aycow:gpu/descriptor-allocation-demand@82e4aa6 show ~13.9k new local tables / ~71.5k slots at the first failed rebuilt table, dominated by width 16 (8.5k tables / 60.2k slots) and width 256 (167 / 23.1k), with most of the Mixed demand flaggedduplicate_untracked.Details and the full counters: https://github.com/Marvisak/VIctory/issues/597#issuecomment-7126246040
No game data in this report: counts, driver version and error strings only.
AI-assisted: written by DeepSeek (OpenCode harness) from my run logs and observations; the hardware, the dump and the runs are mine.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T11:51:43Z.
Review: APPROVED
Tested
a8be528on Windows 11, RTX 5070, MSVC:cargo test -p victory-gpu -- --test-threads=143 passed, and with--features diagnostics45 passed. Clippy's 1 warning is the existing one in host.rs.past_host_heapcompares the table's title index against the host heap the draw actually binds (host.count()). So it catches exactly the slots a capped heap left out, whatever the cap is, and drops the draw with a one-time log instead of handing the shader an offset past the end.bindreturningbool, with every caller honouring it (draw, dispatch, the mesh/compute path), keeps a dropped table from leaving a half-bound root signature behind.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by nopsled0x on 2026-11-24T12:15:15Z.
Tested #550 (head
8560817, on top of mainffe310e) combined with #175 (Agility SDK, needed on Windows 10 for SM 6.6). One run, diagnostics build,VICTORY_D3D12_DRED=1,VICTORY_D3D12_DEBUG=1, 240 s limit.Host: RTX 5060 Ti, Windows 10 22H2.
Measured
past the host heapappears 0 times: the new guard did not trigger in this run.no free dynamic descriptor slots: a table is not madeappears once (n=12), about 51 s before the removal.DXGI_ERROR_DEVICE_HUNG(0x887A0006) about 100 s after the first shader translation; host device removed after a submission of 30 lists; the process exited with a host GPU failure.0x80070057(E_INVALIDARG) on 118 lines: 115 host pipeline refusals, 2 host texture creations, 1 "host view heap capped at 1000000".IASetVertexBuffersresource-state errors (buffer in UNORDERED_ACCESS); one is logged right before the removal. I have not established that it is related.Not established
So on this card, in this run, the #550 guard did not trigger and the device was still removed. The guard result agrees with the AMD report above; the failure pattern differs (n=12 well before the removal, 30 lists, vs n=133 right before it, 1 list), and I have no baseline to say the crash is unchanged.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by YaBulochka on 2026-11-24T17:41:42Z.
Confirming the diagnosis with numbers from a Linux/RADV run (Mesa 26.3.1, RX 7600 XT, Wine 11.22 on a Proton prefix):
HostHeap::newmirrors 934,464;index=934464…1245183.So on this title it is not a rare edge: a quarter of the view heap is outside the mirror, and the title writes all of it at start-up. Dropping the tail is what shows up as the checkerboard/stripe artifacts while the loading screen is up. Nothing needed from you, just the data point.
upstream-sync referenced this pull request2026-11-24 19:03:41 +00:00
Pull request closed