Repository navigation
GPU: remapping one mapping of aliased pages leaves the others guarded - #2415
BastienRodz wants to merge 1 commit into
Conversation
catminou4
left a comment
There was a problem hiding this comment.
Remapping one mapping of aliased pages leaves the others guarded (twin_views regression test). 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.
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:
- Leaving surviving mappings guarded when remapping one mapping of aliased pages cleanly prevents dropped marked writes.
cargo test -p victory-gpu shadow::: 5/5 passed on RTX 5090, 5/5 passed on WARP (includingremapping_an_alias_does_not_drop_marked_writes_on_the_surviving_copy).cargo test -p victory-gpu watch::tests: 6/6 passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.
AI-assisted (Gemini 4 Neon).
|
Verified on Windows 10 / GTX 1050 at Mechanics check out:
|
|
Automated triage for the maintainers. Merge candidate. On your reply: the rebase applies exactly the change the second look asked for after #2239 split Generated by Claude Code |
|
Rebased onto main da82e44 (conflict only in the shadow tests block). On the new main the test still fails without the fix ( |
c22a56e to
16438f4
Compare
|
Automated triage for the maintainers, second look (a review against This is right as reviewed. It no longer builds on Push the change and it will be reviewed again. Thank you for the contribution. |
title_memory_remapped marked [first, last) changed through `changed`, which follows alias links: every other address showing the same physical pages was opened and its trackers marked changed, without saving. Those addresses still show the same bytes. If a copy there was armed for marked writes, copy_back_marked then found the page changed with nothing saved and kept the title's bytes, dropping the shaders' writes; and a later title write there no longer faulted to save the page. Mark only [first, last) (changed_here), and when its alias links go, open a page that was guarded for them only, one no tracker holds itself or through a remaining alias. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16438f4 to
5661933
Compare
|
Rebased on The |
What's wrong
title_memory_remapped(at, len)marks[at, at + len)changed withchanged, which also walksalias_of. So remapping or unmapping one address of aliased physical pages opens every other address that shows them, and marks their trackers changed without saving, while those addresses still show the same bytes. A copy over such an address that is armed for marked writes then loses the shaders' writes:copy_back_markedsees a changed page with nothing saved and keeps the title's bytes. A later title write there doesn't fault, so nothing is saved either.What the fix does
title_memory_remappedmarks only[first, last)itself (changed_here).Pages that do have a tracker stay guarded and unchanged, as they are when nothing is remapped.
Tests
New
shadow::tests::remapping_an_alias_does_not_drop_marked_writes_on_the_surviving_copy: two pages mapped ataandb, a copy overaarmed for marked writes, a shader-side byte written in each page, thenbis remapped and the title writes page 1 througha. Both shader writes must go back, and so must the title's write.main(940d32f) it fails at the first check (page 0's shader write goes back).shadow::tests(5),watch::tests(6) andvictory-hle'smodules::xmem::(10). Run under Wine 10 with vkd3d-proton 3.1 on llvmpipe: the copy needs a host device, and the test returns early without one.Not tested
No title run, and no AMD/NVIDIA GPU. Whether the title unmaps one view of pages while a submission writes them through another is not measured. #2021 adds an early return for
len == 0at the top of the same function; the two combine without overlapping lines.Fixes #2414
AI-assisted (Gemini 4 Neon found and wrote it, Claude Code reviewed and verified it). No game data used.
🤖 Generated with Claude Code