Repository navigation
Conversation
|
@TheAggie a nudge on this one, because #6192 is stacked on it and shows a solid gain in a tester's run (p50 about 9% better). What blocks it is the maintainer's 18 Oct change request: this PR's own new test, |
|
GTA V (PPSA04264) data from Windows 11, RTX 4090, i9-13900K, in case a second title helps once the lavapipe crash is fixed. Build: main 3bbd232 + #9181 + #9159; GTA needs both to stay alive in the open world. Three ~8 min runs (boot, Story resume, open world) with
GTA looks like Flycast here: frequent forgets in a title with many compared surfaces. Two caveats. I have not split which part of the stamp makes Older context: on a 10-12 base (main 325e0a8 + #2802's memo), 87 % of GTA's untracked memo lookups hit. Most of the misses came from the collect epoch. Main now uses Offer: once the test fix is pushed, I can run GTA open world on main and on main + #6187, alternating, in the same session. I can also count which stamp part changed, as you did for Flycast. AI-assisted: yes (Claude Code) |
|
@TheAggie GTA V numbers for this PR and #6192 together are on #6192: committer 39.3 -> 24.7 µs per commit in the open world, on a port to current AI-assisted: yes (Claude Code) |
…for boykopovar#6187/boykopovar#6192 The per-block walk of untracked texture snapshots (drawcpu r2) walked each run of watched or hinted blocks with one collect. A run with uncommitted or no-access pages makes the Windows collector refuse the whole walk, so every block of the run was hashed ('walk refused', ~490k blocks / 30 GB per 10 s in the open world). The walk now takes the range's readable runs (DescribeCommitted) and collects only those pages. The entry keeps the layout it was proved at; a block is clean only when its clipped readable runs equal the baseline's and no stamp or hint is newer, so the hash (zeros for unreadable pages) cannot differ. The compare hashes with the same layout. [texhash] adds 'partly readable' and 'layout changed'. APS5_NO_UNTRACKED_LAYOUT=1 restores the whole-run walk. APS5_NO_UNTRACKED_FAST_PROOF=1 turns off boykopovar#6192's stamp proof, APS5_NO_FORGET_STAMPS=1 makes boykopovar#6187's ForgetStamp the global serial again. AI-assisted: yes
|
@TheAggie the Linux SIGSEGV in
Production can't reach it. The fix is one test-only commit on your head a049317: fix/6187-untracked-forget-teardown on our fork (bdc31eb31a,
We tested it on a port of this PR and #6192 onto main 2960e9a, on lavapipe. Without the fix the test crashed 20 of 20 times. With it, It's yours to take: cherry-pick it or merge the branch. |
|
stale+rebase Findings
Freshness Envelope
Cross-PR Ledger
|
|
Thank you @TheAggie for this change, and @tibzejoker for the port onto current We've carried it forward in #14261, so it can land on today's I'm closing this one in favour of #14261 so there's only one place to review. If you'd rather keep this PR and pick up those two test fixes yourself, say so and we'll do it that way instead. |
|
Hi @TheAggie, thank you for this change. It is on Hi @adriadam10, since you are assigned here: unless you see something in this PR that #14261 did not carry, this one can be closed as merged through #14261. |
|
Closing as merged through #14261 (merge 60a8b3b, 4 Nov), which carried these commits onto current main with the original authorship. Thanks again @TheAggie; @adriadam10 for visibility as assignee. |
…for boykopovar#6187/boykopovar#6192 The per-block walk of untracked texture snapshots (drawcpu r2) walked each run of watched or hinted blocks with one collect. A run with uncommitted or no-access pages makes the Windows collector refuse the whole walk, so every block of the run was hashed ('walk refused', ~490k blocks / 30 GB per 10 s in the open world). The walk now takes the range's readable runs (DescribeCommitted) and collects only those pages. The entry keeps the layout it was proved at; a block is clean only when its clipped readable runs equal the baseline's and no stamp or hint is newer, so the hash (zeros for unreadable pages) cannot differ. The compare hashes with the same layout. [texhash] adds 'partly readable' and 'layout changed'. APS5_NO_UNTRACKED_LAYOUT=1 restores the whole-run walk. APS5_NO_UNTRACKED_FAST_PROOF=1 turns off boykopovar#6192's stamp proof, APS5_NO_FORGET_STAMPS=1 makes boykopovar#6187's ForgetStamp the global serial again. AI-assisted: yes
What
A storage image over guest memory the write watch does not cover (on Windows, every host-pointer import of the guest mapping, #1441) is checked by comparing its saved bytes with guest memory (
StorageTexture::compareUntracked). The comparison is memoized under a stamp, and one part of that stamp isGuestMemory::ForgetSerial, a single counter that moves on everyForgetPagescall anywhere in guest memory. A title that maps and frees memory all the time therefore drops every untracked image's memo, and each refresh compares the whole surface again.In RetroArch's Flycast core (PPSA99169) on Windows, that is the 1.7 MB render target compared about 26,000 times per 10 s, about 44 GB of
memcmp, a third of the draw committer's busy time. Counting which part of the stamp changed between compares: the forget serial in about 255,000 cases, the epoch or driver-store stamp in under 4,000 each, the write note in none.ForgetPagesalso raises a per-block stamp: a fixed table of 65,536 slots, one per 64 KiB block of the forgotten range (block index modulo the table), each holding the newest forget serial that touched it. A range wider than the table raises one shared stamp instead.GuestMemory::ForgetStamp(address, bytes)is the newest of those over a range. A collision between blocks only makes it newer, so the memo is dropped too often, never too rarely.compareUntrackedstamps withForgetStampof the surface instead of the global serial. A forget in progress (oddForgetSerial) still disables the memo, as before.No runtime switch: the memo rule is the same, only the forget part of the stamp is now per range.
Tested
Windows 11, NVIDIA GeForce RTX 5070 Ti, MinGW-w64 GCC 15.2.0, on main
8cd937e29; rebased onto main92e50418f(only a CMake test list conflicted), where the full suite with #6192 on top passes 1277 of 1296, 14 skipped, failing only the known tests below.ctest: 1232 of 1248 pass, 14 skipped.guest_call_trace_abortandwindows_backtrace_reportfail, and fail the same way on plain main here.agc_driver_prepared_graphics_prebuild_0/_1andundeliverable_host_exceptionfail under my test runner because it skips their environment changes and pass pattern; run with those, they pass.agc_untracked_forget(agc_driver_recorder_tests --untracked-forget-only): an untracked surface in its own allocation and a second untracked allocation. After the first refresh, a second refresh in the same epoch does not compare; invalidating the other allocation does not make the refresh compare; invalidating the surface's own memory does. With the old stamp (globalForgetSerial) the test fails with "forgetting memory the surface does not cover made its refresh compare again".ANYPS5_PRESENT_MODE=immediate, unprofiled. Measured on a local stack:maina453108cfplus local frontend support, perf(agc): find cached draws across moved user-data pointers #4943, perf(agc): reuse draw snapshots across draws that nothing wrote between #5906 and perf(agc): reuse cached draw stages when only buffer base addresses moved #5609, a port of perf(agc): pipeline queue-0 draw commits behind the packet worker #1201's pipelined draw committer, and two local changes (GPU-only lease pins, DCC key proofs in unwatched memory). Same stack without and with this change, two runs each: audio produced at 52.5% and 52.9% of real time against 63.1% and 62.6%. The committer's render target phase went from 10.4 to 5.25 µs per draw. I have no measurement ofmainalone with only this change.Related: #1441 introduced the compared imports on Windows. #5906 removes another Windows cost of the same exclusion (draw snapshots). #4448 attacks the same compare cost from the other side on i915, by keeping more surfaces watched (a smaller import window, no self-import of a watched surface); this PR only changes when the memo of a surface that stays untracked is dropped, so the two complement each other. Both add a function right after
ForgetSerialinGuestMemory.hpp/.cpp, which is a trivial conflict for whichever lands second. #6060 keeps Windows imports of private write-watched memory onGetWriteWatchwhen a start-up probe allows it; memory it keeps watched never reaches this path, so this PR matters for what stays untracked (imports through views, devices whose probe fails). I have not measured how much of the Flycast workload #6060 would cover.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code