victory-shader: clamp heap indices to the largest heap a host can make (no descriptor read past the heap) #2683
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2683
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2683"
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?
@pes7 on GitHub · 2026-11-25 18:07 UTC · original
pes7:fix/heap-index-limit→main· +124 −10 · 2 files · 3 commits · openTranslated shaders clamped a heap index to a slot no host can have, so a descriptor read at a computed index went past the end of the heap. The clamp is now the largest heap a host may make, and a heap capped at that size keeps its top for the null slots.
victory-shaderclamps every heap index it computes (HostShader::heap_handle) belowHEAP_VIEWS, andNULL_BUFFER_VIEW = HEAP_VIEWS - 2is the slot a shader reads instead of a slot that holds no buffer view.HEAP_VIEWSwas1 << 21= 2 097 152 descriptors, which is the console-shaped heap the indices were first written for - butD3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2is 1 000 000 (victory-gpu'sPORTABLE_VIEWS), so on every D3D12 host the clamp allowed an index up to 2 097 151 against a heap of at most 1 000 000 descriptors. The code knew:Measured on the title, NVIDIA, warm caches:
i.e. the null slots were never made, because
NULL_BUFFER_VIEW(2 097 150) is above the whole heap. What a shader reads 32 MB past the heap is whatever memory is there, and it is read as a descriptor.The change.
HEAP_VIEWSis 1 000 000, the largest heap a host may create, so any index the clamp can produce is inside the heap.NULL_BUFFER_VIEWis then 999 998, and the capped path keeps the top of its heap free for it: a heap capped atPORTABLE_VIEWSgetsMIN_DYNAMIC - NULL_RESERVEdynamic slots, so the title slots plus dynamic slots end below the two null slots andno room for the null buffer viewsno longer happens.What it does not do: the title asks for 1 245 184 slots and a host will never hold them (tier 2 caps the heap at 1 000 000), so slots above the capped heap's title region are still not mirrored - they read a null slot now, which is the safe answer and the one the clamp was meant to give (
emit"Heap indices": "reads nothing instead of faulting the device"). Remapping the title's index space, or splitting it across heaps, is a separate change.Reported from two machines, and both measurements agree:
no room for the null buffer viewsno longer happens (0 in the run),host view heap capped at 1000000 count=1245184stays because the title really does ask for more than a host holds.Cost:
HEAP_VIEWSis baked into translated shaders, soSOURCE_HASHchanges and the shader cache is translated again once (the pipeline library is keyed by the title's shaders and is unaffected).cargo test --workspace --locked, both clippy configurations with-D warnings,cargo xtask policy.What it gives (to decide the merge): no descriptor read past the host heap: the title asks for 1 245 184 slots where D3D12 allows 1 000 000, and every draw reaching one read a descriptor ~32 MB past the heap. With the clamp the debug layer's
no room for the null buffer viewsand the offset descriptor reads (704 x id=527, 37 x id=538) go to zero; a tester on an RTX 4070 Ti confirmed it on NVIDIA, where the heap is capped the same way.State: MERGEABLE, CI
checkgreen, rebased onto today'smain(f3578e3).Risk: the null views stay above the title's slots in every dynamic range (
extra.min(total - count - NULL_RESERVE)).Translated shaders clamp every heap index they compute below HEAP_VIEWS, and NULL_BUFFER_VIEW = HEAP_VIEWS - 2 is the slot a shader reads instead of a slot with no buffer view. HEAP_VIEWS was 1 << 21 = 2 097 152, the console-shaped heap the indices were first written for, but D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2 is 1 000 000 (victory-gpu's PORTABLE_VIEWS): the clamp allowed an index 32 MB past the end of any heap that can exist, and what is there is read as a descriptor. The code knew - "a host that caps its heaps below HEAP_VIEWS (NVIDIA) faults on an index past them" - and on the title it never got as far as the null slots: host view heap capped at 1000000 count=1245184 no room for the null buffer views: ... count=934464 total=1000000 HEAP_VIEWS is now the largest heap a host may create (1 000 000), so every index the clamp can produce is inside the heap and NULL_BUFFER_VIEW is 999 998. A heap capped at PORTABLE_VIEWS keeps the top of itself for those two slots (MIN_DYNAMIC - NULL_RESERVE dynamic slots), so the title slots and the dynamic ones end below them and the warning above no longer happens; measured on the title, warm caches: "null buffer views: 0". The title asks for 1 245 184 slots, more than a host will hold, so slots above the capped heap's title region are still unmirrored - they read a null slot now, which is the safe answer the clamp was meant to give, not a read outside the heap. HEAP_VIEWS is baked into translated shaders, so the shader cache is translated once more (SOURCE_HASH changes); the pipeline library is keyed by the title's shaders and is unaffected. cargo test --workspace --locked; both clippy configurations with -D warnings; cargo xtask policy.@Vedoxdev123 on GitHub · 2026-11-25 18:12 UTC · original
RTX 4060 test (AI-assisted)
Windows 64-bit, Ryzen 5 5600X, GeForce RTX 4060 (8 GB).
cargo test -p victory-gpu --lib: 195 passed, 0 failed, 1 ignored on this PR.mainhas 193 passed, 2 failed (descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views). Both pass with this PR.cargo test -p victory-shader: segfaults on bothmainand this PR, so there is no summary line. No change from this PR.@kotekompotek on GitHub · 2026-11-25 18:38 UTC · original
Correct fix for a real device-removal bug: the clamp is arithmetic (cmp+select, not a mask), so 1_000_000 is safe; every successful heap is still >= HEAP_VIEWS via the .max(views) allocation; and in the capped path NULL_RESERVE keeps the top 1,024 slots free, which is where NULL_BUFFER_VIEW = 999,998 now lands (pairs_end = null-1 = 999,997 still inside the reserve). Bonus: strides/marks buffers drop from 8+16 MiB to 4+8 MiB since they size by count.max(HEAP_VIEWS).
Heads-up on overlap: this and #2682 (rebase of #2177) fix the same out-of-heap clamp. #2682 additionally probes the real limit (tier-3 hosts could take the full 2M), reserves an explicit 24,576-slot pairs region plus the 3 reserved slots, and keys the shader cache by the probed limit since translated shaders embed the clamp constant. With HEAP_VIEWS=1_000_000 here, the clamp constant is stable so cache keying is not needed - the tradeoff is #2683's simplicity vs #2682's per-host probing and pairs budget. On a 1M-cap host both produce a 1M heap; they differ in how the capped interior is split (this: more title slots ~934K, ~1K pairs; #2682: ~844K titles, 24.5K pairs, 128K dynamic). Worth coordinating in #1633 which approach lands first since they rewrite the same block.
@kotekompotek on GitHub · 2026-11-25 18:46 UTC · original
Correct fix for a real device-removal bug: the clamp is arithmetic (cmp+select, not a mask), so 1_000_000 is safe; every successful heap is still >= HEAP_VIEWS via the .max(views) allocation; and in the capped path NULL_RESERVE keeps the top 1,024 slots free, which is where NULL_BUFFER_VIEW = 999,998 now lands (pairs_end = null-1 = 999,997 still inside the reserve). Bonus: strides/marks buffers drop from 8+16 MiB to 4+8 MiB since they size by count.max(HEAP_VIEWS).
Heads-up on overlap: this and #2682 (rebase of #2177) fix the same out-of-heap clamp. #2682 additionally probes the real limit (tier-3 hosts could take the full 2M), reserves an explicit 24,576-slot pairs region plus the 3 reserved slots, and keys the shader cache by the probed limit since translated shaders embed the clamp constant. With HEAP_VIEWS=1_000_000 here, the clamp constant is stable so cache keying is not needed - the tradeoff is #2683's simplicity vs #2682's per-host probing and pairs budget. On a 1M-cap host both produce a 1M heap; they differ in how the capped interior is split (this: ~934K title slots, ~1K pairs; #2682: ~844K titles, 24.5K pairs, 128K dynamic). Worth coordinating in #1633 which approach lands first since they rewrite the same block.
@Mericas77 on GitHub · 2026-11-25 18:51 UTC · original
Tested on NVIDIA: RTX 4070 (the only adapter), driver 621.01, Windows 11, rustc 1.98.1. Head
19ef8dd.main13f91caon the same machine:victory-gpu193 passed / 2 failed (dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views, the 1,000,000-view cap);victory-shader --lib(with--skip heap_direct_texture_reads_mark_their_heap_index, #2571) 266 / 3 failed (a_heap_buffer_read_by_element_takes_the_views_stride,a_heap_buffer_read_where_no_buffer_view_is_reads_zeroswithdispatch failed: E_INVALIDARG,gathers_at_a_level_match_the_hardware).With this PR:
a_heap_buffer_read_where_no_buffer_view_is_reads_zerosnow passes on NVIDIA hardware, and the twovictory-gpuheap-cap tests pass too.victory-shader: 267 passed, 2 failed. The two left are unchanged frommainand outside this PR:a_heap_buffer_read_by_element_takes_the_views_stride(the structured-view stride, #2178) andgathers_at_a_level_match_the_hardware.victory-gpu: 194 passed, 1 failed:frame::tests::waits_end_on_ticks_and_count_frames(frame.rs:231, left 0, right 1). This PR doesn't touchframe.rs, and the test passed onmainand on other branches in the same session, so it looks like a timing flake rather than this change. I only ran it once.So on NVIDIA this fixes 3 of the 5 known hardware failures. #2682 fixes the same three on this machine, with a runtime probe of the host's heap size instead of a fixed 1,000,000. No game data; the title was not run.
AI-assisted.
@welisonzika14-jpg on GitHub · 2026-11-25 19:08 UTC · original
For the limit question in @DrDarkDK's review: the RTX 5070 (Blackwell, driver 621.24) has the same cap as the 4070 Ti. A standalone
CreateDescriptorHeapprobe (binary search 1..2^24) gives exactly 1,000,000 for a shader-visible CBV/SRV/UAV heap; 1,000,001, 1<<20 and 1<<21 returnE_INVALIDARG. Non-visible heaps take every size up to 2^24, and the shader-visible sampler heap stops at 4,080. WARP takes 2^21. Full table and the probe code: #1744So on these NVIDIA cards the raw null slots at 999,997 and 999,998 sit at the very top of the largest heap the driver allows, which is why the reserve has to hold on every allocation path.
Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
@fuzeofficlal on GitHub · 2026-11-25 19:19 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP +
dxil.dllverification and code review of19ef8dd(on13f91ca):Verification (
rustc 1.98.1MSVC, Windows SDK10.0.26100.0dxil.dll)cargo clippy --locked -p victory-gpu -p victory-shader --all-targets -- -D warnings(and--features diagnostics): 0 warnings;cargo xtask policy: 184 files ok.cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1-> 198 passed, 0 failed, 1 ignored (fixes the 2 pre-existing #1744 1M-cap unit tests).VICTORY_D3D12_WARP=1): 198 passed, 0 failed, 1 ignored.victory-shader:emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zerospasses withdxil.dllactive.Bugs Found in Code Review
count ∈ [737_857, 934_464]still placeNULL_BUFFER_VIEW(999_998) and shader clamp (999_999) out of bounds or inside dynamic slots on 1M-capped GPUs:count = 800_000on RTX 5090,make((800_000 + 262_144).max(1_000_000))fails, and the fallbackmake(count + MIN_DYNAMIC)(make(865_536)) succeeds without.max(views). The resulting heap has only865_536slots whileNULL_BUFFER_VIEW = 999_998and the shader clamp999_999remain past the end of the heap (no null buffer views initialized,pairs = 0, out-of-bounds descriptor access / device removal).count = 934_464(1_000_000 - 65_536),make(1_000_000)succeeds withcount + extra = 1_000_000, placingNULL_BUFFER_VIEW = 999_998directly inside the live dynamic slot range[934_464..1_000_000).> 1Mtitle heaps on Tier-3 GPUs and WARP (which support2_097_152slots):HEAP_VIEWSfrom1 << 21to1_000_000forces shaders on Tier-3 hardware and WARP to clamp all indices to999_999even whenHostHeap::newcreates> 1Mslots (e.g.1_507_328for a1_245_184-slot title heap). Worse, becauseNULL_BUFFER_VIEW (999_998) < count + extra, null buffer views are never created at999_997/999_998—buffer_guardredirects guarded buffer reads straight onto live title slots999_997/999_998![934_464..999_997)still land inside live dynamic/pair slots rather than a null slot, andNULL_RESERVE = 1024leaves very little room forpairsbefore encroaching on the64_512dynamic slots.Compare with #2682 (runtime device-limit probing) and #2650 (runtime probing + sparse
VIEW_BLOCKSremapping, mutually exclusive with both #2682 and #2683).@pes7 on GitHub · 2026-11-25 19:34 UTC · original
Both points are right, and the second one is a real hole in what I wrote: I reserved the top of the heap only in the capped path, so in the two successful paths (
count + DYNAMIC,count + MIN_DYNAMIC) the null slots at 999 997/999 998 are inside the dynamic range - the guardnull > count + extrarejects them, and the clamp atHEAP_VIEWS - 1then names a slot that either is dynamic (a written descriptor read as a null) or, when the heap ends below 1 000 000, is outside it again. Your probe numbers (1 000 000 accepted, 1 196 608 rejected; 737 856 + 262 144 = 1 000 000) are exactly the boundary I should have handled.Fix in progress on this branch: every successful layout keeps
NULL_RESERVEslots free at the top (extra = min(extra, total - count - NULL_RESERVE)), sonull > count + extra && null < totalholds for all three paths, and the tests at 737 856 and 934 464 title slots assert the two raw null views are installed and that no dynamic slot reaches them. I will push it here rather than opening another PR.@pes7 on GitHub · 2026-11-25 19:38 UTC · original
Pushed in
541a320. Every layout now keeps the top of the heap free:so
count + extraendsNULL_RESERVEslots below the end of the heap that was actually made, and the guardnull > count + extra && null < totalholds in all three paths - the capped one (which already had it) and the two you measured on the 4070 Ti (737 856 title views withDYNAMIC, 934 464 withMIN_DYNAMIC, both on a 1 000 000-slot heap: dynamic ranges now end at 998 976).cargo build --release,cargo clippy -p victory-gpu --all-targets -- -D warnings,cargo test -p victory-gpuall clean.Not done yet, and I would rather say it than imply otherwise: the tests at those two title-count boundaries. They need a heap of 1 000 000 descriptors and a title-count of 737 856, which is 32 MB of descriptor heap per case;
descriptor::hosthas no test harness that makes heaps today, and I do not want to land one built in a hurry. If you want them before merge, say so and I will add a small harness (HostHeap::newwith a given count and total, then assert the two raw null views are installed and that the dynamic ring never returns 999 997/999 998) - the shape of the test is clear, it is the plumbing that needs care.@fuzeofficlal on GitHub · 2026-11-25 20:01 UTC · original
Checked
541a320—extra = extra.min(total.saturating_sub(count).saturating_sub(NULL_RESERVE))fixes the737_856and934_464exact-1M cases, but one line in theMIN_DYNAMICfallback still leavescount ∈ [737_857, 934_463]broken on 1M-capped GPUs:Take
count = 800_000on a 1,000,000-cap host (views = HEAP_VIEWS = 1_000_000):make((800_000 + 262_144).max(1_000_000))=make(1_062_144)fails.make(count + MIN_DYNAMIC)=make(865_536)succeeds withtotal = 865_536(< 1_000_000).NULL_BUFFER_VIEWis999_998, sonull < total(999_998 < 865_536) isfalse: the two raw null views are skipped ("no room for the null buffer views..."), and any shader clamping an index toHEAP_VIEWS - 1 = 999_999still reads past the end of the 865,536-slot heap.Changing that line to
match make((count + MIN_DYNAMIC).max(views))ensurestotal >= 1_000_000across the entire[737_857, 934_464]range (and atcount >= 934_465,count + MIN_DYNAMIC > PORTABLE_VIEWSdrops cleanly into the cappedmake(PORTABLE_VIEWS)arm).Also worth keeping in mind for Tier-3 / WARP hosts (where
make(> 1_000_000)succeeds): forcount >= 737_857,make((count + DYNAMIC).max(views))succeeds withcount + extra > 1_000_000, sonull = 999_998falls inside[count..count + extra)(or inside[0..count)ifcount >= 1_000_000), trippingnull > count + extraand causingHEAP_VIEWS - 1clamps to alias a live dynamic/title slot (in addition to capping title indices below1_000_000on Tier-3 hardware where1 << 21previously worked).@qtLkz on GitHub · 2026-11-25 20:53 UTC · original
Tested on NVIDIA, where the view heap is capped at 1,000,000: RTX 4070 Ti (Ada), driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned, this PR merged onto main
13f91ca(clean merge). Compared with plain13f91caon the same card:13f91cacargo test -p victory-gpu --lib --lockedcargo test -p victory-shader --lib --locked -- --test-threads=1 --skip heap_direct_texture_reads_mark_their_heap_indexNow passing on NVIDIA:
descriptor::host::tests::dynamic_slots_are_held_until_released(wasNumDescriptors >= HEAP_VIEWS)memory::tests::lists_share_a_table_and_copies_keep_their_viewsstride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros(wasdispatch failed: E_INVALIDARG)Still failing, as on main, and not touched by this PR:
stride_tests::a_heap_buffer_read_by_element_takes_the_views_strideandsynthetic_tests::gathers_at_a_level_match_the_hardware(#2317).So of the 5 NVIDIA workspace failures in #2317, this PR clears 3, the heap-cap ones that #2315 was closed for. HostHeap still gets created here, so no "no view heap at all" regression on this card. (
heap_direct_texture_reads_mark_their_heap_indexwas skipped because it crashes the NVIDIA driver on main, #2571; fix in #2596 / #2587.)AI-assisted (Claude).
@Marvisak on GitHub · 2026-11-25 22:17 UTC · original
Automated triage for the maintainers.
Needs work. The direction is right (the clamp must not point past any heap a host can make, and the hardware runs in the comments show three NVIDIA failures going away), but at
541a320two layouts are still wrong inHostHeap::new(crates/victory-gpu/src/descriptor/host.rs):MIN_DYNAMICfallback can make a heap smaller than the clamp.make(count + MIN_DYNAMIC)has no.max(views), so on a 1,000,000-capped host a title count between 737,857 and 934,463 gets a heap ofcount + 65,536slots (e.g. 865,536 for 800,000).NULL_BUFFER_VIEW(999,998) is then outside the heap, the null views are not installed, and an index clamped to 999,999 still reads past the end, which is the bug this PR fixes.make((count + MIN_DYNAMIC).max(views))closes it (as fuzeofficlal pointed out).HEAP_VIEWS = 1_000_000a title asking for more than that (the reported 1,245,184) gets a 1.5M heap, but its indices are clamped below 1,000,000.NULL_BUFFER_VIEWthen lands inside the title range, so the guard refuses the null views and a guarded read takes a live title slot instead of a null one. Either keep the reserve consistent for that case or say clearly that this trade is intended.What would change the verdict: the fallback fix plus the small heap-layout tests you offered (the 737,856 / 800,000 / 934,464 boundaries, checking that the two null views are installed and that no dynamic slot reaches them). Also note this rewrites the same block as #2682 (now needing a rebase) and #2650; the maintainer will want one of them, not all three.
CI:
checkpassing on this head.Generated by Claude Code
@qtLkz on GitHub · 2026-11-25 22:31 UTC · original
The fallback fix and the boundary test asked for in the triage, verified on a capped (1,000,000) NVIDIA heap: RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, Rust 1.98.1, on top of this PR's head
541a320.One commit, cherry-pickable: https://github.com/qtLkz/VIctory/tree/pr2683-null-views
HostHeap::new:make(count + MIN_DYNAMIC)becomesmake((count + MIN_DYNAMIC).max(views)), as fuzeofficlal suggested.descriptor::host::tests::null_buffer_views_stay_in_the_heap_above_the_dynamic_slots: for 737,856 / 800,000 / 934,464 title views,NULL_BUFFER_VIEWis inside the heap andcount + dynamic < NULL_BUFFER_VIEW - 1, so both null views get installed and no dynamic slot reaches them.Before the fix (test only, this PR's head) the test fails on this card, as the triage predicted:
(737,856 passes even before: 737,856 + DYNAMIC = 1,000,000 exactly, so it takes the first path.)
With the fix:
cargo test -p victory-gpu --lib --lockedgives 196 passed, 0 failed (the 195 from before plus the new test). Same result twice.To apply it on your branch:
Not addressed here, and left to you: the second point, about hosts above 1,000,000 (WARP, tier 3) with a title count past
HEAP_VIEWS. That's a design choice (keep the reserve consistent, or document the trade), not something this card can test, since it never makes a heap that large.AI-assisted (Claude).
@KainanP on GitHub · 2026-11-25 22:53 UTC · original
Measured in the #2571 comparison: with this PR,
heap_direct_texture_reads_mark_their_heap_indexstill ends the process with 0xc0000005 on an RTX 4060, so it is not a fix for that crash (judged here only on #2571): #2571 (AI-assisted)@DrDarkDK on GitHub · 2026-11-25 18:14 UTC · original · requested changes
NULL_RESERVEonly applies after both allocation attempts fail. On an RTX 4070 Ti (driver 621.01), my standalone D3D12 probe accepted 1,000,000 views and rejected 1,196,608. Those results expose two successful paths inHostHeap::newthat skip installing the raw null descriptors:count + DYNAMICcount + MIN_DYNAMICBoth dynamic ranges include the shader’s raw null UAV/SRV slots,
999_997and999_998. The initialization guard skips them, and later allocations can reuse them. Could every successful layout reserve the null slots? Tests at both title-count boundaries would cover this.I verified heap creation on hardware and traced the layout in source. I didn’t run the PR or the title.
AI-assisted with Codex.
@DrDarkDK on GitHub · 2026-11-25 19:50 UTC · original · approved these changes
@pes7 on GitHub · 2026-11-26 13:33 UTC · original
The review's item is done: the small-dynamic-range path asked for
count + MIN_DYNAMICwith no floor, so 800 000 title views made an 865 536-slot heap while translated shaders clamp their indices belowHEAP_VIEWS= 1 000 000 - every index in 865 536..999 999 was out of bounds.595994ffixes it.The >1M case, decided. The capped layout is now taken on every host, tier-3 ones included, as soon as
count + MIN_DYNAMIC > PORTABLE_VIEWS:HEAP_VIEWS, so a heap could be made for a title past 934 464 slots - but the shaders clamp toHEAP_VIEWS - 1, so the dynamic slots a list takes above that clamp would be unreachable by any shader. Making the layout uniform costs a title that large some title slots (the ones past 934 464) and keeps, everywhere, the invariant the clamp needs and the null buffer views at the top of the heap. The trade is written down beside the code ("shortcut: descriptors past the limit are left out; a title that reaches them needs remapping"), which is the same sentence the capped path had.#2682/#2650remain the alternative if runtime probing is preferred over a uniform layout; this PR is the conservative version and does not depend on probing.The layout is now two pure functions, so the boundaries are testable without a GPU:
capped_layout(count)Some((slots, dynamic))whencount + MIN_DYNAMIC > PORTABLE_VIEWS, elseNonesmall_request(count, views)(count + MIN_DYNAMIC).max(views)- the heap asked for when the host refuses the large dynamic rangeTests (
cargo test --release -p victory-gpu: all green):the_capped_layout_and_the_small_range_fit_the_clamp_shaders_use- the review's counts 737 856 / 800 000 / 934 464 fit and are asked for at leastHEAP_VIEWS; 934 465 / 1 000 000 / 1 050 000 take the capped layout, whoseslots + dynamic + NULL_RESERVEcloses insideHEAP_VIEWS. Put the previous expression back and it fails witha heap of 65536 is short of the clamp 1000000, so the test does hold the bug.a_heap_has_every_slot_shaders_clamp_to- the same invariants on a heap this host actually makes (every clamped slot exists,count + dynamic + NULL_RESERVEinside the heap, the pairs end inside it), skipped where no heap can be made.No measured frame-time claim here: this is a correctness fix for capped hosts (the NVIDIA 1M case); on this AMD host the large dynamic range is taken and the capped path is never entered, which is why the host-independent test above exists.
@qtLkz on GitHub · 2026-11-26 15:35 UTC · original
@pes7 Tested
595994fon a capped NVIDIA heap. Setup: RTX 4070 Ti (Ada), driver 621.01, Windows 11 Pro 26300, Rust 1.98.1. The PR head was tested on its own base13f91ca, without other PRs.Your two new tests pass on hardware:
descriptor::host::tests::the_capped_layout_and_the_small_range_fit_the_clamp_shaders_use ... okdescriptor::host::tests::a_heap_has_every_slot_shaders_clamp_to ... oka_heap_has_every_slot_shaders_clamp_tosilentlycontinues when no heap can be made. To check that it really runs here, I added a temporary localeprintln!and reverted it afterwards. Every heap was made on this 1,000,000-capped host:countdynamicpairs_endThe heap is never shorter than
HEAP_VIEWS. The dynamic range always ends at or below 998,976, under both null views (999,997 andNULL_BUFFER_VIEW= 999,998). The 800,000 case, which made an 865,536-slot heap at541a320, now gets the full 1,000,000. This covers what my test onpr2683-null-viewschecked, so that branch is no longer needed.Full suites (
cargo test -p <crate> --lib --locked -- --test-threads=1):dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, which fail on this card without the PR.a_heap_buffer_read_where_no_buffer_view_is_reads_zerosnow passes, while it fails withdispatch failedwithout the PR. The two failures are the known NVIDIA raw-read-through-structured-view issue fixed by #2885, not this PR:stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride([101, 104, 107, ...]instead of[200, 201, ...])synthetic_tests::gathers_at_a_level_match_the_hardwareemit::memory_tests::heap_direct_texture_reads_mark_their_heap_indexwas skipped, because it crashes the NVIDIA driver (#2571, fixed by #2596/#2587, not by this PR).Not tested: the tier-3 / WARP side of the uniform capped layout (this card never makes a heap above 1,000,000), and a merge with current
main.AI-assisted (Claude).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.