You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs/dev/TechnicalDebt.md says that on Windows, host-pointer imports of the guest mapping are compared instead of write-watched, and that "measuring the comparison cost" is not done yet. Here is a measurement from one title, where this cost is most of the frame.
Setup. GTA V (PPSA04264), Windows 11, RTX 4090 (NVIDIA), WinLibs GCC 15.2.0, Release, write watch on. Tree: main 325e0a8 plus the PRs the title needs to reach Story, plus #2802. The scene is the first minutes of the Story prologue.
Where the time goes. I added local timers inside StorageTexture::Refresh (summed over all threads, per 10 s):
The draws bind resident render targets (3840x2160 and 1920x1080). Their memory is imported, so GuestMemory::ChangedBlocks reports it untracked and Refresh ends in compareUntracked over the whole surface.
Why the memo still misses with #2802. Out of 420k compareUntracked calls:
Outcome
Calls
memo hit
365k (87%)
miss because CollectEpoch changed
40k
miss because ForgetSerial changed
4.1k
miss because NewestStamp changed
0.8k
no memo entry yet
5.6k
not memoizable (memoize false or epoch 0)
8.3k
So almost every remaining compare is the one that guards against a CPU store into unwatched memory at a new ordering point. Splitting the compare into 64 KiB units would not change that, because at a new epoch every unit is a candidate. In this scene the compared surfaces were found unchanged about 98% of the time.
I don't have a proposal for how to keep these imports watched on Windows; the TechnicalDebt entry explains why the driver can dirty imported pages after the import window. I'm posting this so the cost is on record for whoever picks it up. Happy to run a branch on this title and report numbers.
Update: #4878 (nikowolf123) addresses this. On GTA V's Story prologue, the whole-surface compares go from 7 s to about 4 s per 10 s, and the frame rate from 0.60 to 1.09 FPS. Numbers are in #4878 (comment). I will close this issue once #4878 is merged.
Closing: #4878 is merged. On GTA V's Story prologue, the frame time went from 1372 to 856 ms (p50) on the same tree (traces in #4878 (comment)). The whole-surface compare is still the largest single cost; a follow-up would get its own issue.
Activity
perf(agc): compare Windows direct imports only after a write-watch mark
perf(agc): compare Windows direct imports only after a write-watch mark
tibzejoker commentedon Oct 13, 2026
Update: #4878 (nikowolf123) addresses this. On GTA V's Story prologue, the whole-surface compares go from 7 s to about 4 s per 10 s, and the frame rate from 0.60 to 1.09 FPS. Numbers are in #4878 (comment). I will close this issue once #4878 is merged.
AI-assisted (Claude Code).
perf(agc): compare Windows direct imports only after a write-watch mark
tibzejoker commentedon Oct 14, 2026
Closing: #4878 is merged. On GTA V's Story prologue, the frame time went from 1372 to 856 ms (p50) on the same tree (traces in #4878 (comment)). The whole-surface compare is still the largest single cost; a follow-up would get its own issue.
AI-assisted (Claude Code).