Proposal: copy shader writes back only when the title's CPU touches them (page guards), not after every flight #2583
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#2583
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?
@shawshanker18 on GitHub · 2026-11-25 16:13 UTC · original
Idea
Today every flight's shader writes come back to title memory after the flight: the layer snapshots or hashes the ranges, fetches the changed pieces, and merges them. Separately, a submission whose preparation reads title memory that a flight may write waits for that flight to land (a "settle").
Proposal: leave GPU-written ranges on the card and copy them back only when the title's CPU actually touches them:
PAGE_NOACCESS, the same guard machinerywatch.rsalready uses for writes).Other emulators reach their speed the same way: Yuzu/Ryujinx ("GPU accuracy: normal" skips most readbacks), Xenia (resolve readbacks off by default), Dolphin (skip EFB access from CPU).
Why (measured, fxceless fork
9376fd6, RTX 4050 Laptop, Series X, lit world)VICTORY_BARRIER_TEST=both) the frame does not change, and the card sits at about 60% load and 40 W (nvidia-smi). The card is waiting on the layer, not working.Risks / open questions
No game data in this proposal.
@Marvisak on GitHub · 2026-11-25 18:45 UTC · original
Automated triage for the maintainers.
This is a performance proposal for the GPU layer: copy shader writes back to title memory only when the title's CPU first touches them, using page guards. It fits the project's scope, and it is labelled and kept as a request.
The measurements quoted come from a fork, not from main, so a count of first CPU touches of declared ranges per frame on main would be the useful first data point, as the proposal itself suggests.
Generated by Claude Code
@Fran-co-F on GitHub · 2026-11-26 20:57 UTC · original
Data point for the first-touch count asked for here. This is only a counter: copy-back still runs as on main, then the declared pages are re-armed
PAGE_NOACCESSand the first touch is recorded.Setup: main
63bcca4plus the diagnostic, Linux, Wine 11.17 (patched wineserver) + vkd3d-proton, RX 9070 XT, 32 GB RAM, Series X profile. One run, one scene: in 3D at about 2 fps, character faces missing (as I have seen on other builds here). 64 KiB pages.Per frame, across the 16 five-second windows of the run:
copy_mapped) touch 30–44 % of the declared pages+0x35a3d6c(writes),+0x75885(writes),+0x4e4b680(reads)So for the title itself the idea looks promising; the layer's reads are the larger obstacle and would need to move to the card or fetch on demand. This does not measure any speedup, nor fault cost under demand copy-back. The run ended in an abort in dxil-spirv (
Invalid type ID in cast<T>), which looks specific to the Linux translation path; I have not checked whether the diagnostic plays a part.AI-assisted (patch and summary).