GPU: size the view heap clamp from what the host takes (NVIDIA 1,000,000 cap) #1777
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!1777
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1777"
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?
@antoinerz1 on GitHub · 2026-11-24 22:22 UTC · original
antoinerz1:fix/nvidia-view-heap-cap→main· +280 −66 · 9 files · 4 commits · openProblem
Translated shaders clamp view heap indices below a fixed
HEAP_VIEWS = 1 << 21(2,097,152) and read the null buffer views atHEAP_VIEWS - 2. NVIDIA refuses shader-visible CBV/SRV/UAV heaps over 1,000,000 descriptors. So on NVIDIA:This is the in-title failure in #1627 and #1620. It also accounts for 4 of the 5 unit-test failures in #1744.
Change
victory_shader::emit::heap_views()replaces theHEAP_VIEWSconstant. It is 2^21 (HEAP_VIEWS_MAX) where the default adapter creates a heap that large, else 1,000,000 (HEAP_VIEWS_PORTABLE). The value is fixed for the process at first use.null_buffer_view()follows it.heap_views()slots. A capped heap keeps the dynamic slots and the null buffer views below the clamped index. As before, the title's slots past them are left out.a_capped_view_heap_keeps_the_null_buffer_views.AMD and other hosts that take a 2^21 heap get the same translation and layout as before. Only their cache key changes, so their cached shaders are translated once more.
Testing
RTX 4060 Ti, driver 610.88, Windows 11, Rust 1.98.1.
cargo test --workspace --no-fail-fast:main(70564ae)Now passing:
dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views,a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, plus the new test.Two failures remain. Both are NVIDIA-only and unrelated to the cap:
a_heap_buffer_read_by_element_takes_the_views_stride: #1744 attributed this one to the cap by elimination, but it still fails with the cap fixed. The shader reads a structured SRV (stride 12) through a raw-annotated handle (kind 11), which D3D12 leaves undefined. NVIDIA returns elementbyte_address / 4(got101 + 3l).gathers_at_a_level_match_the_hardware: the gather footprint rounds differently on this GPU.Clippy is clean.
cargo fmt --checkalready fails onmainin files this PR does not touch; the changed lines are formatted. Not tested in title: no game run, and no AMD run on my side.🤖 Generated with Claude Code
`heap_views()` asked the default adapter whether it takes a 2^21-slot view heap. With the diagnostics build's `VICTORY_D3D12_WARP=1` on an NVIDIA machine, the host device is WARP (whose heap holds all 1,245,184 title slots) while the clamp came from NVIDIA's 1,000,000: shaders could not reach title slots past 1,000,000, and the null buffer views fell among the title's ("no room for the null buffer views" in the log). - `takes_view_heap` probes WARP when told to. - `victory_shader::emit::heap_views_on_warp()` tells it, before the size is fixed; victory-gpu's `host::on_warp()` decides once and calls it from the shader cache key and the device creation. Checked on an RTX 4060 Ti with the title: the WARP run no longer caps the clamp or warns about the null buffer views; the hardware run still caps it at 1,000,000. `cargo test -p victory-gpu -p victory-shader --lib`: same results as before (2 known NVIDIA-only failures, #1744). Co-Authored-By: Claude Opus 5.5 <[email protected]>@DesertGamer on GitHub · 2026-11-24 22:24 UTC · original
VIctory V2: community PRs, merged and tested
Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.
Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).
⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.
Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2
Unofficial community fork of Marvisak/VIctory, GPL-3.0.
@upipibi on GitHub · 2026-11-24 22:30 UTC · original
Overlap for the reviewers: two other open PRs change the same capped-heap path (NVIDIA's 1,000,000-descriptor cap, #1744).
DYNAMICrange (descriptor/host.rsonly); on an RTX 3070 it fixes the twovictory-gputests that fail onmain.descriptor/host.rs,draw.rs,shader_cache.rsand thevictory-shaderclamp (emit/shader.rs,lower.rs), so it overlaps both this PR and #1751.This PR edits the same
emit/shader.rs/shader_cache.rsclamp as #1779. From reading the file lists and descriptions; nothing built here.AI-assisted (Claude Code).
@tdogghockey on GitHub · 2026-11-24 23:17 UTC · original
AMD test report for this PR (the PR body asks for an AMD run).
Hardware: AMD Radeon RX 9070 XT (device id 0x7550), driver 32.0.32015.16001; Windows 11 build 26300; Rust 1.98.1 MSVC.
Branch tested:
pull/1777/headat3635e704e7d7037bc97227d6a196258bb464c8ee.Command:
Result: 288 passed, 0 failed, 3 ignored (victory-shader 209 passed / 2 ignored; victory-gpu 79 passed / 1 ignored).
In particular, the new
descriptor::host::tests::a_capped_view_heap_keeps_the_null_buffer_views,dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views,a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,gathers_at_a_level_match_the_hardware, anda_heap_buffer_read_by_element_takes_the_views_strideall pass on this RDNA4 host.No regressions seen on AMD, and no game files were used. This is a test-only confirmation; I have not run the title.
@AlanQiang0418 on GitHub · 2026-11-24 23:48 UTC · original
I found a boundary case on an RTX 5080 (621.14) at
3635e70. A view heap can successfully allocate all 1,000,000 slots while the title and dynamic ranges extend into the three slots reserved for the null UAV, null SRV and clamp index.[0, 0, 0][4, 4, 0]The first row also skips creation of both null descriptors. I checked the allocation and mapped stride table directly.
Follow-up commit with the fix and a two-threshold regression. It reserves the final three slots for either successful dynamic allocation size. All ten requests then gave a limit of 999,997 and strides of
[4, 4, 0]. Thevictory-gpulibrary suite passed (80 passed, 1 ignored), as did the existing shader empty-slot readback test and GPU all-targets Clippy.@tigre437 on GitHub · 2026-11-25 00:40 UTC · original
Tested on Ampere: RTX 3060 Ti, driver 617.42, Windows 11 (build 26300), Rust 1.98.1.
cargo test --workspace --locked --no-fail-fast:main(70564ae)Same numbers as your RTX 4060 Ti run.
a_capped_view_heap_keeps_the_null_buffer_viewspasses, and so dodynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsanda_heap_buffer_read_where_no_buffer_view_is_reads_zeros. Onmain, that last one failed with "dispatch failed: the parameter is incorrect".The two that remain fail exactly as you describe:
a_heap_buffer_read_by_element_takes_the_views_stride: got[101, 104, 107, …, 131, 0, …], expected[200, 201, …], which is101 + 3l.gathers_at_a_level_match_the_hardware: lane 0 got[0.0, 1.0, 0.0, 0.0], expected all zeros.So this isn't specific to Ada: Ampere behaves the same. Unit tests only, not tested in title.
@Marvisak on GitHub · 2026-11-25 02:17 UTC · original · edited 2026-11-26 01:19 UTC
Automated triage for the maintainers.
Merge candidate. The head is rebased and now merges cleanly. It addresses the open point from the previous review:
victory-shaderno longer opens a device outside its own tests.victory_gpu::host::heap_viewsprobes the adapter thatcreateuses (WARP underVICTORY_D3D12_WARP, otherwise the default adapter) and passes the result to the translator withemit::set_heap_views.shader_cache::host_shadercalls it before translating. If a translation ran first, it logs a warning. The shader-cache key and the pipeline-librarytagboth include the value. InHostHeap::new, a capped heap now hasviewsslots withviews - MIN_DYNAMIC - 3title slots. A heap of exactlyviewsslots keeps its last three for the null UAV, null SRV and clamped index, which covers AlanQiang0418's boundary case. The read-mark bitmaps inshadow.rsstay sized atHEAP_VIEWS_MAX, so they cover every clamped index. CI (check) passes on this head.Overlap: #1779 changes the same clamp and no longer merges cleanly. #1751 only widens the dynamic range in
descriptor/host.rs. This PR is the more complete of the three.Generated by Claude Code
@r4tedx on GitHub · 2026-11-25 07:08 UTC · original
A review note on
3635e70, from reading it (not built or run here), about how the clamp is chosen. The slot-boundary case is already above (AlanQiang0418); this is a different one.heap_views()(emit/shader.rs) decides the clamp once per process throughemit::host::takes_view_heap, which callsD3D12CreateDevice(None, …)and tries a shader-visible heap ofHEAP_VIEWS_MAX(2^21) slots on it. Two consequences:VICTORY_WARP=1the shader tests still create a device on the default hardware adapter for this probe, and so does an offlinevictory translatecount, sinceapps/victorybuildsvictory-shaderwith itshostfeature. On machines where testers keep test and offline runs off the hardware GPU (some of us do, after PC shutdowns under load), merging this would bring the GPU back into those runs without anyone noticing.victory-gpucreates, which is WARP withVICTORY_D3D12_WARPin a diagnostics build, or whatever adapter it selects. The probe always asks the default adapter. If the two differ (WARP runtime on an NVIDIA machine, or a hybrid laptop), the shaders are translated for one heap and run against the other. The shader cache key carries the value, so the cache stays consistent, but the clamp can still be larger than the heap actually made.A shape that avoids both, if it fits your design: let
victory-gpupass the size of the heap it actually created into translation (it already keys the cache on the value), and keep the probe out ofvictory-shaderentirely; offline translation would then use the portable value or one given on the command line.Nothing was run for this note. AI-assisted.
@CruxRiajuu on GitHub · 2026-11-25 11:42 UTC · original · edited 2026-11-25 17:01 UTC
Reproduced on an NVIDIA card with the
integration/playtree - the branch that carries #1751 - so this may be the same failure #1751 addresses, or a different one.Machine
r4tedx/VIctoryintegration/play@08c1d3541("a playable candidate for NVIDIA"), base upstreammainat940d32fcargo build --profile diag -p victory --features diagnosticsVariables:
VICTORY_ROOT_SRV_MB=0,VICTORY_PRESENT_1440P=1,VICTORY_SHADER_LOOP_LIMIT=32,VICTORY_D3D12_DRED=1,VICTORY_D3D12_DEBUG=1.The removal
caa78b8ca62bc3d6is not one of the programs that fail to translate - it translated, and it hung the GPU. Its descriptor tables reference placed resources across several heaps, which matches the clamp letting an index past the heap's end through.It is a hang, not a slow frame.
TdrDelay=60andTdrDdiDelay=60were set underHKLM\SYSTEM\CurrentControlSet\Control\GraphicsDriversand the device was removed anyway.The heap-index evidence
The title's own log names the fault directly -
title slot past the host heap, which INTEGRATION.md asks reporters for:Over the run:
title slot past the host heapwarningscount=)for_drawa root SRV without a bound view heapa draw or dispatch dropped: no dynamic slots for its tablesa root SRV not on 16 bytes reads zerosThe host heap fell back to 934,464 descriptors - under NVIDIA's 1,000,000 cap - and the clamp lets indices run from exactly the heap's end (934,464) up to 1,086,453, i.e. past the heap's end and past the cap. That is the failure this issue describes, with the highest index for the report.
The other three log lines INTEGRATION.md asks for do not appear in this run.
Where it happens. After the world loads and renders - the last presented frame before the removal was 86,137 draws and 27,530 dispatches, all of them drawn - and it removed the device four times over the run.
Happy to test a build with #1777 taken on this card if it would help narrow it.
@CruxRiajuu on GitHub · 2026-11-25 12:04 UTC · original
Follow-up to the report above: the index keeps climbing, so the figure I gave is a floor rather than a ceiling.
A second, longer run on the same tree and card (same
integration/play@08c1d3541, same variables, warm shader cache) ran on for much longer before the removal and reported:title slot past the host heapwarningsThe clamp is
HEAP_VIEWS = 1 << 21(2,097,152), so the indices are still climbing toward it rather than saturating at any fixed point. The host heap stays at 934,464 in both runs.For reference,
a root SRV without a bound view heap,a draw or dispatch dropped: no dynamic slots for its tablesanda root SRV not on 16 bytes reads zerosdo not appear in either run.The second run removed the device 0 times against 4 in the first, with the same tree - the difference was a warm shader cache (4,605 shaders) rather than anything about the fault, so the crash looks timing-dependent and the index above is the reliable signal.
@CruxRiajuu on GitHub · 2026-11-25 12:20 UTC · original · edited 2026-11-25 17:01 UTC
Third note on this one, and the most useful part for anyone else testing
integration/playon an NVIDIA card.The failure presents as an infinite relaunch loop, not a crash.
After the device is removed, the title asks VI to relaunch it (
xgame.rs- "Auto VI relaunches itself"), andlifecycle.rsspawns a freshvictory. So on screen this is:A tester who does not read the log sees the same loading image over and over and no progress past it. There is no crash dialog and no error on screen. I lost a while to this myself before noticing the
victory.exeprocess changing PID.VICTORY_SKIP_PIPELINES=caa78b8ca62bc3d6omits the draws and dispatches whose pipeline contains that hash, so the hanging dispatch is skipped. That is how I get a run that stays in the world instead of cycling.For the record, on this tree:
integration/play@08c1d3541title slot past the host heapfor_draw=falsein all of thema root SRV without a bound view heapa draw or dispatch dropped: no dynamic slots for its tablesa root SRV not on 16 bytes reads zeros#1133is already in this tree and the heap warnings are being clamped to a null slot by it, so the warnings alone do not fault the device - the hang is the dispatch above.@tigre437 on GitHub · 2026-11-25 13:26 UTC · original
Re-tested after the rebase, on the same RTX 3060 Ti (Ampere, driver 617.42, Windows 11 build 26300, Rust 1.98.1).
cargo test --workspace --locked --no-fail-fast:main(940d32f)This branch fixes
dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsanda_heap_buffer_read_where_no_buffer_view_is_reads_zeros, anda_capped_view_heap_keeps_the_null_buffer_viewspasses. The two that remain are the same NVIDIA ones as before, with identical values:a_heap_buffer_read_by_element_takes_the_views_stride(101 + 3l) andgathers_at_a_level_match_the_hardware(lane 0[0.0, 1.0, 0.0, 0.0]).The sixth failure on
mainis unrelated to this PR.modules::dstorage::tests::a_page_list_filled_after_its_request_startsreturned-2147024809(E_INVALIDARG) once, in the full-workspace run. It then passed 10/10 on its own and in 8/8 runs of the wholevictory-hlesuite, so it looks timing-dependent.A note from reading 318b877, not from a run: the WARP probe is only reached through
victory_gpu::host::on_warp()(VICTORY_D3D12_WARP, diagnostics builds).victory_shader::emit::host::Host::newwithVICTORY_WARP=1doesn't callheap_views_on_warp(), so the shader tests underVICTORY_WARP=1, and an offlinetranslate, still probe the default hardware adapter. That's r4tedx's first point, which looks still open for those paths.Unit tests only, not tested in title.
@antoinerz1 on GitHub · 2026-11-25 16:34 UTC · original
Rebased onto current
main(bd76752) and added a fix for the boundary case AlanQiang0418 found: a heap of exactlyheap_views()slots now trims the title and dynamic range below the last three slots, following their suggested approach (thanks!). New regression testa_range_ending_at_the_heap_end_keeps_the_null_buffer_viewscovers both dynamic ranges; it fails without the fix.RTX 4060 Ti:
victory-gpulib 197 passed / 0 failed;victory-shaderlib 267 passed / 2 failed (the two known NVIDIA-only ones, vs 3 onmain). Note:memory_tests::heap_direct_texture_reads_mark_their_heap_indexcrashes with an access violation on this card onmaintoo, so it is unrelated to this PR.@antoinerz1 on GitHub · 2026-11-25 21:21 UTC · original
Follow-up for the open point from r4tedx and tigre437 (a61059f): the translator no longer probes a device.
victory-gpudecides the view heap size once, from the adapter its device is made on (WARP underVICTORY_D3D12_WARP, else the default one), and hands it to the translator withemit::set_heap_viewsbefore any translation; the shader cache key,host_shader, the pipeline library tag and the descriptor heaps all go throughhost::heap_views(). Without a host the translator uses 2^21 as before, and its own tests probe their test host's adapter (WARP withVICTORY_WARP=1). The cache warm-up (victory translate --cache) still asks the host's adapter, since its entries must carry the runtime's key; plain offline translation opens no device.RTX 4060 Ti:
cargo test --workspace778 passed / 2 failed (the two known NVIDIA-only shader tests) / 9 ignored, withheap_direct_texture_reads_mark_their_heap_indexskipped (crashes onmaintoo);VICTORY_WARP=1stride tests 8/8.@Luqueze on GitHub · 2026-11-26 02:21 UTC · original
Tested in title on Ada: RTX 4070 SUPER (12 GB), driver 617.42 (32.0.16.1742), Windows 11 26300, Ryzen 7 5700X3D, 32 GB RAM, Rust 1.98.1. Series 1.0.2.1 (
b99f876b74d4a77f), Series X profile, default TdrDelay.Unit tests.
cargo test -p victory-gpu --lib:main(63bcca4)cbb9d78)The two fixed are
dynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views.victory-shaderstill dies inheap_direct_texture_reads_mark_their_heap_index(#2571) on both, unrelated.In title it does not stop the world hang on this card. Each build with its own fresh
translate --cache --pipelines(same counts on both: 25,756 programs translated, 23,113 pipelines made, 397 refused by the host, so those are not about the heap).main, release0x887A0004/0x887A0006after 28 lists, ~1.5 min of world at 0.1-0.3 fps firstmain, diag,VICTORY_D3D12_DRED=1VICTORY_D3D12_DRED=1With this branch the log says
the host caps view heaps: shader heap indices clamped below it views=1000000andhost view heap capped at 1000000 ... count=1245184 kept=934461, then still 310,723title slot past the host heap. The last submission took 5,213 ms, and DRED stops at the same dispatch as onmain:Everything queued after it had not started. On
main(run 2) it was command 8 of 11 of the same shader. So here the clamp keeps out-of-range indices away from the device, but00167d58cc5a78d7still runs past the TDR with the title's slots above 934,461 left out (the stall #1760 removed withP = 140, not tried here). This differs from the 35 min RTX 3050 result in #1760; one run per build, so I can't rule out run-to-run variance.AI-assisted (Claude Code); the runs are mine.
@DenRakEiw on GitHub · 2026-11-24 22:26 UTC · original · approved these changes
Verified locally merged onto
origin/main(70564ae, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):cargo test -p victory-gpu— 79 passed, 0 failed (1 ignored) on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(includinga_capped_view_heap_keeps_the_null_buffer_views— directly resolves the 2 NVIDIAHEAP_VIEWStest failures onorigin/main70564ae!)cargo clippy -p victory-gpu -p victory-shader --all-targets— 0 warningscargo xtask policy— okGreat fix dynamically sizing the view heap clamp from what the host adapter supports while preserving the null buffer views and shader cache keys. Confirmed green on NVIDIA RTX 5090.
AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-24 23:03 UTC · original · reviewed
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
View-heap clamp sized from what the host actually takes (NVIDIA 1,000,000-descriptor cap): 21K diff across gpu+shader. The clamp must never reject a title that worked before — worth a Windows run on a title with large descriptor tables.
@Xvania7 on GitHub · 2026-11-25 11:51 UTC · original · approved these changes
Verified
318b877on Windows 10 + NVIDIA GeForce RTX 5060 (hardware with 1,000,000 descriptor heap limit):descriptor::host::tests::dynamic_slots_are_held_until_releasednow passes on NVIDIA hardware (resolves the 1M heap assertion)descriptor::host::tests::a_capped_view_heap_keeps_the_null_buffer_views(passed)descriptor::host::tests::passed (6/6)cargo clippy -p victory-gpu --all-targets -- -D warnings&-p victory-shader: 0 warningscargo xtask policy: 182 files okCrucial fix for NVIDIA host heap constraints. Approving.
@LuvAbyss on GitHub · 2026-11-26 05:27 UTC · original · reviewed
Tested on Ampere: RTX 3080 (10 GB), driver 621.35, Windows 11 26300, Rust 1.98.1. Branch
cbb9d78merged locally onto currentmain(63bcca4); the merge is clean and builds.Tests,
cargo test --release --workspace --no-fail-fast:main(63bcca4)maindynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_viewspass; both new tests pass.victory-gpu --libalone: 229/2 onmain, 233/0 here, twice each. The remaining failures are the same on both sides and unrelated:victory-shaderdies inheap_direct_texture_reads_mark_their_heap_index(#2571), andxtask's policy test caught a stray local file of mine.One flake to note:
shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changedfailed once in the full workspace run on this branch. It passed 3/3 alone and in two fullvictory-gpuruns, so I read it as contention, not this change.Read through the change. Points I checked:
D3D12CreateDevice(None, …), or WARP in both), so a hybrid laptop can't size the clamp from the wrong GPU.runor the cache goes throughshader_cache::host_shader, which fixesheap_views()before translating. So theOnceLockcan't be set to 2^21 by an earlier translation in those paths.viewsslots:extra.min(end - count)keepscount + extra <= null - 1, so the null UAV, the null SRV and the clamped slot are always free.HEAP_VIEWS_MAX, which covers every index either clamp lets through.Minor, not a regression:
victory translatewithout--cache(the validator) callsemit::emit_withdirectly and never asksvictory_gpu::host::heap_views(). On NVIDIA it still translates with 2^21, and from reading the code its validationHostwould then ask for a 2^21 heap where a shader hasView::NullBuffers(I didn't run that path). It was the same before this PR; it could callset_heap_viewsup front in a follow-up.In title (Series 1.0.2.1,
b99f876b74d4a77f; freshtranslate --cache --pipelineson this branch, 17 min, 23,128 pipelines made): the size is detected (the host caps view heaps: shader heap indices clamped below it views=1000000), but the run ends after about 35 s, in the loading screens, exactly as #1808 reports:Memory wasn't the limit (the title's own crash report: 16 GB physical and 11.8 GB of paging file free). So on Ampere this PR makes the shaders' clamp and null views correct, but the title still writes its descriptors at about 1.17M, past the 934,461 slots kept, and the
+0x258b000null write remains. That needs the remapping theshortcut:comment mentions (or whatever #1763 does that made it go away on the 4090 in #1808). I'd describe this PR as fixing the tests and the shader side of #1808, not the crash.@fuzeofficlal on GitHub · 2026-11-26 14:53 UTC · original · requested changes
Tested merged onto
origin/main(63bcca43) on an RTX 5090 (NVIDIA 1,000,000 shader-visible view heap cap) and on WARP (VICTORY_D3D12_WARP=1, 2,097,152 uncapped) withVICTORY_D3D12_DEBUG=1and the SDKdxil.dll.Blocking issue:
host::create()latchesvictory_shader::emit::HEAP_VIEWSto2_097_152beforehost::heap_views()runsWhenever
victory_gpu::host::host()runs beforecrate::host::heap_views()(orshader_cache::use_shader_cache()),create()executes:crates/victory-gpu/src/host.rs:242:victory_shader::emit::host::Host::from_device(device.clone()).fuses_fmad()crates/victory-shader/src/emit/host.rs:639->fmad_probe()(emit/host.rs:772) lowers a synthetic compute shader with a descriptor-table UAV, which callsShader::handle_from_heap(emit/shader.rs:584) ->victory_shader::emit::heap_views()(emit/shader.rs:52).victory-shaderis compiled without#[cfg(test)]when linked intovictory-gpu,victory_shader::emit::heap_views()permanently initializes itsOnceLocktoHEAP_VIEWS_MAX(2_097_152).crate::host::heap_views()(crates/victory-gpu/src/host.rs:302-323) later probes the NVIDIA adapter (takes = 1_000_000),victory_shader::emit::set_heap_views(1_000_000)(host.rs:311) returns the already-latched2_097_152, andcrate::host::heap_views()caches2_097_152for the rest of the process.HostHeap::new()(crates/victory-gpu/src/descriptor/host.rs:152-172), bothmake((count + DYNAMIC).max(views))andmake((count + MIN_DYNAMIC).max(views))then request2_097_152descriptors and fail on NVIDIA, while the cap branch atdescriptor/host.rs:161(count + MIN_DYNAMIC + 3 > views) isfalsefor every normal heap withcount <= 2_031_613, causingHostHeap::new()to returnNone.Repro on RTX 5090 (masked on WARP because WARP accepts
2_097_152, and masked invictory runonly becauseapps/victory/src/run.rs:80happens to calluse_shader_cache()first):cargo test -p victory-gpu --lib bindless::tests::heap_views_are_currentfails 100% deterministically (panicked at cratesictory-gpu\srcindless.rs:668:43: a host view heap), withtakes = 1_000_000vs latchedviews = 2_097_152.cargo test -p victory-gpu --lib -- --test-threads=1fails 20/233 tests (bindless::,descriptor::host::,descriptor::,draw::,host::) with the samea host view heapfailure.cargo test -p victory-gpu --libis racy on NVIDIA (failed 20/233 wheneverhost::create()beat a test that calledhost::heap_views()directly).Suggested fix:
Initialize
heap_viewsinhost::create()before thefuses_fmad()probe atcrates/victory-gpu/src/host.rs:242(ideally probing the already-created&devicesocreate()does not need a secondD3D12CreateDevicecall). Verified locally on RTX 5090 that callingheap_views()right beforefuses_fmad()flipsbindless::tests::heap_views_are_currentto passing and bringscargo test -p victory-gpu --lib -- --test-threads=1from 20 failures to 233/233 passed.What verified cleanly
origin/main(63bcca43); mergedcrates/victory-shader/src/emit/lower.rsis520,567 B(3,721 Bunder the 512 KiB limit).cargo run -p xtask -- policy(191 files ok) andclippy(default and--all-features) pass cleanly.victory-shaderemit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zerosflips from failing (E_INVALIDARGonorigin/main) to passing (7/8stride_testspass on RTX 5090, leaving only the pre-existing NVIDIA structured-SRV failure ina_heap_buffer_read_by_element_takes_the_views_stride;8/8pass on WARP).heap_views()initializes beforefuses_fmad(), all new boundary and cache-key tests (a_capped_view_heap_keeps_the_null_buffer_views,a_range_ending_at_the_heap_end_keeps_the_null_buffer_views,dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views,shader_cache::,pipeline::library::) pass (47/47) on both RTX 5090 (1M cap) and WARP (2M uncapped) underVICTORY_D3D12_DEBUG=1, and the full WARP suite passes (248/248).#1751/#2461and superseding#1779.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.