Repository navigation
Conversation
…k#747) A host that caps shader-visible view heaps at 1,000,000 (NVIDIA, on binding tier 3 too) gave the world's view heap (1,245,184 slots) only 2^16 dynamic slots, and its fresh tables ran out inside every submission (Marvisak#747). The split is now a pure function, `view_layout`: * a host that takes `count + 2^18`: unchanged; * capped, title heap fits with at least 2^16 to spare: every title slot, the rest dynamic (up to 2^18); * capped, title heap does not fit: 737,856 title + 262,144 dynamic; * a host capped above 1,000,000 that takes `count + 2^16`: unchanged. Also: `no free dynamic descriptor slots` is counted (logged at powers of two) instead of once, and device-removed reports name title and dynamic slots. On NVIDIA this moves the first title index without a host slot from 934,464 to 737,856. Direct heap reads at such indices read the host's dynamic slots (other draws' tables); the next commit bounds them. Merge this together with a bindless bound on capped hosts. Tests: a reference of the old split checked against the new one for caps of 900k, 1M, 1.31M, 1.4M and none; the world-sized heap on the device (RTX 4060 Ti: 737,856 + 262,144; WARP: 1,245,184 + 262,144), exhausted in 140-slot tables, released and retaken. Diagnosis and the 2^18 proposal: Vaximous (Marvisak#747); 2^18 dynamic slots and dropping draws without fresh tables: Marvisak#336 (hophaver). AI-assisted (Claude Code); tests run locally on an RTX 4060 Ti (driver 621.01) and WARP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sak#483) Builds on the previous commit's heap layout and on the guard scheme of Marvisak#483 (Vaximous): a user-data dword with the bound heap's guard slot, past the program's own dwords, and every computed heap index at or above it reads the guard instead. This adds: * A second bound for reads straight from the heap (root `ResourceHeap`, base 0: a title index): the host's title slots. Past them a capped heap keeps its per-draw tables, so one bound let a stale title index read another draw's descriptor. Reads through a table stay bounded by the guard (fresh tables live past the title slots). * `fetched_index` (per-lane descriptors loaded with `global_load`) is bounded too. * One guard slot per kind of read (`HEAP_GUARDS`: 12 SRV kinds, 8 UAV kinds, a CBV). A null view is defined only where it is read as its own kind (D3D12 resource binding spec, "NULL Descriptors"); GPU-based validation reported 20 type mismatches with a single null 2D SRV guard on the readback tests below, none with these. The guards are the last slots of a view heap's dynamic span, never given to a table. * The bound dwords go right past the last dword the program reads (lowered a second time where that saves space, kept only if the reads are the same; any failure keeps the first result), so a stage's root constants grow by 0 or 4 dwords instead of up to 32 (64 dwords for a whole root signature; Marvisak#644 would spill the rest). Tests: GPU readback on a 1,000,000-slot heap laid out as on a capped host (RTX 4060 Ti and WARP): direct reads past the title slots, at the guards and past the heap read the null guard; table reads reach their dynamic slots up to the guards; with one bound (Marvisak#483) or none, direct reads reach other draws' descriptors (negative control). Lowering tests for the bound dwords' placement and cost and for `fetched_index`; every kind of read maps to its own guard; root signatures of 63/64/65 dwords on the device. Red/green by mutation: one bound for direct reads, `fetched_index` unbounded, bounds past the layout end. Typed null descriptors by kind for empty table slots are Marvisak#581's (FibbS6), independently; these are for the guard slots. Integration notes from etcetera-yt, h0useadv and walterwallaceson on Marvisak#483 (guard kept out of the dynamic pool, `count + self.dynamic`) are applied. AI-assisted (Claude Code); tests run locally on an RTX 4060 Ti (driver 621.01) and WARP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Summary
Two commits:
3e3b8c5, GPU: adapt the descriptor heap layout to the host's capacity (NVIDIA capped view heap: 2^16 dynamic slots starve world tables; 2^18 removes the indirect/mesh drops Marvisak/VIctory#747). On a host that caps view heaps at 1,000,000 (NVIDIA), the world's heap now gets 262,144 dynamic slots instead of 65,536. Hosts that take more are unchanged. One file.cc449ca, GPU, Shaders: bound bindless heap reads with typed null guards (Shaders, GPU: a heap index computed from data stays inside the heap Marvisak/VIctory#483). This builds on the guard scheme of #483 and adds four things:fetched_index;Commit 2 builds on commit 1. Commit 1 builds and passes on its own. On capped hosts it should land together with a bindless bound, because it widens the window in which direct reads hit other draws' tables (see §11).
This improves one subsystem. It does not make the world render: see §12.
2. Background and motivation
HostHeap::newfell back toMIN_DYNAMIC = 2^16dynamic slots.MIN_DYNAMIC = 2^18in the world (credits in §13).3. Adaptive descriptor heap layout (commit 1)
view_layoutis a pure function, so every host cap can be tested without hardware.count + 2^18(AMD, WARP, uncapped NVIDIA)count + 2^16but not+ 2^18(cap above 1M)With commit 2 the last 21 of those dynamic slots are guards, so 262,123 remain for tables. The total stays 1,000,000.
Unlike the branch on LAKSHYA-cmd-tech/VIctory and the commit on MfDev0/VIctory listed in §15, uncapped hosts and title heaps that fit are not cut.
4. Separate title and table bounds (commit 2)
heap_boundapplies the bound like this:idx < guard ? idx : guard, as in Shaders, GPU: a heap index computed from data stays inside the heap Marvisak/VIctory#483. Fresh tables lie in the dynamic slots and must stay reachable.ResourceHeap, base 0, so a title index):idx < title_slots ? idx : guard.Past the title slots a capped heap keeps the host's per-draw tables. With one bound, a stale title index reads another draw's descriptor. That is a valid access, so DRED and page faults don't report it. The host fills dword 0 (guard) and dword 1 (title slots) in
user_dwordon every bind.5. Fetched descriptor indexing
Per-lane descriptors loaded with
global_load(Source::Fetched) go throughfetched_index. Marvisak#483 does not bound that path. It now ends in the sameheap_bound. Phi, Select, Lanes and LanePhi are bounded per leaf.6. Typed null descriptor guards
The D3D12 resource binding spec defines a null descriptor only "as long as the type of shader access is compatible with the descriptor type". Its own example, a Texture2D read through a Texture1D null, is "undefined and could result in device reset" (Resource Binding, "NULL Descriptors"). SM 6.6 Dynamic Resources does not address type mismatches in heap reads.
HEAP_GUARDSholds 21 null views: 12 SRV kinds (1D–cube-array textures, typed, raw and structured buffers), 8 UAV kinds and a CBV.heap_guardpicks the slot from the read's DXIL resource properties at compile time, so the bound targetsguard + kind.null_guardinto the last slots of the dynamic span, which are never given to a table (guard_slot).Measured with GPU-based validation on the readback tests in §9 (direct and table reads through raw UAVs), RTX 4060 Ti and WARP:
Only the raw-UAV guard is exercised by those tests. Every other kind is covered by the mapping test (
every_heap_read_has_a_guard_of_its_kind) and the spec, not by GBV runs.Typed nulls for empty table slots are Marvisak#581's (FibbS6), implemented independently. These are for the guard slots. The two are complementary.
7. Root signature cost reduction
D3D12 allows 64 dwords per root signature: 1 per root constant, 2 per root CBV or SRV. A pipeline here has at most 2 translated stages, and a console stage has at most 31 user SGPRs. Placing the bound dwords after the whole layout, as Marvisak#483 does, can grow a stage from 4 to 36 dwords (31 declared, 2 read). Two such stages pass the limit.
lowernow places them right after the last dword the program reads:Cost per stage is now 0 or +4 dwords (rounding to rows of 4), at most +8 per pipeline. Doubly lowered shaders are cached like all others.
A pipeline already at 57–64 dwords can still be pushed over. It is then refused with
host root signature refused, visibly, not silently. #644 (nathanbzrr, spill to root CBVs) would cover that case. It reads the sameuser_data_dwords()and conflicts textually indraw.rsbind.8. Diagnostics
no free dynamic descriptor slotsis counted and logged at powers of two, instead of once (L350).place_in_heap).9. Test results
Run locally on Windows 11, RTX 4060 Ti (driver 621.01), Rust 1.98.1, and on WARP.
cargo test --workspace --locked(hardware)victory-gpu+victory-shaderon WARP (--features victory-gpu/diagnostics)clippy --workspace --all-targets --locked -D warnings, with and without--all-featurescargo xtask policy(also the pre-commit hook)Main is at 342 passed. 4 tests in
emit/diff_tests.rscount as passed but skip themselves without the console SDK'sdxc.exe; that is unchanged here.New tests:
view_heap_split_is_never_worse_than_before: a reference copy of the old split, checked for caps of 900k, 1M, 1.31M, 1.4M and none.world_view_heap_has_the_full_dynamic_range_on_the_host: on the device, the heap exhausted in 140-slot tables, released and retaken.the_guard_slot_is_never_given_to_a_table.direct_heap_reads_past_the_title_slots_read_the_guard: 737,855 reads the title UAV. 737,856, 934,463, 934,464, the last dynamic slot, the guards, 999,999, 1,000,000, 2^25 and 0x07FF_FFFF read the guard.table_reads_reach_the_dynamic_slots_up_to_the_guard.per_lane_heap_indices_are_bounded_too(fetched_index, wave32 and wave64 waterfall fixtures).heap_bounds_are_user_data_past_the_reads.heap_bounds_cost_no_more_than_the_reads_need(31-SGPR layout).root_signatures_hold_64_dwordson the device: 63 and 64 (incl. 30+32+root CBV) accepted, 65 refused.10. Negative controls
without_a_title_bound_direct_reads_reach_other_draws_tablesis part of the suite. With one bound (Shaders, GPU: a heap index computed from data stays inside the heap Marvisak/VIctory#483's semantics) or none, a direct read at 737,856, 934,463, 934,464 or the last dynamic slot writes into another draw's UAV, on hardware and WARP. Only in-heap indices are run unbounded.fetched_indexunbounded: the lowering test fails;11. Dependencies and integration notes
view_layoutandHostHeap.dynamic.user()/user_dword()split, null guard, guard kept out of the pool). It can be folded into Shaders, GPU: a heap index computed from data stays inside the heap Marvisak/VIctory#483 or replace it, as Vaximous and the maintainers prefer.draw.rsbind. Calluser_dwordwhere GPU: spill oversized host root signatures' user data to root CBVs Marvisak/VIctory#644 writes the root-CBV values.dynamic()/release()and so the reduced pool.descriptor/host.rs.HostHeap::new. It should agree semantically as long as its bindless slots are the title slots (count), not the dynamic or guard span.HostHeap::newand the dynamic constants. Its one-view root-SRV tables take dynamic slots below the guards.count − 1) and follows whatevercountthey set.12. Known limitations
amdxc64.dllcrash nullmarsh reported on Shaders, GPU: a heap index computed from data stays inside the heap Marvisak/VIctory#483 is not reproduced and not explained.13. Credits
DYNAMIC = 2^18and dropping draws without fresh tables (#336, merged), which this code builds on.count + self.dynamic) are applied;No code from those PRs or branches was copied. Commit 2 re-implements Marvisak#483's scheme; everything else is written here.
14. AI assistance disclosure
Analysis, code and text were written with Claude Code (Anthropic). Every test result above was run locally on the hardware named in §9. Code was reviewed by separate read-only review passes before publication. The world measurements cited are other people's and were not reproduced here.
15. Related issues and pull requests
fix/gpu-descriptor-heaps-caps-and-dynamic-expansion6dc368a2eeb4bd