GPU: remapping one mapping of aliased pages marks the others changed, dropping marked shader writes there #2414
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#2414
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@BastienRodz on GitHub · 2026-11-25 13:07 UTC · original
What happens
When physical pages show at two addresses
aandb(linked bytitle_memory_aliased) and the runtime remaps or unmapsb(title_memory_remapped(b, len), called fromxmem::unmapand the mapping paths),watch.rsmarks[b, b + len)changed throughchanged, which follows alias links.a's pages are opened as well, and their trackers are marked changed with nothing saved, althoughastill shows the same bytes.If a host copy over
ais armed for marked writes in a submission that is running (Shadow::writing(.., true)),copy_back_markedthen findssaved.is_none() && t.changed(page)and keeps the title's bytes, which drops the shaders' writes to those pages. A title write toaafterwards does not fault either, so it saves nothing.copy_back_pagedrops page-table writes there for the same reason.Expected
title_memory_remapped's own description: "The runtime mapped or unmapped title memory[at, at + len): what it shows is new". Other addresses showing the same physical pages show what they did before. They should stay guarded and unchanged for their trackers. A page guarded only because of the removed link, which no tracker holds itself or through a remaining alias, can be opened.Where
crates/victory-gpu/src/watch.rs,title_memory_remapped(it callschanged, notchanged_here). Effects incrates/victory-gpu/src/shadow.rs(copy_back_marked,copy_back_page).AI-assisted (Gemini 4 Neon found it, Claude Code reviewed and verified it); synthetic test only, no game data.
github-bot referenced this issue2026-11-26 05:08:57 +00:00
@shawshanker18 on GitHub · 2026-11-25 16:41 UTC · original
Tested both fixes for this, each merged onto
main(67e8ae1), on Windows 11 with an RTX 4050 Laptop. Command:cargo test -p victory-gpu --lib.remapping_an_alias_does_not_drop_marked_writes_on_the_surviving_copypasses; no failures beyondmain's 2 (NVIDIA view-heap cap).remapping_one_mapping_leaves_the_other_unchangedpasses; same 2.Both make the same core change:
title_memory_remappedcallschanged_here, notchanged. #2415 additionally opens alias pages that were guarded only through the removed link when no tracker holds them, either directly or through a remaining link. That is the issue's "Expected". With #2549 such a page stays guarded, so the next write to it takes a fault and opens it: a cost, not a lost write.#2415's test goes end to end through
copy_back_markedwith real twin views; #2549's links two separate pool pages.#2415 also merges cleanly with #2455 and with #2561 (#2454).
@Marvisak on GitHub · 2026-11-25 18:49 UTC · original · edited 2026-11-26 06:48 UTC
Automated triage for the maintainers.
Confirmed in
main. Incrates/victory-gpu/src/watch.rs,title_memory_remappedmarks the remapped pages changed, and the change is also applied to every page linked inalias_of, which opens the other mappings and marks them changed with nothing saved. InShadow::copy_back_marked(shadow.rs), a page that is changed with nothing saved keeps the title's bytes.There are two open PRs, and they conflict with each other:
New since the last triage: a comparison on an RTX 4070 against
main63bcca4found both regression tests fail onmainand pass with their fix, but #2549 no longer compiles on currentmain:changed_herewas split intomark_changedandopen_guarded(#2239), so it needs a rebase. #2415 builds and is a superset of #2549, though no test covers its extra branch.Generated by Claude Code
@pawrenity on GitHub · 2026-11-26 04:06 UTC · original
Comparative check of the two open PRs for this issue. All runs were against
mainat63bcca4on an NVIDIA GeForce RTX 4070 with Windows 11, usingcargo test -p victory-gpu --lib -- --test-threads=1andcargo clippy -p victory-gpu --all-targets -- -D warnings. On this cardmainitself has 2 failures (descriptor::host::tests::dynamic_slots_are_held_until_releasedandmemory::tests::lists_share_a_table_and_copies_keep_their_views, the NVIDIA view-heap cap). Every run below has those same 2 and no others.For the cross-tests, each PR's test was copied word for word into the other tree, with the early "no device"
returnchanged to apanic!.mainwithout the fix-D warningsmain5661933shadow::tests::remapping_an_alias_does_not_drop_marked_writes_on_the_surviving_copypasses (230 passed after merge)page 0's shader write goes backmain50c4355watch::tests::remapping_one_mapping_leaves_the_other_unchangedpasses at its own head (194 passed)the other mapping still shows what it didmain, see belowThe two PRs conflict with each other in
crates/victory-gpu/src/watch.rs.#2549 does not build on current
main. #2239 splitchanged_hereintomark_changedandopen_guarded. After merging,title_memory_remappedstill callschanged_here(&mut g, first, last, false), which fails witherror[E0425]: cannot find function 'changed_here' in this scope(crates/victory-gpu/src/watch.rs:819in the merged tree). I replaced that line locally withmark_changed(..); open_guarded(..);, the same change #2415 already carries. With it, the merged tree passes the full suite (230 passed), clippy is clean, and #2415's test passes.Core change. Both PRs make the same core change:
title_memory_remappedmarks only[first, last)and no longer marks every aliased page throughchanged. #2415 also opens a formerly linked page when nothing holds it, either directly or through a remaining link. Otherwise that page stays guarded with no tracker, so the next write to it takes a fault (a cost, not a lost write). I found no defect in that branch, but neither PR's test exercises it: in #2415's test the surviving mapping is held, so the page is not opened.Recommendation. #2415. It is rebased onto current
mainand builds there. Its end-to-end test fails onmainand passes with the fix, and the other PR's test also passes on it. It is a superset of #2549's change. #2549 needs thechanged_here→mark_changed+open_guardedupdate before it can merge.AI-assisted (Claude Code).