GPU/Shadow: advance saved before snapshot after merge_writeback in copy_back_or_not #3031
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!3031
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3031"
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?
@RVZO6 on GitHub · 2026-11-26 03:59 UTC · original
RVZO6:rvzo/shadow-copyback-stale-before→main· +61 −3 · 1 files · 1 commits · openIn
Shadow::copy_back_or_not()(crates/victory-gpu/src/shadow.rs:414-454),compareddeduplicates only whole 64 KiBPIECEchunks (if n == PIECE && !compared.insert(...)). When two overlapping ranges in the same submission include a partial range (< 64 KiB) — e.g.[0, 0x1000)followed by[0, 0x2000)or[0x1000, 0x2000)followed by[0, PAGE)— the secondcopy_back()re-compares those bytes against the savedbeforesnapshot segment.Because
merge_writeback(title, host, old)copies concurrent CPU writes fromtitleintohostwithout updatingold(before), a subsequent overlappingcopy_back()in the same submission seeshost[i] != old[i]on those CPU-written bytes, mistakes the earlier CPU write for a GPU write, and clobbers newer CPU writes in title memory back to the stale value.Update
old.copy_from_slice(host)immediately aftermerge_writebackso already-merged bytes match the snapshot on subsequent overlapping copy-backs. Disjoint from #2914 (copy_back_marks) and #2848 (Backbuffer pooling).Verification
overlapping_copy_backs_do_not_clobber_newer_cpu_writescovering bothpartial_then_wider([0, 0x1000)->[0, 0x2000)) andpartial_then_whole_page([0x1000, 0x2000)->[0, PAGE)) on D3D12 WARP SM 6.6.--tests+--features diagnosticsclippy,xtask policy, full workspace tests): RVZO6/VIctory CI run #45748741503 (green, combined Wave 10 check on63bcca4).AI-assisted: T3 Code (Antigravity, gemini-4-neon).
@pickles976 on GitHub · 2026-11-26 04:05 UTC · original
Independent hardware verification at exact clean head
1de058caa2f34b407766df930f7ef49793cf68f1: Windows-MSVCvictory-gpuregressionshadow::tests::overlapping_copy_backs_do_not_clobber_newer_cpu_writes1/1 PASS (0.79 s) under Wine 11.0/vkd3d-proton 3.2.0 on an NVIDIA RTX 4060 Laptop GPU (8 GiB), 16 GiB RAM. DXVK explicitly enumerated the laptop GPU and vkd3d initialized a hardware D3D12 device; this test reached the liveShadowpath rather than thefind() == Noneearly-return branch. It exercises both partial-then-wider and partial-then-whole-page overlapping ranges and verifies the first GPU byte remains while the newer CPU byte survives the second copy-back.I ran it inside the 9 GiB cgroup / 512 MiB swap safety scope with global available RAM >=2 GiB, GPU used <=6 GiB, disk >=10 GiB; no guard stop. Local log
.compat-runtime/logs/verify-pr3031-wine-rtx4060-shadow-copyback.log. No retail title was launched; this is a synthetic GPU-shadow correctness check, not evidence the 16 GiB loader bottleneck is fixed. No objections from the focused Wine/NVIDIA fixture.@Marvisak on GitHub · 2026-11-26 06:17 UTC · original
Automated triage for the maintainers.
This fixes a real bug in
crates/victory-gpu/src/shadow.rs::copy_back_or_not.merge_writebacksetshostto the merged title bytes but leaves thebeforesnapshot unchanged.comparedonly skips whole 64 KiB pieces, so a second, overlapping partial range in the same submission compareshostwith the stalebeforeagain. It then treats the CPU's earlier bytes as GPU writes and puts them back over newer CPU writes. The one-line fix,old.copy_from_slice(host)after the merge, matches whatupdate_tracked'ssync_beforealready does for the snapshot. The new test covers both overlap shapes.CI:
checkis failing, but only indescriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_wait("both made"). That test does not touchshadow.rs, and #3035 reports it as intermittently failing on unmodifiedmain, so a re-run is probably enough. Please confirm before merging.Generated by Claude Code
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.