GPU: a page a copy holds in part is taken after its marked copy-back #2272
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!2272
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2272"
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?
@denkencar-sketch on GitHub · 2026-11-25 09:28 UTC · original
denkencar-sketch:fix/shadow-004→main· +29 −4 · 1 files · 1 commits · openSummary
A page that a copy holds only in part was not taken after its marked copy-back (only whole pages were), so the page stayed changed and unguarded and the next submission's marked writes to it were dropped.
Testing
Test
a_partly_held_page_is_taken_after_its_marked_copy_backfails onmainand passes with this change.cargo test --workspace --lockedpasses apart from the known flakes:modules::dstorage::tests::a_page_list_filled_after_its_request_startsfails now and then onmaintoo, and so does a parallel-run flake invictory-gpu's lib tests (watch::anddescriptor::host::tests, 2 of 40 runs on pristinemain).Not tried: real submissions, and a run in the game.
AI-assisted.
@welisonzika14-jpg on GitHub · 2026-11-25 12:00 UTC · original
First run on NVIDIA hardware here, as far as I can see (the reviews above are static or WARP). RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head
b4bc9b9merged ontomain940d32f,cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.The PR's test
shadow::tests::a_partly_held_page_is_taken_after_its_marked_copy_backpasses on this card. The rest is the same asmainon this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests invictory-gpu, 3 invictory-shader), nothing new.One run, unit tests only, title not run.
Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
@Marvisak on GitHub · 2026-11-25 13:32 UTC · original · edited 2026-11-26 01:22 UTC
Automated triage for the maintainers.
Merge candidate. The rebase resolved the
shadow.rsconflict, and it merges cleanly now. InShadow::copy_back_marked(crates/victory-gpu/src/shadow.rs), the page is now taken after the copy-back even when the copy holds it only in part. Onmain, such a page stayed changed and unguarded, so the next submission's marked copy-back sawchangedwith no saved bytes and dropped the shaders' writes. I checked that this is consistent:[from, to). Either the copy's bytes are written to the title, ormerge_writebackgives the copy the title's bytes.Trackedis the copy's own, andTracked::takealready treats a page whose tracked part is fully in range as whole.copy_back_pagealready takes partial pages unconditionally.The new test
a_partly_held_page_is_taken_after_its_marked_copy_backcovers the second submission, and a tester ran it on NVIDIA hardware.CI: passing (
check).Recommending a look, not approving.
Generated by Claude Code
@catminou4 on GitHub · 2026-11-25 09:35 UTC · original · reviewed
A page a copy holds in part is taken after its marked copy-back (drops the from==page && to==page+PAGE condition). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Pairs with #2271 (shadow.rs freshness cluster).
@fuzeofficlal on GitHub · 2026-11-26 19:38 UTC · original · approved these changes
Reviewed and verified
885172cb7297e36877c7977dd4ca1668f2f1e81dmerged ontoorigin/main(63bcca43c6a00a758510398fa43096ce7e4f7df0) on Windows 11 x64 (RTX 5090 + Microsoft WARP,--features diagnosticswithVICTORY_D3D12_DEBUG=1, Rust 1.98.1 MSVC).Code Audit
Shadow::copy_back_marked(crates/victory-gpu/src/shadow.rs:528-530),[from, to)is alwayspage.max(start)..(page + PAGE).min(end), i.e. the entire portion ofpageowned byself. Both branches leavehostequal to title memory on[from, to): theNonebranch writeshostback when different, and theSome(before)branch runsmerge_writeback(L27-37), which updates bothtitleandhostto the merged bytes before writing back.Shadow::trackedholds a per-copyArc<Changed>, callingt.taken(&[page / PAGE])re-arms the page guard and clears only this copy's dirty entry without clearing any other copy that shares the same 64 KiB page.Local Verification
cargo xtask policy— pass (191 files ok).cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features) — 0 warnings.cargo test --locked -p victory-gpu --features diagnostics --lib shadow::tests::(RTX 5090 and WARP) — 10/10 passed, includinga_partly_held_page_is_taken_after_its_marked_copy_back(L1647-1668).[p..p+0x100]tail-partial, Copy B[p+0x100..p+0x100+PAGE]head-partial): verified Copy B's marked copy-back preserves Copy A's concurrent CPU write and leaves Copy A's dirty mark intact, subsequent concurrent CPU+GPU writes merge into both title memory and Copy B's host buffer, and consecutive marked copy-backs on tail-partial Copy A also succeed on both RTX 5090 and WARP.Looks good to merge.
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.