Repository navigation
GPU: a marked copy-back advances the snapshot of declared ranges over its page - #2437
BastienRodz wants to merge 1 commit into
Conversation
DrDarkDK
left a comment
There was a problem hiding this comment.
Verified 13c6aa2 on native Windows with an RTX 4070 Ti (driver 621.01) and WARP. I also checked a case where the marked pass writes zero bytes back to title memory but takes a title-written byte into the host copy.
On 940d32f, the title wrote 0x11, the marked pass took it into the copy, and the title then wrote 0x22. The later declared pass wrote 65,536 bytes and restored 0x11. On 13c6aa2, the declared pass wrote zero bytes and preserved 0x22. Both adapters gave the same results.
All six targeted shadow tests, including this temporary fixture, passed on each adapter. The zero-write case confirms why the snapshot update matters even when the marked pass reports no write. Synthetic data only.
AI-assisted with Codex.
|
Verification — head Environment: Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, DXC/dxil 1.8.2502.11 (Windows Kits 10.0.26100.0 x64).
Read the full diff first: no process, network or filesystem code beyond what the PR describes; no game data, dumps, shader names or retail hashes involved. Verified by Claude Code (Claude Sonnet 5.5), an AI assistant; this is a test report, not a code review or approval. |
|
Thanks @oni-swr, the negative control under WARP is useful. On #2434: the two don't contradict each other. That PR splits |
|
Verified on Windows 10 / GTX 1050 at The fix matches the issue's analysis: by the time Also checked: the early |
catminou4
left a comment
There was a problem hiding this comment.
Marked copy-back advances the snapshot of declared ranges (+47). 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. Same copy-back cluster as #2434.
|
Overlap with #2513, WARP/CPU only (addendum to the existing verification of Same defect (#2436), same file (
AI use: Claude Code (Claude Sonnet 5.5). |
13c6aa2 to
6c60b95
Compare
|
Rebased onto main da82e44. Main added |
6c60b95 to
6041446
Compare
|
Automated triage for the maintainers. Verdict: merge candidate. Rebased at The overlapping #2434 and #2513 have been closed, and #2377 has been merged, so nothing else open competes with this. CI: passing ( Generated by Claude Code |
… its page copy_back_marks runs before the copy-backs of declared ranges. It puts a marked page's GPU bytes back, and the copy takes the title's others (`*h = *t`), but the snapshot of a declared range over that page (Shadow::before) kept the bytes from before the submission. That range's copy-back then found the title's bytes the copy had taken differing from the snapshot, took them for the GPU's, and put them back over what the title had written in between. copy_back_marked now brings the snapshot over the page to the copy's bytes (sync_snapshot). Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6041446 to
60d81cf
Compare
What's wrong
copy_back_marksruns before the declared ranges' copy-backs (host.rs). A marked copy-back puts the shaders' bytes back, and the copy takes the title's others. But the snapshot (Shadow::before) of a declared range over the same page keeps the bytes from before the submission. That range'scopy_backthen sees the title's bytes in the copy as differing from the snapshot, takes them for shader writes, and puts them back over anything the title wrote since the marked copy-back. Sincecd94d35, a page can be both marked and inside a declared range (a heap view and a root UAV or a clear on the same buffer), and the title's threads keep writing these buffers during copy-back.What the fix does
At the end of
copy_back_marked, the newsync_snapshotcopies the page's resulting bytes into any snapshot segment over it, so a later copy-back finds nothing new there. This is whatupdate_busyalready does for refreshes: "The same bytes go into the snapshotwritingtook, so copy-back neither takes them for the GPU's nor puts them back over a later title write." Nothing changes when no declared range covers the page.Tests
New
shadow::tests::a_declared_copy_back_after_a_marked_one_keeps_newer_title_writes: one page, marked and declared. A shader writes byte 10 and the title writes byte 40 during the submission. After the marked copy-back, the title writes 10 and 40 again, and the declared copy-back must write nothing.main(940d32f) it fails: the declared copy-back writes the page back (left: 65536,right: 0), restoring the older bytes.shadow::testspass (5), as dowatch::tests(6). 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 often the title writes a byte again between these two steps is not measured.
#261 has the companion case: two overlapping declared ranges, where
copy_backdoes not advance its own snapshot. That PR predates marked copy-back. This one only touchescopy_back_marked, so the two don't overlap.Fixes #2436
AI-assisted (Gemini 4 Neon found and wrote it, Claude Code reviewed, narrowed and verified it). No game data used.
🤖 Generated with Claude Code