GPU: retry a fallback descriptor heap that could not be created #4807
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4807
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4806"
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?
@Jineggegg on GitHub · 2026-12-01 09:33 UTC · original
Jineggegg:fallback-heap-retry→main· +134 −77 · 2 files · 16 commits · openBased on
mainate1251c31; one commit.Problem
Sometimes the title binds no view heap or no sampler heap, but the draw uses a root signature with
CBV_SRV_UAV_HEAP_DIRECTLY_INDEXEDorSAMPLER_HEAP_DIRECTLY_INDEXED. The host then binds a 1-descriptor fallback heap (Host::fallback_view_heap,Host::fallback_sampler_heap).Both heaps are cached as
OnceLock<Option<ID3D12DescriptorHeap>>. If the firstCreateDescriptorHeapfails (memory pressure, or a transient driver refusal),Nonestays cached for the rest of the run. From then on, every list that needs the fallback sets the root signature without both heaps bound. That is debug-layer error 1419, and on NVIDIA it removes the device.The draw path also marks its heaps as set when one of the two is missing (
draw.rs,host_heaps_set). So it does not try again until the title's heaps change.Reproduction
This is a resource-exhaustion path, so a normal run does not hit it on demand. To force it:
fallback_view_heapon its first call, or run with VRAM nearly exhausted by another process.Change
made_once(cell, make). It keeps a value in aOnceLock<T>only ifmakeproduced one.fallback_viewandfallback_samplerbecomeOnceLock<ID3D12DescriptorHeap>and usemade_once. The heap creation code is unchanged.draw.rs(heap binding before the root signature),host_heaps_setis set only when both heaps were bound. While a fallback is missing, the next draw or dispatch tries again.Once the heap exists, nothing changes: the fast path is a single
OnceLock::get, as before. In a normal run both heaps are always bound (the title's or the fallback), sohost_heaps_setbehaves as before.Tests
New unit tests, no GPU needed (
host::made_once_tests):a_failure_is_tried_again_and_a_success_is_kept: failures are not cached, the first success is kept, and nothing is made after it.racing_callers_all_get_the_value_published_first: a caller that fails while another publishes gets the published value; 8 racing threads (half of them failing) all see one value.Results on Windows (toolchain pinned in
rust-toolchain.toml, Rust 1.98.1; RTX 5090, driver 621.14):main(e1251c31) does not pass-D warningsat the moment: 4 warnings without--all-features(fieldloop_capsis never read incrates/victory-shader/src/emit/lower.rs; manual implementation of.is_multiple_of()incrates/victory-gpu/src/host.rs; match can be simplified with.unwrap_or_default()incrates/victory-hle/src/modules/xmem.rs; methodrangedis never used incrates/victory-gpu/src/shadow.rs) and 5 with it (also functionmbis never used incrates/victory-gpu/src/copystat.rs). Both CI configurations were therefore run without-Dand compared withmain's diagnostics. This branch adds none, in either configuration.cargo test --workspace --locked --no-fail-faston the GPU: 2522 passed, 6 failed, 96 ignored (main: 2520 passed, 5 failed, 96 ignored). The failuresmainhas itself (list::thin::tests::bindings_record_no_work,shader_cache::tests::every_switch_of_the_translator_is_in_the_key,emit::bitcode::opt::tests::hw_tests::split_lds_wave32_read_after_read_barrier_coalescing_and_parity,policy::tests::repository_passes_policy), andhost::card_steps::tests::shared_scratch_eliminates_flight_settle_end_to_end. That one is intermittent onmaintoo: running thevictory-gpulib tests ofmain, this branch and two other branches in turn in one GPU window, it failed in 1 of 22 runs onmainand 0 of 22 on this branch. The test expects each round's first submission (a few milliseconds of GPU copies) to be still in flight when the second is submitted; in the failing round the second submission took 110 µs because the first had already finished. This change does not touch that path. So no new failure. Failing onmainbut passing here:victory_hle::modules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it. Unit tests that need no device,cargo test -p victory-gpu --lib:host::made_once_tests: 2 passed, 0 failed.Performance
Nothing to measure on the normal path: once a fallback heap exists, the only cost is the same
OnceLock::getas before, and the draw path binds the same heaps. The change only matters after a failed creation. It is a correctness fix for an edge case, not a speed change.Risk
CreateDescriptorHeapand one redundantSetDescriptorHeapsper such draw, only while creation keeps failing.Attribution
Ported from the author's own fork, where the same fix was made for its empty view heap. No third-party code.
AI assistance: the change, its tests and this description were prepared with an AI coding assistant (Claude Code) and checked by the results above.
🤖 Generated with Claude Code
@andrewpozdnakov7-jpg on GitHub · 2026-12-01 09:54 UTC · original
I cherry-picked
5156288onto currentmain5fabb46as8aa89eb. The Git author and patch ID match, and the unrelated release history drops out of the comparison.One gap remains after the retry change. The draw path still reaches the root signature on the first missing-heap call. Victory's root signatures set both directly indexed heap flags, and D3D12 requires those heaps to be bound before the root signature. DirectX Shader Model 6.6 specification
Proposed follow-up commit returns from
State::bindbefore recording a root signature while either heap is missing. The calling draw and dispatch paths already honor that result. The next call tries the fallback again.A native Rust fixture using the exact binding blocks checked a missing view heap, a missing sampler heap and both missing. In all three cases the author head proceeded to the root signature. The patch skipped the recording step and, on retry, bound both heaps before the root signature. The fixture mocks D3D12 calls.
cargo check --locked -p victory-gpu --jobs 2and the staged policy check for the follow-up passed.Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the follow-up into another commit.5fabb46e) into fallback-heap-retry c3b552f535@Jineggegg on GitHub · 2026-12-01 11:19 UTC · original
Thanks for checking this against current
mainand for the follow-up. It's right: Victory's root signatures set both directly indexed heap flags, so binding the root signature with a heap missing was wrong.I've taken your commit as it was, with you as the Git author (
4572d52a, on top of a merge ofmain5fabb46einto this branch). It applied cleanly.State::bind's three callers already skip the draw or dispatch when it returns false, and the two tests that assert it succeeds set both heaps first.Checked on Windows (Rust 1.98.1, RTX 5090):
--all-features) report the same 5 warnings asmain5fabb46e, and nothing else. CI's-D warningsstops on those 5 onmaintoo.cargo test --workspace --locked: 2489 passed, 1 failed, 96 ignored. The failure ismodules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it, which also fails onmain. Nothing new.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.