GPU: a buffer view left null for lack of a host copy is made again after each submission #3529
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3529"
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?
Imported from Marvisak/VIctory. Originally posted by Luislariosss on 2026-11-27T14:33:34Z.
A buffer SRV or UAV whose host copy did not exist when the title first wrote its record is left null today, and the shader that reads it reads zero with no miss ever counted — the record is never revisited, so the null stays for as long as the title keeps it.
descriptor::make_readhas handled exactly this for texture views since it landed; this extends the same contract to buffer views.A view left null for lack of a copy is now noted (
descriptor::make_refused) and retried once at the end of every submission (Host::execute), whereshadow::findcreates the copy of the registered buffer (or a loose window for unregistered memory) and the view is remade from the same record. The regression test drives a refused view end to end: null and noted after a failed make, made after the submission's retry.Notes for review:
mirrorthat fails fast, but a backoff like the staging one could bound it if thousands of such records ever showed up.remakereturns "done" whenmirrorreturnsNone(the record is no longer a view of ours); if a reviewer sees a transientmirrorfailure mode other than that, the note should be cleared there.The first commit adds the instrumentation this was diagnosed with: large declared buffers logged at INFO (
register), the distinct missed pages per frame next to the per-list sums, and the page-table rewrite line stays at DEBUG. On a run where the world's GPU-driven reads miss ~46k unique pages a frame, that instrumentation is what showed which addresses never gain a copy.Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-27T15:06:17Z.
Independent CPU/WARP verification of #3529 (no physical GPU, no game files)
Environment: Windows 11 build 26200, WARP software adapter (
VICTORY_WARP=1,VICTORY_D3D12_WARP=1), dxil.dll 1.8.2502.11 (Windows SDK 10.0.26100.0, x64), cargo-j 4, separate target dir.SHAs: head
14dd3b8fd2ea19733b232177dc1904258a7f6875; merge base on main63bcca43c6a00a758510398fa43096ce7e4f7df0(unchanged since the claim; nobody else had posted a check on the PR or #1633 after 15:01Z). The PR touches onlyvictory-gpu.cargo test -p victory-gpu --lib63bcca414dd3b8The new
descriptor::host::tests::a_refused_buffer_view_is_noted_and_made_at_the_next_retrywas also run on its own and passes.cargo clippy -p victory-gpu --all-targets -- -D warningson head is clean. Caveat: the test returns early ifhost()isNone; I did not separately confirm it took the WARP path rather than the early return.Diff read: no blocking findings. Notes, most relevant first:
make_refused_nowholds theSHADER_HEAPSlock acrossremake->mirror->prepare->shadow::find, which can allocate a whole title-buffer copy or a 4 MiB loose window.make_readdeliberately does its expensive work outside that lock because title threads writing views wait on it (its comment cites 1-6 s a frame). Suggest collecting the noted handles under the lock and remaking after dropping it, or at least moving thefindout.remakecallsmirror(.., for_draw = true). If the noted record has since become a placed texture view (the title overwrote the slot, or the heap was freed and another sits at that range),lateris false and the texture is made eagerly, bypassing the lazy path the placed-texture shortcut exists for. A buffer-only check before remaking would avoid it.find, an address outside every registered buffer falls toloose(), which succeeds for any address, so a refusal should mostly mean the allocation failed orexactreturnedNone. Each submission then repeats the failing allocation per noted record, under the lock from (1). The backoff the PR description mentions seems worth adding. I could not measure this without the title.make_at(dynamic slots) discards the no-copy flag, so those are never retried.pause_refused/REFUSEDare process-global, so the test relies on the pause flag to keep other tests' submissions away.AI use: this check was done with Claude Code (Claude Sonnet 5.5).
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T20:11:03Z.
NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head
14dd3b8(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.a_refused_buffer_view_is_noted_and_made_at_the_next_retry.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
Imported from Marvisak/VIctory. Originally posted by Luislariosss on 2026-11-28T00:16:52Z.
Heads-up for the merge session — semantic conflict with #3456 (sparse-heap-kept).
HostHeap::remakereads the kept slot withVecidioms (.get(index as usize).is_some_and(Option::is_some)). #3456 changeskeptfromVec<Kept>toHashMap<u32, KeptEntry>, so this PR as-is fails to compile against the stacked tree (E0308/E0631 indescriptor/host.rs:872-873) — GitHub won't flag it because each PR tests againstmainindependently.The one-line fix once #3456 lands:
Verified against the stacked tree (#3456 merged):
victory-gpu --lib250 passed,victory-hle --lib164 passed, clippy clean with and without--features diagnostics.Either merge this PR before #3456 and rebase #3456 on top, or merge #3456 first and rebase this branch with the one-line change above. Both orders converge to the same tree.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.