GPU: read marks of slots forgotten before a submission are cleared before it runs #2574
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2576"
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 BastienRodz on 2026-11-25T16:08:32Z.
What's wrong
HostHeap::mirror(a placed texture view left null until read) andHostHeap::evict(a texture given up) callshadow::forget_read(slot)so the slot's next read marks it again. Both run before the submission executes, insidesync_heapsandevict_unusedinHost::execute. The forgotten marks were cleared only insidetake_reads, after the submission. That wiped the mark a shader of that very submission had just set, so the slot was not made until a later submission read it again: at least one more frame with a null view, or forever if it was read only once. The behaviour comes from52d14b1, and since69d1e8eit also follows every eviction.What the fix does
shadow::clear_forgotten_reads()clears the marks (bitmaps andseen) of slots forgotten since the last submission.Host::executecalls it just beforeExecuteCommandLists, afterevict_unusedandsync_heaps.take_readsstill clears slots forgotten while the submission ran, such as a title thread rewriting a slot meanwhile.read_marksandclear_forgotten. The marks are unchanged otherwise.Tests
New
host::tests::forgotten_slot_read_in_the_next_submission_is_made:Results:
main(67e8ae1) it fails:made after its first read.host::tests,shadow::tests(8) anddescriptor::host::tests. The exception isdynamic_slots_are_held_until_released, which also fails onmainunder vkd3d-proton (its heap cap is belowHEAP_VIEWS). Run under Wine 10 with vkd3d-proton 3.1 on llvmpipe; without a host device the test returns early.Not tested
No title run, and no AMD/NVIDIA GPU. How many slots a frame loses this way is not measured.
Fixes #2574
AI-assisted (Gemini 4 Neon found and wrote it, Claude Code reviewed, simplified and verified it). No game data used.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by Venom2054 on 2026-11-25T16:20:03Z.
Tested
67e8ae1(parent) andc040ff1on native Windows 11 with an RTX 5070 Ti (NVIDIA 621.01) and D3D12 WARP. I ranforgotten_slot_read_in_the_next_submission_is_madein a fresh process for each adapter and each of the two read bitmaps, with a required D3D12 device and a check of its DXGI adapter name.made after its first readI also counted slot indices forgotten immediately before a submission and returned by
take_reads()after that same submission. The counter saw one matching slot at each of the two expected points in the fixture. In one prologue run on the RTX, 0 of 514 submissions with forgotten slots had a match. That run used the PR plus the typed-UAV format change from #1926 (93c4e181) and counters. The device reportedDXGI_ERROR_DEVICE_HUNGat 79.6 s, before the first world frame. This confirms the fix on native D3D12; its effect on visible textures in the world is still open.Tested with OpenAI Codex assistance.
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T16:33:55Z.
oni-swr verification — head
c040ff1e378aaa9d31a0b075fe1d5be1c8a764f2,origin/main67e8ae1401df112248aed36d0024483181b718b7Environment: Windows 11 Pro (26200), rustc 1.98.1, WARP only (
VICTORY_D3D12_WARP=1with--features diagnostics, which is what makes the host device the software adapter; Windows SDK 10.0.26100.0dxil.dllon PATH). No hardware GPU use in the reported runs, no game files, no retail data. Merge check:git merge-tree --write-tree origin/main <head>is clean.Commands / results
cargo test --locked -p victory-gpu --features diagnostics --lib -- forgotten_slot host::tests shadow::tests: 35 passed, 0 failed, 0 ignored (includes the newhost::tests::forgotten_slot_read_in_the_next_submission_is_made; it needs a host device, which on this setup is WARP, so it did not return early)cargo test --locked -p victory-gpu --features diagnostics --lib: 4 repeated runs 199 passed / 0 failed / 1 ignored;--test-threads=1: 199 / 0 / 1. One earlier run failed onlymemory::tests::a_submission_that_missed_leaves_the_copies_at_once, the unrelated WARP flake I also measured onorigin/main(9/60 runs); it passes alone.shadow.rsonorigin/mainwith only theclear_forgotten_reads()call inHost::executeremoved: the new test fails (made after its first read,host.rs:476); with the call it passes.Review: the logic matches #2574: forgotten marks (from
mirror/evictbeforeExecuteCommandLists) are cleared right before the submission, so the submission's own reads survive fortake_reads;take_readsstill clears slots forgotten while it ran. Extractingread_marks/clear_forgottenkeeps both paths identical. Ordering is right (afterevict_unusedandsync_heaps). One observation, not a defect:clear_forgotten_readsreturns early when no bitmap is mapped, leaving the forgotten list for later, astake_readsalready did. I found no defects.Overlap: #2574 is the issue this fixes; no other open PR addresses it. #2472, #2545, #2540, #2474, #2559 and #2573 also touch
host.rsand merge with this branch cleanly (merge-tree).AI disclosure: this review and verification were done by Claude Code (Claude Sonnet 5.5), not a human reviewer. Comment-only; no code changed.
Imported from Marvisak/VIctory. Originally posted by Machad3x on 2026-11-25T18:26:36Z.
Setup: RTX 3080 Ti (driver 621.24), Windows 11, a local stack of open PRs merged with main
67e8ae1.Applied cleanly on that stack, together with #2601, #2598, #2611, #2626. One 10-minute game run reached gameplay with no device removal. These five PRs were not tested one by one, so nothing in that run is attributed to this PR alone.
Written with Claude Code; tested locally.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:17:06Z.
Automated triage for the maintainers.
Merge candidate. This fixes #2574. Read marks of slots forgotten by
HostHeap::mirror/evictduringevict_unusedandsync_heapswere cleared only intake_reads, after the submission, which wiped the mark the same submission had just set. The newshadow::clear_forgotten_readsclears them inHost::executeafter both calls and beforeExecuteCommandLists.take_readskeeps clearing slots forgotten while the submission ran. Theread_marks/clear_forgottensplit keeps the bitmap handling the same for both paths. The existingtake_readstest still holds by my reading, and the new host test reproduces the lost read.CI:
checkpassing. Merges cleanly into currentmain. A recommendation to look at it, not an approval.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T18:02:15Z.
Review: APPROVED
Looks good. Verified merged onto
main(63bcca43) on an RTX 5090 and Microsoft WARP, including under the D3D12 Debug Layer (VICTORY_D3D12_DEBUG=1):shadow::clear_forgotten_reads()inHost::execute(crates/victory-gpu/src/host.rs:1286) afterevict_unused(),sync_heaps(), andrun_deferred()and beforeExecuteCommandListsclears previously forgotten marks before the GPU runs, whiletake_reads()(crates/victory-gpu/src/shadow.rs:824) still clears marks forgotten concurrently during execution.cargo xtask policy(191 files ok) andcargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features) pass.forgotten_slot_read_in_the_next_submission_is_made,read_marks_of_both_bitmaps_are_taken, andheap_reads_since_the_last_pass_name_their_texturespass on RTX 5090, RTX 5090 +VICTORY_D3D12_DEBUG=1, and WARP +VICTORY_D3D12_DEBUG=1with zero Debug Layer messages.memory = falseandmemory = true), overwriting a live slot with a different placed texture and reading it in the very next submission, evicting -> skipping a submission -> remaking on a later read,reads_since()+ eviction + immediate remake, out-of-boundsforget_readslots (HEAP_VIEWSandu32::MAX), and mid-submissionforget_readsuppression on both RTX 5090 and WARP underVICTORY_D3D12_DEBUG=1.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T18:48:30Z.
Review: APPROVED
LGTM — verified on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).clear_forgotten_reads()inHost::execute) prevents reads recorded in that submission from being wiped afterward, ensuring evicted or newly placed texture slots are materialized on their first read.cargo test -p victory-gpu --lib shadow:: -- --test-threads=1: 10 passed, 0 failed.cargo test -p victory-gpu --lib host::tests:: -- --test-threads=1: all passed (includingforgotten_slot_read_in_the_next_submission_is_made).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.