GPU: a remapped mapping does not mark the mappings that still show it #2547
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2549"
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 Calvix2k on 2026-11-25T15:38:09Z.
Fixes #2414.
The failure
title_memory_remappedmarked[at, at + len)changed throughchanged, which follows the alias links (watch.rs:changed→changed_hereper page, then every page linked to them). A mapping that still shows the same physical pages was therefore marked changed with nothing saved, although it shows what it did. If such a copy was armed for a marked write in a running submission,copy_back_markedfoundsaved.is_none() && changed(page)and kept the title's bytes — the shaders' writes to those pages were dropped. A title write to them afterwards does not fault either, so nothing is saved then.What the change does
Only the pages the runtime remapped are marked (
changed_here), which is what the function's own description says: "what it shows is new". The links are still dropped — those pages no longer show what they did, so a later write there must be seen at the new address only.Verification
remapping_one_mapping_leaves_the_other_unchanged: a tracked page taken and armed, a second mapping linked to it (title_memory_aliased), then the second remapped. Without the change it fails ("the other mapping still shows what it did"); with it the tracked page keeps its state.cargo test -p victory-gpu --features diagnostics --libon Windows 10 19045 / RX 7800 XT: 146 passed, 2 ignored, plus the known placed-view failure on a runtime withoutID3D12Device10(#1999, identical onmain); clippy-D warningsclean.The other half of this family —
guard_aliasesignoringprotect's result when the alias is busy (#2454) — is not touched here: it needs the busy/open-write state at the call sites, which is a different change.Imported from Marvisak/VIctory. Originally posted by fyernald on 2026-11-25T16:41:47Z.
Review: APPROVED
Tested on an RTX 3080 (617.42), Windows 10 (19045),
main67e8ae1.cargo test -p victory-gpu --lib --locked -- --test-threads=1: 193 passed, 3 failed (the 3 also fail onmainhere).remapping_one_mapping_leaves_the_other_unchangedpasses.The change matches what
title_memory_remappedsays it does: only the remapped pages show something new, and the links are still dropped.One small thing in the test:
free(a)andfree(b)run whiletrackedis still alive, aftertracked.taken(..)guardeda. So pageastays in the globalprotectedandholderssets untiltrackeddrops at the end of the function. A parallel test that gets the same address fromVirtualAllocin that window sees its page as already guarded, and its writes go unseen. Every other test inwatch.rsdoesdrop(t); free(p); doing the same here (drop(tracked)before the frees) closes that window. It's not needed for correctness, but this crate has had enough parallel-run flakes.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:36:08Z.
Automated triage for the maintainers.
Merge candidate.
watch::title_memory_remapped(crates/victory-gpu/src/watch.rs) now marks only the remapped pages as changed (changed_here) instead of also marking every alias (changed). The callers arexmem.rs(map and unmap of a view of physical pages) andlist.rs(Upload::drop). In each case only the virtual mapping changes; other mappings of the same physical page still show the same bytes. Marking them changed with nothing saved could drop a marked copy-back (#2414). The alias links are still removed. The new test covers the case from the issue. CI: passing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:50:45Z.
Heads-up from testing head
50c43553755fmerged onto currentmain(63bcca43c6a0):crates/victory-gpu/src/watch.rswith zero text conflicts, so GitHub reports the PR as mergeable, butvictory-gpufails to compile onmain(63bcca43):error[E0425]: cannot find function 'changed_here' in this scope(crates/victory-gpu/src/watch.rs:819:5)384b0c0b(#2239) refactoredwatch.rs(lines 714-742) into separatemark_changedandopen_guardedpasses and removedchanged_here.title_memory_remapped— marking and unprotecting only the remapped VA range[first, last)without propagating acrossalias_ofto sibling mappings that still show the same physical pages (while clearing bidirectionalalias_oflinks) — is sound.mainand replacingchanged_here(&mut g, first, last, false)atwatch.rs:819withmark_changed(&mut g, first, last, false); open_guarded(&mut g, first, last);(or restoring a local helper) should make it build and pass cleanly.Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-26T18:52:57Z.
Thanks — reproduced on a 7800 XT / Windows 10 rebase as well: upstream folded
changed_hereintochanged,mark_changedandopen_guarded, so the call intitle_memory_remappedno longer resolved.The branch now carries a local
changed_herebuilt frommark_changed+open_guarded(the alias-free half ofchanged, which is what a remap needs), rebased on current main.cargo check -p victory-gpu --all-targetspasses here, and GitHub reports it mergeable again. Head0060ec9.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T19:11:10Z.
Review: APPROVED
LGTM — verified on Windows against
origin/main(63bcca4).changed_hereintitle_memory_remappedmarks and opens only the remapped VA range, leaving other virtual mappings that still reference the same physical pages (and their armed trackers) undisturbed.cargo test -p victory-gpu --lib watch:: -- --test-threads=1: 16 passed, 0 failed (includingremapping_one_mapping_leaves_the_other_unchanged).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).
Imported from Marvisak/VIctory. Originally posted by dux14 on 2026-11-29T05:39:45Z.
#2415 makes the same
mark_changed/open_guardedchange and also opens alias pages that only the removed link guarded. It has an end-to-end test throughcopy_back_marked. This diff also has two problems:let guarded = …;andlet others …are on one line, and the doc comment forchangedis now attached tochanged_here. Its test only checkstracked.changedand never reachescopy_back_marked. Suggest closing in favour of #2415.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.