GPU: a page whose other mapping cannot be guarded stays changed #2561
No reviewers
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!2561
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2561"
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?
@Calvix2k on GitHub · 2026-11-25 15:49 UTC · original
Calvix2k:codex/gpu-busy-alias-take→main· +80 −9 · 1 files · 1 commits · openFixes #2454.
The failure
guard_aliasesguarded the other mappings of a taken page and ignored whatprotectreturned. While a write the guards do not see is under way through one of those mappings (watch::writing: a kernel read or a DirectStorage write),protectleaves it out — it stays open and busy. The taken page was still removed from the changed pages and its saved bytes dropped (Changed::taken), although writes through the busy mapping would not mark it untilWriting::drop. A marked copy-back then found it changed with nothing saved and kept the title's bytes, dropping the shaders' writes.title_memory_aliasedignored the result the same way for the new mapping of a guarded page.protectalready documents the rule this restores: "a page that is mapped but cannot be guarded is left out (it stays changed)", andwatch.rssays "taking a page guards every address showing it".What the change does
guard_aliasesreturns the taken pages one of whose mappings was not guarded.Tracked::takeandTracked::takenleave those out: they stay changed and keep what they saved until every mapping of them can be guarded. A page is retaken on the next refresh/copy-back once the mapping is out ofbusy.title_memory_aliased, when the new mapping of a guarded page cannot be guarded, marks the page changed without saving (changed(..., false), which follows the alias links), so the tracked mappings pick the writes up and armed bytes are kept.A blocked page is copied as usual (the copy is correct for what the title wrote so far); only its "taken" state is kept.
Verification
a_page_whose_other_mapping_is_busy_is_not_taken: a tracked page taken and armed, linked tob, then a kernel write throughb; a refresh takes the page meanwhile. Before: the page was taken,Changed::takendropped its saved bytes, andchangedbecame false. Now: it stays changed and keeps what it saved; after the write ends,bcan be guarded and the page is taken. Both assertions fail on the old code.linking_an_unguardable_mapping_keeps_the_tracked_page_changed:bis busy when the runtime links it to the tracked pagea. Before:astayed current and writes throughbwere missed; now it stays changed. Fails without the change.cargo test -p victory-gpu --features diagnostics --libon Windows 10 19045 / RX 7800 XT: 199 passed, 1 ignored, plus the known placed-view failure on a runtime withoutID3D12Device10(#1999, identical onmain); clippy-D warningsclean. Three consecutive runs, same result.One thing I left alone: a page guarded only through an alias (no tracker holds it) is not opened when the runtime unmaps it, so the guard set can name freed memory. That is a different change (
title_memory_remapped/openof unheld pages), and the issue is about the take.@oni-swr on GitHub · 2026-11-25 16:13 UTC · original
Independent verification (software WARP only)
1d5e3b1496aad4ebe02aaf2cf51b532bbab243e6(checked out detached)67e8ae1401df112248aed36d0024483181b718b7; read-onlygit merge-tree --write-tree origin/main <head>merges cleanly (exit 0); GitHub reports MERGEABLE.VICTORY_D3D12_WARP=1withVICTORY_DXILpointing at the Windows SDK 10.0.26100dxil.dll. Default features, no extra test flags.Commands and results
cargo test --locked -p victory-gpucargo test --locked -p victory-gpu --lib watch::testswatch::testsfilter: 14 passed, includinga_page_whose_other_mapping_is_busy_is_not_takenandlinking_an_unguardable_mapping_keeps_the_tracked_page_changed.Review: Looks correct.
guard_aliasesnow returns the taken pages with an unguarded alias, andtake/takenskip them so they stay changed and keep their saved bytes.protectreturns already-protected pages as taken, sotitle_memory_aliasedonly marks the page changed when the protect really failed or was blocked by a busy write. The page is retaken on the next refresh once the mapping is free (the first test covers that). No regressions in the crate suite.Review and verification by Claude Code (Claude Sonnet 5.5), AI-assisted; no game files, dumps, shader names or hashes involved.
@Marvisak on GitHub · 2026-11-25 18:39 UTC · original
Automated triage for the maintainers.
Proposed close: duplicate of #2455. Both PRs fix issue #2454 with the same code change in
crates/victory-gpu/src/watch.rs.guard_aliasesreturns the pages with a mapping that could not be guarded.Tracked::take_splitandTracked::takenfilter those pages out. Intitle_memory_aliased, the page is markedchanged(.., false)whenprotectreturns nothing. The fix itself looks correct to me. #2455 was opened first, by the person who filed the issue, and passes CI. Its test uses two real views of one page (twin_views) and also covers theTracked::takenpath. The cleanup at the end of this PR's tests (unlinking, then opening the alias page) would be a useful suggestion on #2455.CI: the
checkrun passed on this head.This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.
Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.