Windows: whole-surface compares of imported render targets dominate GTA V's draw path (measurement) #4432
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?
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-12T10:59:27Z.
docs/dev/TechnicalDebt.mdsays 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
325e0a8bdplus 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):GuestMemory::ChangedBlocksreports it untracked andRefreshends incompareUntrackedover the whole surface.Why the memo still misses with #2802. Out of 420k
compareUntrackedcalls:CollectEpochchangedForgetSerialchangedNewestStampchangedmemoizefalse or epoch 0)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.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-13T21:25:36Z.
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 https://github.com/boykopovar/AnyPS5/pull/4878#issuecomment-6153620579. I will close this issue once #4878 is merged.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-14T06:30:21Z.
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 https://github.com/boykopovar/AnyPS5/pull/4878#issuecomment-6158242409). The whole-surface compare is still the largest single cost; a follow-up would get its own issue.
AI-assisted (Claude Code).