GPU: title memory copies are brought up to date again after a title write #2240
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!2240
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2240"
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?
@denkencar-sketch on GitHub · 2026-11-25 08:31 UTC · original
denkencar-sketch:fix/memory-copy-refresh→main· +39 −3 · 2 files · 1 commits · openSummary
A list that reads title memory through a view heap's page table queues one
Step::Memory(heap)(memory::prepare, which brings every host copy up to date):memory::bindcallsdefer_memoryonce, at the list's first title-memory draw, andState::memory_mapreturns its cached map after that without asking again. A buffer range (defer_refresh) or a heap's views (defer_heap) is queued again after a step that writes title memory, becausedefer_copyanddeferclearDeferred::refreshed.Step::Memorywas not, so a draw recorded after an in-list copy into a title buffer read the copy's old bytes through the page table.Change
HostList::defer_memoryqueuesStep::Memoryonce until a title write, keyed inrefreshedlikedefer_heap(the key is(heap, usize::MAX, 1), apart from buffer ranges anddefer_heap's(ptr, usize::MAX, 0)).State::memory_mapcallsdefer_memoryon its cached path too, which is a no-op unless a title write cleared the key.Testing
host::batch::title_memory_is_refreshed_again_after_a_title_write: twodefer_memorycalls queue one step, after adefer_copythe next ones queue one more, another heap queues its own. Onmainthe first assertion fails (two steps, not one).cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsis clean.Not tried: a run in the game, or a list that actually draws after such a copy (the test covers the queueing, and
memory_map's cached path is only read, not run).modules::dstorage::tests::a_page_list_filled_after_its_request_startsfails now and then onmaintoo (5 of 20 runs ofcargo test -p victory-hle --lib); it is unrelated.AI-assisted.
@MamaLeVrai on GitHub · 2026-11-25 09:13 UTC · original
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head
c11fb18dintomain940d32fin a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with--all-features: clean.cargo test --workspace --locked: 702 passed, 0 failed, 10 ignored, two runs (mainalone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
@Marvisak on GitHub · 2026-11-25 13:30 UTC · original · edited 2026-11-26 01:22 UTC
Automated triage for the maintainers.
Merge candidate (a recommendation to look, not an approval). Rebased onto current
mainwith the same change.HostList::defer_memory(crates/victory-gpu/src/host.rs) now queuesStep::Memory(heap)only when the key(heap, usize::MAX, 1)is new inDeferred::refreshed.defer_copyanddeferclear that set, as they already do fordefer_refresh/defer_heap.State::memory_map(draw.rs) now also calls it on its cached path, so a draw recorded after an in-list title write brings the page-table copies up to date again. Before, only the first title-memory draw did. The key cannot collide with buffer ranges or withdefer_heap's(.., usize::MAX, 0). The testtitle_memory_is_refreshed_again_after_a_title_writechecks the queueing; as the description says, no draw after such a copy was run.The branch merges cleanly. CI:
checkpassing.Generated by Claude Code
@DenRakEiw on GitHub · 2026-11-25 08:42 UTC · original · approved these changes
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib title_memory_is_refreshed_again_after_a_title_write— passed on RTX 5090cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean fix ensuring title memory copies are refreshed again after subsequent title writes. Looks good.
AI-assisted (Gemini 4 Neon).
@catminou4 on GitHub · 2026-11-25 08:48 UTC · original · reviewed
Title memory copies are brought up to date again after a step that wrote title memory; defer_memory deduped via refreshed set. 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. Pairs with #2235 (page-table retry) — both close title-memory freshness holes.
@fuzeofficlal on GitHub · 2026-11-26 19:27 UTC · original · approved these changes
Reviewed and verified
88bbc7a1c392c37e62e7bb87acbc39879dab0b74merged ontoorigin/main(63bcca43c6a00a758510398fa43096ce7e4f7df0) on Windows 11 x64 (RTX 5090 + Microsoft WARP, Rust 1.98.1 MSVC).Code Audit
HostList::defer_memory(crates/victory-gpu/src/host.rs:2118-2124) deduplicatesStep::Memory(heap)inDeferred::refreshedusing(heap, usize::MAX, 1), which is strictly disjoint from both buffer-range keys(shadow_ptr, addr, len)anddefer_heap's(viewed_ptr, usize::MAX, 0).defer_copyanddefer) clearDeferred::refreshed(while host/upload-onlydefer_fill/defer_hostdo not), so callinglist.defer_memory(heap)on the cached path ofState::memory_map(crates/victory-gpu/src/draw.rs:491-497) is a zero-step no-op until a title write occurs, and queues exactly one freshStep::Memory(heap)afterward.Local Verification
cargo xtask policy— pass.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features) — 0 warnings.cargo test --locked -p victory-gpu --lib batch::(RTX 5090 and WARP) — all passed, includingtitle_memory_is_refreshed_again_after_a_title_write.HostList: bound title memory (memory::bind), queuedlist.defer_copywriting0xDEAD_BEEFinto write-watched title memory, calledlist.defer_memoryagain, executed the list viahost.execute, and verified the host shadow copy read back0xDEAD_BEEFwith zero debug-layer messages on both RTX 5090 and WARP.#2223,#2276, and#2279on63bcca43c6a0builds and passes all targeted GPU tests cleanly on RTX 5090 and WARP.Looks good to merge.
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.