Repository navigation
Conversation
Translated programs that load their descriptors bindless add an index read from a buffer (shifted to the console's descriptor size) to the heap or table address, and the lowering turned that address into a ResourceDescriptorHeap / SamplerDescriptorHeap index with no bound. When the host's copy of that buffer is stale or zero, the index can be anything up to 2^27, far past the host heap. An index past a heap is undefined: on NVIDIA (RTX 4070 Ti) a store through index 2^25 lands in slot 0, so the hardware wraps it onto an unrelated slot. In a title the wrapped slot holds a descriptor of another kind, the dispatch never finishes, and the driver removes the device with DXGI_ERROR_DEVICE_HUNG and no page fault. Loop limits do not help: the programs that hang have no barriers and no long loops. Every heap index the lowering computes now goes through a guard: an index at or above the bound heap's guard slot reads that slot instead (an unsigned compare and a select). The guard slot comes in a user-data dword of its own, after every dword the program's root parameters reach (a UserData entry of root type ResourceHeap / SamplerHeap). The host gives each view heap one slot more, after its dynamic slots, null from the start and never made; a sampler heap's guard is its last slot (any sampler reads safely). The pipeline's root constants already cover user_data_dwords(), and draws and dispatches fill the new dwords from the bound heaps. Test: a_heap_index_past_the_heap_reads_the_guard_slot (without the select, the store at index 2^25 lands in slot 0 on NVIDIA). The test harness keeps a null slot after its views; the helpers fill the guard dwords. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verified Not covered: a heap index computed by the title's data actually clamped at draw time (no game data here). |
|
Confirmed on an RTX 5080, driver 621.24, Windows 11 26300, using a local Xbox Series 1.0.2.1 copy at
The synthetic guard test works here, but the world is not stable on this hardware yet. Only aggregate counts and error classes shared. AI-assisted (Kimi Code). |
|
Independent synthetic check on RTX 5070 Ti, NVIDIA 617.14, Windows 11 25H2 26200.9974, Rust 1.98.1 / MSVC x64, with the Windows SDK 10.0.26100.0
These were checked on local integration No world-stability claim: the local title probe was stopped during loading for low system commit headroom. No game files, captures or logs attached. AI-assisted (Codex). |
|
RDNA2 result, including the negative control. On an AMD RX 6750 XT (RDNA2) / Windows 11 / Rust 1.98.1 MSVC, with this PR at
So where NVIDIA wraps an out-of-heap index onto slot 0, RDNA2 loses the device. The panic doesn't say which of the out-of-range cases triggered it. This doesn't prove the AMD world crashes (#59, #304, #557) come from this, but it shows that an unbounded heap index is enough to remove the device on AMD too, not only to corrupt a slot on NVIDIA. Not runtime-tested with game files. AI-assisted (Claude did the analysis and the one-line control change; I ran the tests on my machine). |
|
On an RTX 4070, GBV on main |
|
#483 puts a view heap's guard slot right after the dynamic slots ( #86 replaces that pool with one sized from the heap's spare slots ( Whichever of the two lands second needs to keep the guard out of the pool. In my local merge I marked the last AI use: Claude Code, Claude Opus 5.5. |
|
Thanks, that's right, and I hit the same thing in a local merge of both.
Whichever of #86 and this PR lands second should carry that change. If #86 merges first, I'll rebase this PR onto it and add the reservation and the test here. AI use: Claude Code (Claude Opus 5.5). |
…ys inside the heap) Vaximous's Marvisak#483: every descriptor-heap index the lowering computes is bounded by the bound heap's guard slot (an index at or above it reads it), which the host passes in a user-data dword of its own. Conflict resolutions: - crates/victory-gpu/src/descriptor/host.rs: this tree's sizing is kept (Marvisak#86/Marvisak#83/Marvisak#251, and 2^18 dynamic slots on a capped heap); a view heap is made one slot larger, the guard slot, after its dynamic slots and outside the pool HostHeap::dynamic hands out (`spare` does not count it). On a capped heap that is 737,855 title slots, 262,144 dynamic ones and the guard at slot 999,999. Marvisak#483 had the guard at `count + DYNAMIC` with the pool sized by a constant; here the pool is sized by `spare` (Marvisak#86), so guard_slot() is `count + spare`. - A sampler heap's guard is its last slot, dynamic ones included (`count + spare - 1`), not Marvisak#483's `count - 1`: Marvisak#86 makes sampler tables afresh in a capped sampler heap's dynamic slots, which `count - 1` would have clamped away. - crates/victory-shader/src/emit/lower.rs, Lower::new: both fields are kept (`dead`, `guard_slots`). - crates/victory-shader/src/emit/valu_tests.rs: this tree's tests and Marvisak#483's new one are both kept. Changes beyond the PR: - emit/lower.rs, fetched_index (Marvisak#307's per-lane heap index, which Marvisak#483 did not know): it goes through heap_guard too. It is an address from a lane's data, as heap_index's. - emit/image_tests.rs (Marvisak#160's harness): the user data it fills gets the guard entries (host::guard). - descriptor/host.rs: tests the_guard_slot_is_past_every_dynamic_slot, and the guard's place in a_capped_view_heap_keeps_its_dynamic_slots. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Seven more upstream PRs are in (Marvisak#493, Marvisak#483, Marvisak#206, Marvisak#469, Marvisak#459, Marvisak#454, Marvisak#579) and the wave64 stack is at Marvisak#439's head 965ce30. Records how each was combined with what the tree had, that a capped view heap keeps 2^18 dynamic slots and why, Marvisak#189 and Marvisak#578 as left out, and a new section with testers' reports from the title: the set without the world-entry hang on three NVIDIA cards and how this tree differs from it, VICTORY_SKIP_WAVE64 as the switch to try, and Marvisak#136 bisected as making every frame black. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Windows 10 data point for #493 (c48b240) + #483 (65a161d): no device removal on an RTX 3070. Setup: Windows 10 22H2 (19045.6466), RTX 3070, NVIDIA 621.14, Ryzen 5 5600X, release build, Agility SDK 1.620.2 via #175. Base stack: #175, #233 + #320 + #439 (f653ea4), #55, #89, #336 (e8d3b64), #334 (af2aecf). This GPU caps the view heap at 1,000,000, so #336/#493 take the 2^16 dynamic range. #493 and #483 conflict in
One run so far. No game data in this report. AI-assisted (Claude Code); everything above was run on my machine. |
resource::track takes no structure here, Parts carries options, the guard user-data dword (Marvisak#483) gets the null slot past the views, and the one-GPU-test-at-a-time lock is shared at module level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # crates/victory-gpu/src/descriptor/host.rs # crates/victory-shader/src/emit/valu_tests.rs
…guard slot and the console-flow rule
|
Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1133. Heap indices past the host heap: main clamps every index to HEAP_VIEWS-1 / HEAP_SAMPLERS-1 and keeps the host heap that large (emit/shader.rs heap_handle). Only a host that caps its heap lower (NVIDIA) is left, and #1133 covers that with a translation-time bound instead of a new user-data dword per draw. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Refs #71, #264, #97 (one cause of the NVIDIA world
DEVICE_HUNG; not shown to be the only one).What
Every descriptor-heap index the lowering computes is bounded: an index at or above the bound heap's guard slot reads the guard slot instead. The host reserves one null slot at the end of each view heap for this and passes its index to the shader in a new user-data dword.
Why
Translated programs that load descriptors bindless read an index from a buffer, shift it left by 5 (4 for samplers), add it to the heap or table address and
s_load_dwordx4the descriptor there.Lower::heap_indexturned that address intocreateHandleFromHeap(addr >> 5)with no bound. When the host's copy of the buffer is stale or zero, the index can be anything up to 2^27, far past the host view heap (PORTABLE_VIEWS= 1,000,000 slots on NVIDIA).An index past the heap is undefined in D3D12, and NVIDIA does not fault on it: measured on an RTX 4070 Ti with the synthetic test below, a store through heap index 2^25 lands in slot 0: the hardware wraps the index onto an unrelated slot. In the title the wrapped slot holds a descriptor of another kind, the dispatch never finishes, and the driver removes the device with
DXGI_ERROR_DEVICE_HUNGand no DRED page fault.What pointed there, in the title on this machine (observed on a local integration branch of main plus many open PRs): the programs that hang have no barriers;
VICTORY_SHADER_LOOP_LIMIT=64still hangs; skipping one of them moves the hang to another program of the same kind (bindless descriptor fetch).Changes
victory-shader,emit/lower.rs:heap_indexends inheap_guard(index, sampler):idx <u guard ? idx : guard(one compare, one select). The guard is read once per program from a user-data dword placed after every dword the program's root parameters reach, recorded as aUserDataentry with root typeResourceHeap(view heap) orSamplerHeap.user()is split so the guard read shares the user-data load (user_dword).emit/mod.rs: the binding notes andUserData::rootdoc describe the new entry. This is a change to the binding scheme the module notes say is announced: a host that fills user data must fill these entries (user_data_dwords()already covers them, so root-signature sizes stay consistent).victory-gpu,descriptor/host.rs: a view heap gets one slot more after itsDYNAMICslots (null from the start, never made);HostHeap::guard_slot()returns it. A sampler heap's guard is its last slot (any sampler reads safely). The capped-heap path reserves the slot insidePORTABLE_VIEWS.draw.rs:user_dword()fills the guard entries from the bound heaps at draw/dispatch (and in the device-removed description); other entries go throughuser_valueas before.emit/host.rs): the draw/dispatch view heaps keep a null slot after their views;guard()gives the test helpers the value to fill.diff_testspassesu32::MAX(its views are all in range).Cost: one compare and select per bindless descriptor fetch, and one user-data dword per stage that does one.
Tested
Machine: RTX 4070 Ti, Ryzen 9 7900X, Windows 11 26300.
emit::valu_tests::a_heap_index_past_the_heap_reads_the_guard_slot: a one-thread program loads a UAV descriptor at table address + (data << 5) and stores through it, for index 0, 1 (the guard), 2^25 and 0x07FF_FFFF. With the select removed fromheap_guard(temporary edit) it fails on hardware:index 0x2000000writes 7 into slot 0. With the change it passes on hardware and WARP.cargo test -p victory-shader -- --test-threads=1: 70 passed, 0 failed (main: 69 passed; the extra one is the new test).cargo test -p victory-gpu -- --test-threads=1: 43 passed, 1 ignored, 0 failed (same as main).cargo clippy -p victory-shader -p victory-gpu --all-targets: no new warnings (the one existing warning is on main too).cargo xtask policy --staged: ok.Title (build 1.0.2.1, diag build, scripted Enter presses,
VICTORY_D3D12_DRED=1):DEVICE_HUNGwithin seconds of world entry on every run.DEVICE_HUNG(0x887A0006) about 45 s after the world started. DRED breadcrumbs stop at a mesh draw (DispatchMesh), not at one of the bindless compute dispatches this change is about. The guard dwords held the expected values (view heap capped at 1,000,000: guard 999,999; sampler guard 127).DEVICE_HUNGabout 55 s after the world started, with no breadcrumbs.So on plain main this change alone does not make the world stable on NVIDIA: another hang remains (mesh path; other open PRs, for example #89 for an invalid render-target view on a 16-bit packed format, address other NVIDIA failures). This PR removes one cause, the wrapped heap index, which the synthetic test reproduces in isolation. Scripted keys only; frame rate in the world is very low here (seconds per frame), so the time in the world is short in every run.
Not tested
ResourceDescriptorHeapmaterialization) and GPU: cap a shader-visible sampler heap at 2,048 instead of losing it #100 (sampler heap cap at 2,048): neither is merged here. They touch the same files (descriptor/host.rs,draw.rs). GPU: materialize bindless ResourceDescriptorHeap views, refreshing only changed slots #413 makes in-range bindless slots hold the right views; this PR keeps out-of-range indices off unrelated slots, so the two are complementary. With GPU: cap a shader-visible sampler heap at 2,048 instead of losing it #100 a capped sampler heap's guard is still its last host slot.AI use: written with Claude Code (Claude Opus 5.5 executing, Claude Fable 5.2 planning), tested on the submitter's hardware.
🤖 Generated with Claude Code