GPU: a page a copy holds in part is taken after its marked copy-back #2270
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T09:28:56Z.
Summary
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.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T09:35:41Z.
Review: COMMENTED
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).
Imported from Marvisak/VIctory. Originally posted by welisonzika14-jpg on 2026-11-25T12:00:04Z.
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.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:32:19Z.
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
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:38:09Z.
Review: APPROVED
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.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T22:11:19Z.
Review: APPROVED
LGTM — verified on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).cargo test -p victory-gpu --lib shadow:: -- --test-threads=1: all passed.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.