fix(agc): hash an idle unit when its range leaves the write watch instead of at every upload #10026

Merged
winstrex merged 25 commits from upstream-pr/10026 into main 2026-11-02 07:59:45 +00:00
winstrex commented 2026-10-23 05:03:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by winstrex on 2026-10-23T05:03:40Z.


This PR's own commits, without #7048's below them: ec6ceece9, f27fcde50 and d73e64951.

What

#7048 stores results that land in a unit over memory that has left the write watch, as long as the unit's bytes still match what was uploaded. For surfaces over 1 MiB it checks this against a per-unit hash, which upload() takes on every settled upload. That pass reads and hashes the whole surface each time. On The Pathless (PPSA01825) menu it costs about 70 % of the presents, with 89 % of the draw committer's samples in StorageTexture::upload. The hash is only read in markLayersPending, for a unit with a write generation, no saved bytes and a range that is no longer watched.

This PR takes that hash once, when it can be trusted and is about to be needed: when the unit's range leaves the watch. This is the shape @oneandonlydean described in #7048. The first commits here are #7048's own, followed by a merge with main that resolves #7048's conflict with it (described below). This PR's change is the next commit, ec6ceece9. A second merge with main on top of it adapts that change to main's tracker lock, f27fcde50 makes the refusal name its cause, d73e64951 corrects the debt entry, and a third merge with main (2853a75c1) resolves a conflict with #9159 (all below).

  • The unwatch hook (StorageTexture::SaveBeforeUnwatch) also visits the live textures over 1 MiB that overlap the range. For each unit there with a write generation, no pending results and no saved bytes, it collects the range's writes. If the watch shows no write since that generation, it records a 128-bit hash of the unit's bytes together with that generation. upload() and refresh no longer hash anything.
  • markLayersPending captures such a unit only while its bytes still match the hash and the hash's generation is still the unit's. With no hash, or a mismatch, it refuses, as it does now. Surfaces of 1 MiB or less keep comparing with the copy taken at the upload, so the hook doesn't visit them.
  • The hook doesn't flush pending GPU writes before hashing. A GPU write that lands later changes the bytes, so the hash no longer matches and the capture is refused.
  • ImportWatched now runs the hook over the two spans of an import that stays watched which left the watch without it: a span whose page walk fails before the import (the hook runs before the import) and one whose walk fails after it. These are the spans #7505 covers. Whichever of the two lands second drops its GuestMemory.cpp hunk.
    • After @ahmadmuj's review (43a9245e8): the hooks of the spans whose walk fails after the import run after every span's window walk, under one suspension of the tracker lock. Running each hook inside the loop let another thread collect a later span without its window, and stamp the pages the import touched as CPU writes. A guard resumes the lock even if a hook throws.
  • Where the CPU's writes to a range can't be proven as it leaves the watch, the hook still saves pending results but records no hash: those two spans, and a failed fresh collect in MarkWritten (UnwatchWritesProven). A unit there has no baseline, and its capture is refused, as before.
  • Ranges that leave the watch without going through the hook are unchanged: GuestWriteWatchUnregister called from libkernel on Linux when a mapping is aliased, unmapped or replaced. On Windows there are none: the host regions are fixed when the guest arena is reserved, the commit generation only decides when a later commit restores the watch, and every path that takes a range out of the watch runs the hook (d73e64951 drops the Windows case I had listed). Taking the Linux case through the hook touches libkernel and is left for a separate PR. The new debt entry "Units without a baseline outside the write watch" lists them. A unit there has no hash, so results that land in it outside the watch throw when they are stored, as on main.
  • SetImportWalkFailureForTest lets the tests fail either walk on both platforms.

The refusal names its cause (f27fcde50, after @zaidhawk's Persona 3 Reload run below). What is captured and what is refused don't change. The refusal now ends with the first unit refused and why it has no baseline, for example (unit 63 of 64: its range left the watch through the unwatch hook without its CPU writes proven (a failed collect or import page walk)). The causes:

  • its results became pending while its range was watched, and its bytes weren't saved when the range left the watch;
  • a save of its bytes was in flight when its results became pending and didn't complete, or its saved bytes were dropped while its results were pending;
  • on surfaces of 1 MiB or less: no copy was taken at the upload, or the bytes differ from it;
  • on larger surfaces: no hash for the unit's current generation (its range left the watch without the hook, or its generation changed after the hash), the hook ran without the CPU writes proven, the watch saw CPU writes after the unit's generation, the unit had pending results or saved bytes when the hook ran, or the bytes no longer match the hash.

The hook records why it didn't hash a unit next to the hash, with the generation it applies to. To record the unproven case it now also visits the live textures over 1 MiB when the CPU writes aren't proven. That path takes GpuMutex when one of them overlaps, and it only runs after a failed collect or a failed import page walk.

A wait I found and fixed while measuring. In the first version, the hook took GuestMemory::GpuMutex whenever the range overlapped any live texture. On main it only takes it when a texture with pending results overlaps. During The Pathless's menu that happened hundreds of times, and the thread doing the unwatch waited for the draw committer to release the mutex: 296–316 presents per 10 s against main's 315–336. The hook's own code didn't show in the samples, because the cost was the wait. The hook now visits only textures over 1 MiB, the same limit as #7048's hash. Those are the only ones a hash is ever taken for, so in The Pathless it takes the mutex no more often than main does.

What the hook costs. A local counter that is not part of this PR, over the menu of each title:

  • The Pathless: about 1,800 unwatch events per second while it boots and 44–112 per second in the menu. LEGO Horizon Adventures (PPSA14632): 19 in 4 minutes. Hades (PPSA03355): none.
  • All of them went through the hook. The two ImportWatched exits were never reached.
  • None found an idle unit to hash, so the hook read 0 bytes in all three titles. On these titles the hash path itself is exercised only by the tests below. @zaidhawk (Persona 3 Reload, PPSA10872), @dantdmdarealguy (Stray, PPSA02100) and @oneandonlydean (ASTRO BOT), could you run this head on the scene where you measured #7048's slowdown? Those are the titles where a unit is expected to lose the watch while idle. I don't have Persona 3 Reload, so it wasn't tested here.

Merge with main. Since c0dbd1871c (perf(agc): draw finisher pipeline), #7048 conflicts with main in StorageTexture::markLayersPending: main reworked the loop that #7048 changes. Until #7048 is rebased, this branch carries a merge of #7048's head da9f0ead4 with main e3d03fbae6 (93c878b36):

  • #7048's part, in the merge commit: the loop keeps main's structure (unsaved starts empty, the CommitTrims() prefilter, then assign and the full loop), with #7048's condition in the full loop. The prefilter checks noBaseline && (layerGeneration == 0 || savedTicket == 0), which every unit #7048's condition selects passes, so APS5_DRAW_PIPELINE doesn't change which units are captured, and the byte comparison still runs only in the full loop. The merge also keeps GenerationBaselineBytes where #7048 moved it; main declared it a second time next to its new SingleKeyColorFor.
  • This PR's part: the commit has the same changes as d6138938c. Its only conflict was its rename of guestMatchesUpload to guestMatchesBaseline, on the line of the full loop that #7048 changes.
  • Second merge, with main 9d164f0d87 (df1b2d5e9): #6169 (answer a collect memo hit with the generation of the last finished tracker update) made lockTracker() return TrackerLock, which has no unlock()/lock(). This conflict is entirely in this PR's part. markWritten and the leave lambda in ImportWatched now release the tracker around beforeUnwatchUnproven with Suspend() and Resume(). Git merged the ImportWatched lambda without a conflict, but it no longer compiled. TrackerLock::Unlock() is not used here, because it publishes the generation, and both paths stamp blocks again after relocking; #6169 releases markWritten the same way. @eliasbruno124-dev reached the same adaptation and tested it on an RTX 3060 Laptop GPU (comment).
  • Third merge, with main cf528e78c6 (2853a75c1): #9159 (keep a rewatched import's memory compared once it is shared) marks each span of ImportWatched whose page walk succeeds as compared once it is shared, on Windows, in the loop where this PR takes a span whose walk failed out of the watch through the hook. Both are kept: a span whose walk fails goes through leave and is skipped, and a span whose walk succeeds is marked with GuestArenaCompareResidentWhenShared, as on main. #9159 doesn't add a way out of the watch without the hook. Marking a page compared stops arming its shared aliases but leaves the range covered, and a walk that is refused because of compared pages now stamps them and records them as refused, which UnchangedSince reports as changed. For this PR that can only turn a hash into the "watch saw CPU writes" skip, never bypass the hook. I counted the hook's decisions with local counters that aren't part of the PR. In the write-watch, storage image and import tests, #9159's included, only agc_storage_pending_after_unwatch reaches a hook decision, and none of its decisions came from a refused walk; its one CPU-writes skip is the case it makes on purpose. In a run of The Pathless's menu the hook decided for no unit at all.
  • Fourth merge, with main 4017310678 (b61555e17): the only conflict was in docs/dev/debt/libSceAgcDriver.md, where #9275 added an entry under the one this PR rewrites. Both are kept: this PR's two entries, then #9275's unchanged.
  • Fifth merge, with main f55190f7e3 (90be5898c), for the conflict with #9685 (store resident linear color targets at completion points, limited to their drawn rectangles) in Texture.cpp. #9685 gives a pending unit a generation per 64 KiB block (unitBlockGeneration), raised where a completion store wrote, and no longer refuses a unit without a baseline in a target with drawn rectangles. Both are kept:
    • markLayersPending: this PR's capture with its baseline causes stays where it is, and #9685's loop that clears the blocks' completion generations replaces the one that marks the units pending.
    • saveBeforeUnwatch: this PR moved the written-block check into keepWrittenSince, which captureGuestBytes also calls. #9685's per-block generations are now in keepWrittenSince. Its other caller runs before the units are marked pending, where unitBlockGeneration returns the unit's generation, as before.
    • The refusal: #9685's condition (unknown && !drawn.rect), with this PR's cause inside it. The units #9685 no longer refuses need no cause.
    • cfbe00cb4 adds a case to #9685's agc_driver_linear_target_cpu_writes: the target's memory leaves the watch after the draw that records its rectangle, so the hook runs over the pending rectangle before the completion store, and the store must still keep the drawn half and the CPU's later stores to the other half.
  • Sixth merge, with main 27ad7244d2 (339783405), for the conflict with #7505 (run the unwatch hook before an import whose range leaves the write watch whatever the import does), which runs the hook for every range that leaves the watch, as this PR does:
    • ImportWatched: this PR's version is kept. #7505 runs the hook of a span whose window walk fails inside the loop over the window walks, with the tracker lock suspended, so another thread can collect a later span before its window walk. That is the race @ahmadmuj found in this PR's b61555e17, now on main. Here every window walk finishes before the failed spans' hooks run under one suspension, and CheckImportWalkHookKeepsLaterWindows reproduces the race. The rest of main's changes to the file, such as #10369's importMayWriteGuest, merged without a conflict.
    • tests/WriteTracking.cpp: both sides are kept. main() runs this PR's CheckImportWalkUnwatchHooks and CheckImportWalkHookKeepsLaterWindows and #7505's CheckUnwatchHooks, which passes on this head.
    • docs/dev/debt/libSceAgcDriver.md: this PR's first entry, with #7505's "or whose page walk fails" in its parenthesis, and its second entry unchanged. #7505's last two sentences are dropped: the second entry covers the units without saved bytes that they describe.
  • Seventh merge, with main cda9c9bedf (bfe0e86a3), for the conflict with #10655 (hash the pages of an import window on several threads) in ImportWatched. main's hashing is kept (CheckRange over the spans, then HashPages), still under the tracker lock and before the first page walks, and so are this PR's failsWalk and leave. #7505's saveBytes stays out, as in the sixth merge. #10655's tests are in agc_write_tracking.
  • When #7048 is rebased, this commit goes on its new head, with that adaptation.

Tested

Windows 11 (10.0.26300), NVIDIA GeForce RTX 5070 Ti, driver 591.86, WinLibs GCC 15.2.0 r7, Release, with Overwolf's implicit Vulkan layers disabled. All three builds are on main 83462cc57: main itself, main merged with #7048's head da9f0ead4 (e2c1fe440), and main merged with this PR's head (4989cab12). The merges are local and clean.

  • The Pathless (PPSA01825), main menu: main 319–326 presents per 10 s, main + #7048 85–105, main + #7048 + this PR 307–316. Two APS5_TRACE_SECONDS=120:10 captures per build, alternated, no APS5_PROFILE_*.

    Measurements
    main main + #7048 + #7048 + #7048 + this PR + #7048 + this PR
    presents in the 10 s window 319 330 104 85 304 316
    mean of the menu's 10 s intervals 319 326 104 88 307 316
    frame p50 / p99 in the window (ms) 27.7 / 64.6 27.6 / 59.7 110.2 / 127.9 130.3 / 175.1 28.2 / 71.7 27.8 / 65.3
    GPU busy per present (ms) 17.60 17.48 18.59 20.65 18.20 17.64
    committer Graphics.Draw per frame (ms) 15.1 14.6 77.4 96.2 16.3 15.5

    Isolation: #7048 with its upload hash turned off locally and without this PR's hook (hashUnits = false, a dirty local tree, alternated with two more main runs) gives 314 and 316 presents on average (windows 316 and 328), against 321 and 322 for main (windows 319 and 319). So the 2–4 % left between main and the two PRs together comes from the rest of #7048, not from the hook.

    APS5_PLAYGO_UNLISTED_CHUNKS=absent, warm caches, APS5_TRACE_EVENTS=1048576 so no thread dropped events, and APS5_TRACE_SUMMARY_EVERY=10. The traces are in pathless-traces-main-83462cc57.zip, pathless-traces-main-7048-e2c1fe440.zip, pathless-traces-pr-4989cab12.zip and pathless-traces-isolation-7048-no-upload-hash.zip.

    aps5-summary.jsonl, main, main + #7048, then main + #7048 + this PR:

    {"commit":"83462cc57dde","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":4146,"ms":10018.488},"presents":319,"frame_ms":{"p50":27.729,"p90":59.545,"p99":64.626,"max":73.425},"gpu_busy_ms_per_present":17.596,"worker_busy_pct":{"queue worker 0x0":92.006,"queue worker 0x20":10.334},"top_phases_ms_per_frame":{"Driver.Packet":31.437,"Graphics.Draw":15.107,"Driver.Packet.device_lock":14.321,"Graphics.Draw.draw_and_resource_release":13.759,"Driver.Packet.draw":6.495,"Driver.Draw":6.421,"Resources.Complete":4.895,"Driver.Draw.shader_compile_and_link":4.765},"trace_dropped":false,"trace":"aps5-trace-83462cc57dde-29980.json.gz"}
    {"commit":"83462cc57dde","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":4187,"ms":10020.868},"presents":330,"frame_ms":{"p50":27.649,"p90":54.126,"p99":59.696,"max":60.637},"gpu_busy_ms_per_present":17.480,"worker_busy_pct":{"queue worker 0x0":91.835,"queue worker 0x20":10.195},"top_phases_ms_per_frame":{"Driver.Packet":30.406,"Graphics.Draw":14.573,"Driver.Packet.device_lock":13.607,"Graphics.Draw.draw_and_resource_release":13.237,"Driver.Packet.draw":6.545,"Driver.Draw":6.470,"Driver.Draw.shader_compile_and_link":4.702,"Resources.Complete":4.549},"trace_dropped":false,"trace":"aps5-trace-83462cc57dde-33460.json.gz"}
    {"commit":"e2c1fe440ccd","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":1997,"ms":10040.790},"presents":104,"frame_ms":{"p50":110.226,"p90":120.240,"p99":127.892,"max":135.139},"gpu_busy_ms_per_present":18.587,"worker_busy_pct":{"queue worker 0x0":96.081,"queue worker 0x20":43.082},"top_phases_ms_per_frame":{"Driver.Packet":130.972,"Graphics.Draw":77.392,"Graphics.Draw.draw_and_resource_release":76.029,"Driver.Packet.draw":48.377,"Driver.Draw":48.303,"Driver.Draw.draw_enqueued":42.480,"Driver.Packet.dispatch":40.343,"Driver.Dispatch":40.177},"trace_dropped":false,"trace":"aps5-trace-e2c1fe440ccd-10948.json.gz"}
    {"commit":"e2c1fe440ccd","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":1841,"ms":10038.742},"presents":85,"frame_ms":{"p50":130.344,"p90":140.557,"p99":175.127,"max":175.127},"gpu_busy_ms_per_present":20.646,"worker_busy_pct":{"queue worker 0x0":95.237,"queue worker 0x20":42.248},"top_phases_ms_per_frame":{"Driver.Packet":155.389,"Graphics.Draw":96.209,"Graphics.Draw.draw_and_resource_release":94.571,"Driver.Packet.draw":55.405,"Driver.Draw":55.314,"Driver.Draw.draw_enqueued":48.652,"Driver.Packet.device_lock":47.731,"Driver.Packet.dispatch":45.805},"trace_dropped":false,"trace":"aps5-trace-e2c1fe440ccd-14240.json.gz"}
    {"commit":"4989cab1235e","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":3973,"ms":10026.852},"presents":304,"frame_ms":{"p50":28.193,"p90":64.734,"p99":71.709,"max":71.988},"gpu_busy_ms_per_present":18.203,"worker_busy_pct":{"queue worker 0x0":91.923,"queue worker 0x20":10.543},"top_phases_ms_per_frame":{"Driver.Packet":32.941,"Graphics.Draw":16.282,"Driver.Packet.device_lock":15.617,"Graphics.Draw.draw_and_resource_release":14.918,"Driver.Packet.draw":6.533,"Driver.Draw":6.461,"Resources.Complete":5.824,"VideoOut.Flip":5.168},"trace_dropped":false,"trace":"aps5-trace-4989cab1235e-38540.json.gz"}
    {"commit":"4989cab1235e","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":4098,"ms":10021.926},"presents":316,"frame_ms":{"p50":27.804,"p90":60.844,"p99":65.277,"max":67.448},"gpu_busy_ms_per_present":17.637,"worker_busy_pct":{"queue worker 0x20":12.187,"queue worker 0x0":91.937},"top_phases_ms_per_frame":{"Driver.Packet":32.360,"Graphics.Draw":15.507,"Driver.Packet.device_lock":14.930,"Graphics.Draw.draw_and_resource_release":14.196,"Driver.Packet.draw":6.531,"Driver.Draw":6.459,"Driver.Packet.dispatch":5.332,"Resources.Complete":5.249},"trace_dropped":false,"trace":"aps5-trace-4989cab1235e-42320.json.gz"}
    

    tools/trace_digest.py, main:

    **16 intervals**, 0.0 to 160.7 s, 5420 presents
    NVIDIA GeForce RTX 5070 Ti, NVIDIA 591.86, Windows 10.0.26300, 3840x2160, commit 83462cc57dde
    commit, environment, GPU, driver or OS changed at interval 2
    
    | # | seconds | presents | p50 | p90 | p99 | max | GPU busy | busiest worker | largest phase |
    |---|---|---|---|---|---|---|---|---|---|
    | 1 | 0-10 | 547 | 16.7 | 17.0 | 38.8 | 518.4 | 0.7 | 15 % | VideoOut.Flip 11.4 |
    | 2 | 10-20 | 454 | 16.7 | 16.9 | 193.1 | 1448.0 | 1.2 | 92 % | Driver.Packet 21.4 |
    | 3 | 20-30 | 259 | 27.9 | 55.9 | 228.4 | 454.0 | 18.1 | 93 % | Driver.Packet 40.8 |
    | 4 | 30-40 | 329 | 27.5 | 53.1 | 59.5 | 60.6 | 17.6 | 92 % | Driver.Packet 30.6 |
    | 5 | 40-50 | 331 | 27.6 | 53.1 | 56.6 | 58.5 | 17.7 | 93 % | Driver.Packet 30.6 |
    | 6 | 50-60 | 329 | 27.6 | 53.6 | 58.3 | 60.7 | 17.7 | 92 % | Driver.Packet 30.5 |
    | 7 | 60-70 | 326 | 27.8 | 53.5 | 60.8 | 61.3 | 17.7 | 92 % | Driver.Packet 31.1 |
    | 8 | 70-80 | 317 | 27.8 | 60.4 | 64.5 | 68.3 | 17.7 | 93 % | Driver.Packet 31.7 |
    | 9 | 80-90 | 315 | 27.9 | 60.5 | 67.2 | 73.4 | 17.6 | 92 % | Driver.Packet 31.9 |
    | 10 | 90-100 | 317 | 27.9 | 60.5 | 67.8 | 72.4 | 17.6 | 92 % | Driver.Packet 31.6 |
    | 11 | 100-110 | 315 | 27.7 | 62.2 | 66.8 | 70.0 | 17.6 | 92 % | Driver.Packet 32.2 |
    | 12 | 110-120 | 318 | 27.9 | 59.5 | 67.2 | 69.2 | 17.6 | 92 % | Driver.Packet 31.6 |
    | 13 | 120-131 | 309 | 27.7 | 59.6 | 67.2 | 653.6 | 17.6 | 92 % | Driver.Packet 33.4 |
    | 14 | 131-141 | 317 | 27.8 | 60.0 | 65.0 | 66.2 | 17.7 | 92 % | Driver.Packet 32.3 |
    | 15 | 141-151 | 318 | 27.8 | 59.8 | 66.6 | 71.4 | 17.6 | 92 % | Driver.Packet 31.1 |
    | 16 | 151-161 | 319 | 27.7 | 60.3 | 65.6 | 72.0 | 17.6 | 92 % | Driver.Packet 31.7 |
    
    

    p99 ms :%@::::--------- 0-228.4
    gpu ms ._@@@@@@@@@@@@@@ 0-18.1

    tools/trace_digest.py, main + #7048:

    **14 intervals**, 0.0 to 141.0 s, 2215 presents
    NVIDIA GeForce RTX 5070 Ti, NVIDIA 591.86, Windows 10.0.26300, 3840x2160, commit e2c1fe440ccd
    commit, environment, GPU, driver or OS changed at interval 2
    
    | # | seconds | presents | p50 | p90 | p99 | max | GPU busy | busiest worker | largest phase |
    |---|---|---|---|---|---|---|---|---|---|
    | 1 | 0-10 | 541 | 16.7 | 18.8 | 36.1 | 500.6 | 0.7 | 30 % | VideoOut.Flip 8.7 |
    | 2 | 10-20 | 453 | 16.7 | 17.0 | 17.4 | 1341.9 | 1.1 | 94 % | Driver.Packet 22.7 |
    | 3 | 20-30 | 82 | 113.2 | 185.0 | 488.5 | 488.5 | 20.4 | 96 % | Driver.Packet 167.4 |
    | 4 | 30-40 | 103 | 110.5 | 121.0 | 126.0 | 126.4 | 18.4 | 96 % | Driver.Packet 138.4 |
    | 5 | 40-51 | 102 | 115.4 | 122.1 | 131.0 | 131.5 | 18.8 | 97 % | Driver.Packet 138.1 |
    | 6 | 51-61 | 102 | 115.9 | 122.0 | 127.3 | 128.5 | 18.7 | 96 % | Driver.Packet 138.3 |
    | 7 | 61-71 | 103 | 113.7 | 121.1 | 123.3 | 126.8 | 18.4 | 96 % | Driver.Packet 136.9 |
    | 8 | 71-81 | 102 | 116.7 | 121.8 | 128.7 | 139.8 | 18.7 | 96 % | Driver.Packet 135.9 |
    | 9 | 81-91 | 105 | 110.2 | 120.5 | 123.3 | 125.1 | 18.4 | 95 % | Driver.Packet 134.2 |
    | 10 | 91-101 | 105 | 109.5 | 119.6 | 123.0 | 125.2 | 18.8 | 96 % | Driver.Packet 133.2 |
    | 11 | 101-111 | 105 | 80.3 | 119.8 | 122.5 | 122.9 | 18.2 | 96 % | Driver.Packet 129.8 |
    | 12 | 111-121 | 103 | 110.6 | 120.3 | 128.5 | 130.3 | 18.5 | 95 % | Driver.Packet 133.0 |
    | 13 | 121-131 | 104 | 109.8 | 120.5 | 135.1 | 215.6 | 18.6 | 96 % | Driver.Packet 131.0 |
    | 14 | 131-141 | 105 | 110.4 | 119.4 | 123.8 | 125.0 | 18.7 | 95 % | Driver.Packet 128.4 |
    
    

    p99 ms _.@::::::::::: 0-488.5
    gpu ms ..@%%%%%%%%%%% 0-20.4

    tools/trace_digest.py, main + #7048 + this PR:

    **15 intervals**, 0.0 to 150.7 s, 4900 presents
    NVIDIA GeForce RTX 5070 Ti, NVIDIA 591.86, Windows 10.0.26300, 3840x2160, commit 4989cab1235e
    commit, environment, GPU, driver or OS changed at interval 2
    
    | # | seconds | presents | p50 | p90 | p99 | max | GPU busy | busiest worker | largest phase |
    |---|---|---|---|---|---|---|---|---|---|
    | 1 | 0-10 | 538 | 16.7 | 17.0 | 45.0 | 567.6 | 0.7 | 16 % | VideoOut.Flip 13.1 |
    | 2 | 10-20 | 446 | 16.7 | 16.9 | 191.5 | 1366.8 | 1.0 | 88 % | Driver.Packet 21.6 |
    | 3 | 20-30 | 232 | 28.1 | 67.9 | 173.7 | 1038.1 | 19.2 | 92 % | Driver.Packet 47.2 |
    | 4 | 30-40 | 308 | 27.8 | 63.9 | 71.2 | 73.7 | 18.1 | 92 % | Driver.Packet 33.2 |
    | 5 | 40-50 | 304 | 28.0 | 65.6 | 71.4 | 73.0 | 18.2 | 92 % | Driver.Packet 33.3 |
    | 6 | 50-60 | 310 | 28.0 | 61.7 | 67.4 | 70.2 | 18.1 | 92 % | Driver.Packet 32.0 |
    | 7 | 60-70 | 307 | 28.0 | 63.4 | 70.4 | 73.3 | 18.1 | 92 % | Driver.Packet 32.9 |
    | 8 | 70-80 | 307 | 27.9 | 64.4 | 70.6 | 71.9 | 18.2 | 92 % | Driver.Packet 32.6 |
    | 9 | 80-90 | 310 | 27.9 | 62.3 | 68.3 | 68.9 | 18.2 | 92 % | Driver.Packet 32.8 |
    | 10 | 90-101 | 308 | 27.9 | 62.5 | 71.5 | 73.8 | 18.1 | 92 % | Driver.Packet 32.9 |
    | 11 | 101-111 | 307 | 27.9 | 62.8 | 69.1 | 79.4 | 18.1 | 92 % | Driver.Packet 32.9 |
    | 12 | 111-121 | 312 | 27.7 | 62.1 | 67.7 | 71.6 | 18.2 | 92 % | Driver.Packet 32.9 |
    | 13 | 121-131 | 289 | 28.2 | 64.8 | 71.9 | 634.7 | 18.2 | 93 % | Driver.Packet 35.2 |
    | 14 | 131-141 | 311 | 28.0 | 61.4 | 66.8 | 68.9 | 18.1 | 92 % | Driver.Packet 32.6 |
    | 15 | 141-151 | 311 | 28.0 | 61.3 | 69.2 | 71.4 | 18.1 | 92 % | Driver.Packet 32.8 |
    
    

    p99 ms :@%------------ 0-191.5
    gpu ms ..@%@%@@@@@@@@@ 0-19.2

  • #7017's refusal on The Pathless: 60 s runs, alternated. main stopped on storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented in 3 of 8 runs, 8 to 10 s in. main + #7048 + this PR stopped in none: 0 of 7 runs with the hook's first version (before the 1 MiB limit) and 0 of 6 with this head.

  • LEGO Horizon Adventures (PPSA14632) and Hades (PPSA03355): one run per side, main against main + #7048 + this PR. LEGO's loading screen gives 57–65 presents per 10 s against 63–65, and its menu 29–33 against 30–32. Hades gameplay gives 295–330 against 296–336. No refusal in any run. These two ran with the hook's first version; the 1 MiB limit only narrows the textures it visits.

  • Persona 3 Reload (PPSA10872): I don't have it. @zaidhawk ran df1b2d5e9 on an RTX 5090 (comment): the start-up screens and the opening animation are back at main's rate (596–600 presents per 10 s, against 117–122 with #7048 alone), but 1 of 5 runs stopped on the refusal, which #7048 alone didn't in 5. Its log doesn't say which case it was; f27fcde50 adds that to the message. They ran d73e64951 again with 120 s runs (comment): 0 of 10 runs stopped on the refusal, against 2 of 5 on main 9d164f0d8 and 0 of 5 with main + #7048, so there is no cause line yet. Over both sessions this PR stopped in 1 of 15 runs, #7048 alone in 0 of 10 and main in 4 of 10. The start-up screens stayed at 594–596 presents per 10 s with this PR, against 120–122 with #7048.

  • Tests:

    • agc_storage_pending_after_unwatch checks the cause named in every refusal, with three new cases: the last block leaves the watch without the hook (refused at 1024×1024 for having no hash; stored at 256×256, which compares with the upload copy), the same while the results are pending (refused in both sizes), and a failed collect, on Windows (refused at 1024×1024 as unproven; stored at 256×256). Recording the wrong cause in the hook makes it fail.
    • agc_storage_pending_after_unwatch passes in both sizes (256×256 through the upload copy, 1024×1024 through the hash). New case: a CPU write into the last block while it is still watched, before it leaves the watch. The unit then has no baseline, and the capture is refused in both sizes with the CPU's bytes kept. The existing case with a CPU write after the unwatch, which is after the baseline, is still refused at 1024×1024.
    • agc_write_tracking: CheckImportWalkUnwatchHooks reaches both ImportWatched exits through SetImportWalkFailureForTest. It checks that each runs the hook once while its block is still watched, before the import for the first exit and after it for the second, and with the CPU writes reported as not proven. It also checks that Unwatch reports them as proven. CheckFailedCollectUnwatch now also checks that a failed collect reports them as not proven. CheckImportWalkHookKeepsLaterWindows fails the walk of only the first of two spans after the import, and its unwatch hook collects the second span while the lock is suspended, as another thread could. It checks that a page the import touched there without changing it still reads as unchanged, with its window walk's possible CPU touch. It fails on b61555e17 and passes from 43a9245e8.
    • Mutation check, redone at 660cef6fe: 11 changes to the new code, one at a time, each rebuilt and run against these tests. 10 make a test fail. The one that doesn't is skipping the generation check in baselineMiss. A unit whose content changes through this emulator either has its hash forgotten (write-back, clear, alias borrow) or no longer matches it, so that check only refuses earlier.
    • At @oneandonlydean's request (comment), agc_storage_pending_after_unwatch no longer requires any case to be refused, so an implementation that stores these units safely still passes. It checks the cause named in a refusal, that a refused write-back leaves the CPU's bytes as they were, and that a store merges the GPU's texels with the CPU's bytes. Four new cases write the CPU's bytes into the last unit after GPU results that cover part of it were written: into the hashed unit, before the unwatch, after an unwatch without the hook, and before an unwatch through a failed collect. Accepting any of them would store the image's older bytes over the CPU's, and the byte checks catch it. Ignoring the hash or the upload copy, hashing a unit the watch saw written, or taking a missing hash for a baseline now fails on the bytes. Hashing after a failed collect is caught by the cause instead: the next collect still sees the CPU's write, so the hook refuses the unit for that write. A write the failed collect loses for good, which the test can't produce, is the case where it would store the wrong bytes.
  • Validation layer: the write-watch, storage image, import, draw, recorder and VideoOut tests pass on main 83462cc57 (59) and on main + #7048 + this PR (60, agc_storage_pending_after_unwatch included), with no VUID- messages on either side. They ran with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1, and neither log has was not found but was requested by env var VK_INSTANCE_LAYERS. The set is ctest -V -R '^(agc_write_tracking.*|agc_storage_.*|agc_import_.*|agc_driver_store_over_untracked.*|agc_unit_shadow|agc_metadata_pass|agc_slice_dirty|agc_resident_present|agc_tiled_resolve|agc_queued_write_groups|agc_driver_graphics|agc_draw_.*|agc_recorder_.*|agc_driver_flip.*|video_out_flip_.*)$'.

  • After the merge with main e3d03fbae6, at ec6ceece9, with NVIDIA driver 610.88:

    • The validation set above passes on main e3d03fbae6 (59) and on this head (60), with APS5_DRAW_PIPELINE unset and set, with no VUID- messages on either side.
    • The Pathless (PPSA01825), one APS5_TRACE_SECONDS=120:10 control run per side: the menu's 10 s intervals give 327–330 presents on main and 324–329 on this head.
  • After the second merge, with main 9d164f0d87, at df1b2d5e9, with NVIDIA driver 610.88:

    • The validation set above passes on main 9d164f0d87 (59) and on this head (60), with APS5_DRAW_PIPELINE unset and set, with no VUID- messages on either side.
    • The Pathless (PPSA01825), two APS5_TRACE_SECONDS=120:10 control runs per side, in alternated order: the menu's 10 s intervals give 303–313 and 299–318 presents on main, and 293–307 and 302–320 on this head.
  • After f27fcde50, with NVIDIA driver 610.88 (d73e64951 above it only changes the debt entry):

    • The validation set above passes at f27fcde50 (60) with APS5_DRAW_PIPELINE unset and set, with no VUID- messages; main 9d164f0d87 passes its 59 the same way (above).
    • The Pathless (PPSA01825), two APS5_TRACE_SECONDS=120:10 control runs per side, alternated with main 9d164f0d87: the menu's 10 s intervals give 290–305 and 287–321 presents at f27fcde50 (one interval of 260 in the second run), and 289–313 and 281–304 on main. No refusal in any run.
  • After the third merge, with main cf528e78c6, at 2853a75c1, with NVIDIA driver 610.88:

    • The validation set above, plus #9159's new tests (agc_rewatched_.*, agc_compared_.*, agc_driver_compared_.* and agc_driver_partially_resident.*), passes on main (70) and on this head (71), with APS5_DRAW_PIPELINE unset and set, with no VUID- messages on either side.
    • The Pathless (PPSA01825), APS5_TRACE_SECONDS=120:10 control runs alternated with main cf528e78c6: the menu's 10 s intervals from 20 s on give 332–345 and 308–360 presents on this head, and 342–358 and 351–363 on main. main stopped on the refusal in 1 of its 3 runs, and this head in none of its 3, nor in the one below. One more run of this head ran at 171–179 from start to end, with Driver.Packet at 54 ms per frame against 29 in the others; the same build gave 332–345 in its next run, so I've left that run out.
    • Full ctest suite with the GPU (--parallel 4 --timeout 120): 2278 of 2289 pass and 7 are skipped. The other 4 (log_macros, log_macros_timestamps, agc_host_import_cut_lifetime and agc_driver_depth_plane_partial_store) fail the same way on main cf528e78c6.
  • After the fourth merge, with main 4017310678, at b61555e17, with NVIDIA driver 610.88:

    • The same validation set passes on main (72) and on this head (73), with APS5_DRAW_PIPELINE unset and set, with no VUID- messages on either side and the layer loaded.
    • The full suite and The Pathless were not rerun for this merge, whose only conflict was the debt entry; the results above are from 2853a75c1.
  • After the fix for the import walk hooks, at 43a9245e8, with NVIDIA driver 610.88:

    • The same validation set passes on main 4017310678 (72) and on this head (73), with APS5_DRAW_PIPELINE unset and set, with no VUID- messages on either side and the layer loaded. In one run, main with APS5_DRAW_PIPELINE=1 failed agc_write_tracking_metadata_commit (an untouched leaf has a write stamp); it passed 5 of 5 reruns on each side, and this branch doesn't change what it tests.
    • The full suite and The Pathless were not rerun for this fix; the results above are from 2853a75c1.
  • After the fifth merge, with main f55190f7e3, at cfbe00cb4, with NVIDIA driver 610.88:

    • The validation set passes on main (72) and on this head (73), and #9685's agc_driver_linear_target_* and agc_driver_address_passes_* tests pass on both (13), with APS5_DRAW_PIPELINE unset and set, with no VUID- messages on either side and the layer loaded. The new case passes seeded and unseeded.
    • Full ctest suite with the GPU (--parallel 4 --timeout 120): 2363 of 2375 pass on this head and 7 are skipped. The other 5 (guest_wide_formatting, log_macros, log_macros_timestamps, agc_host_import_cut_lifetime and agc_driver_depth_plane_partial_store) fail the same way on main f55190f7e3. public_headers timed out at 120 s on both sides, leaving its 64 compile tests not run; rerun on their own with --timeout 1800, all 65 pass on both, in 53 s. video_out_flip_overlay failed on main only, with an overlay's implicit Vulkan layer loaded, and passed when rerun with that layer disabled.
    • The Pathless (PPSA01825), one APS5_TRACE_SECONDS=120:10 control run per side at 3840x2160, because #9685 changes how render targets are stored: the menu's 10 s intervals from 30 s on give 359–374 presents on main and 375–401 on this head. No refusal in either run.
    • @ahmadmuj's approval is on 43a9245e8, before this merge; the import walk change it covers is unchanged.
  • After the sixth merge, with main 27ad7244d2, at 339783405, with NVIDIA driver 621.01:

    • The validation set without its VideoOut tests, plus #9685's agc_driver_linear_target_* and agc_driver_address_passes_* tests without the one that flips, passes on main (66) and on this head (67), with APS5_DRAW_PIPELINE unset and set, with no VUID- messages on either side and the layer loaded. That includes #7505's CheckUnwatchHooks in agc_write_tracking.
    • The full suite and The Pathless were not rerun for this merge.
  • After the seventh merge, at bfe0e86a3, with NVIDIA driver 621.01, against main ad622fc18d:

    • The same set as after the sixth merge, plus #10973's agc_copy_guest_bytes, passes on main (72) and on this head (73), with APS5_DRAW_PIPELINE unset and set, with no VUID- messages on either side and the layer loaded.
    • The full suite and The Pathless were not rerun for this merge.
  • Full ctest suite at f27fcde50 (--parallel 4 --timeout 120): 2026 of 2036 pass and 5 are skipped. The other 5 (log_macros, log_macros_timestamps, agc_driver_sample_order, agc_driver_sample_order_grid_reference and agc_driver_sample_order_recipe_depth_locations) fail the same way on main 9d164f0d87.
    The fork's CI wasn't run: its runner has no Vulkan device and skips the GPU tests.

  • tools/check_conventions.py passes against main.

  • tools/pr_overlap.py: #7505 and #9159 touch ImportWatched; #7505 is described above, and #9159 only neighbours its lines. The other entries (#6108, #6848, #6946, #7642, #9275, #9508, #9565, #9898) come from #7048's own changes, which this branch carries. #10886 builds on this PR (Depends on: #10026) and keeps its markLayersPending scan inside its AllIn guard.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #7048
  • Fixes: none
  • Unblocks: none on its own; with #7048, PPSA01825 (The Pathless) no longer stops on #7017's refusal (3 of 8 runs on main, 0 of 13 with both) and its menu runs at 307–316 presents per 10 s instead of #7048's 85–105 (main: 319–326)
  • GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 591.86, Windows 11 (10.0.26300); not run on AMD or Intel
  • AI-assisted: yes

pathless-traces-isolation-7048-no-upload-hash.zip
pathless-traces-main-7048-e2c1fe440.zip
pathless-traces-main-83462cc57.zip
pathless-traces-pr-4989cab12.zip

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4978082556 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10026). Originally posted by [winstrex](https://github.com/winstrex) on 2026-10-23T05:03:40Z. --- This PR's own commits, without #7048's below them: [ec6ceece9](https://github.com/winstrex/AnyPS5/commit/ec6ceece96e64e3e1d0f97fe6bf4c2ef6087028d), [f27fcde50](https://github.com/winstrex/AnyPS5/commit/f27fcde50543d62910303f8a2134c36c47e2bd2a) and [d73e64951](https://github.com/winstrex/AnyPS5/commit/d73e64951e38708319b4395d63c5e670b76f2f95). ### What #7048 stores results that land in a unit over memory that has left the write watch, as long as the unit's bytes still match what was uploaded. For surfaces over 1 MiB it checks this against a per-unit hash, which `upload()` takes on every settled upload. That pass reads and hashes the whole surface each time. On The Pathless (PPSA01825) menu it costs about 70 % of the presents, with 89 % of the draw committer's samples in `StorageTexture::upload`. The hash is only read in `markLayersPending`, for a unit with a write generation, no saved bytes and a range that is no longer watched. This PR takes that hash once, when it can be trusted and is about to be needed: when the unit's range leaves the watch. This is the shape @oneandonlydean described in #7048. The first commits here are #7048's own, followed by a merge with `main` that resolves #7048's conflict with it (described below). This PR's change is the next commit, ec6ceece9. A second merge with `main` on top of it adapts that change to `main`'s tracker lock, f27fcde50 makes the refusal name its cause, d73e64951 corrects the debt entry, and a third merge with `main` ([2853a75c1](https://github.com/winstrex/AnyPS5/commit/2853a75c143ee7c385fe0a9db402d41c6a7a1c73)) resolves a conflict with #9159 (all below). - The unwatch hook (`StorageTexture::SaveBeforeUnwatch`) also visits the live textures over 1 MiB that overlap the range. For each unit there with a write generation, no pending results and no saved bytes, it collects the range's writes. If the watch shows no write since that generation, it records a 128-bit hash of the unit's bytes together with that generation. `upload()` and `refresh` no longer hash anything. - `markLayersPending` captures such a unit only while its bytes still match the hash and the hash's generation is still the unit's. With no hash, or a mismatch, it refuses, as it does now. Surfaces of 1 MiB or less keep comparing with the copy taken at the upload, so the hook doesn't visit them. - The hook doesn't flush pending GPU writes before hashing. A GPU write that lands later changes the bytes, so the hash no longer matches and the capture is refused. - `ImportWatched` now runs the hook over the two spans of an import that stays watched which left the watch without it: a span whose page walk fails before the import (the hook runs before the import) and one whose walk fails after it. These are the spans #7505 covers. Whichever of the two lands second drops its `GuestMemory.cpp` hunk. - After @ahmadmuj's review ([43a9245e8](https://github.com/winstrex/AnyPS5/commit/43a9245e89)): the hooks of the spans whose walk fails after the import run after every span's window walk, under one suspension of the tracker lock. Running each hook inside the loop let another thread collect a later span without its window, and stamp the pages the import touched as CPU writes. A guard resumes the lock even if a hook throws. - Where the CPU's writes to a range can't be proven as it leaves the watch, the hook still saves pending results but records no hash: those two spans, and a failed fresh collect in `MarkWritten` (`UnwatchWritesProven`). A unit there has no baseline, and its capture is refused, as before. - Ranges that leave the watch without going through the hook are unchanged: `GuestWriteWatchUnregister` called from libkernel on Linux when a mapping is aliased, unmapped or replaced. On Windows there are none: the host regions are fixed when the guest arena is reserved, the commit generation only decides when a later commit restores the watch, and every path that takes a range out of the watch runs the hook (d73e64951 drops the Windows case I had listed). Taking the Linux case through the hook touches libkernel and is left for a separate PR. The new debt entry "Units without a baseline outside the write watch" lists them. A unit there has no hash, so results that land in it outside the watch throw when they are stored, as on `main`. - `SetImportWalkFailureForTest` lets the tests fail either walk on both platforms. **The refusal names its cause** (f27fcde50, after @zaidhawk's Persona 3 Reload run below). What is captured and what is refused don't change. The refusal now ends with the first unit refused and why it has no baseline, for example `(unit 63 of 64: its range left the watch through the unwatch hook without its CPU writes proven (a failed collect or import page walk))`. The causes: - its results became pending while its range was watched, and its bytes weren't saved when the range left the watch; - a save of its bytes was in flight when its results became pending and didn't complete, or its saved bytes were dropped while its results were pending; - on surfaces of 1 MiB or less: no copy was taken at the upload, or the bytes differ from it; - on larger surfaces: no hash for the unit's current generation (its range left the watch without the hook, or its generation changed after the hash), the hook ran without the CPU writes proven, the watch saw CPU writes after the unit's generation, the unit had pending results or saved bytes when the hook ran, or the bytes no longer match the hash. The hook records why it didn't hash a unit next to the hash, with the generation it applies to. To record the unproven case it now also visits the live textures over 1 MiB when the CPU writes aren't proven. That path takes `GpuMutex` when one of them overlaps, and it only runs after a failed collect or a failed import page walk. **A wait I found and fixed while measuring.** In the first version, the hook took `GuestMemory::GpuMutex` whenever the range overlapped any live texture. On `main` it only takes it when a texture with pending results overlaps. During The Pathless's menu that happened hundreds of times, and the thread doing the unwatch waited for the draw committer to release the mutex: 296–316 presents per 10 s against `main`'s 315–336. The hook's own code didn't show in the samples, because the cost was the wait. The hook now visits only textures over 1 MiB, the same limit as #7048's hash. Those are the only ones a hash is ever taken for, so in The Pathless it takes the mutex no more often than `main` does. **What the hook costs.** A local counter that is not part of this PR, over the menu of each title: - The Pathless: about 1,800 unwatch events per second while it boots and 44–112 per second in the menu. LEGO Horizon Adventures (PPSA14632): 19 in 4 minutes. Hades (PPSA03355): none. - All of them went through the hook. The two `ImportWatched` exits were never reached. - None found an idle unit to hash, so the hook read 0 bytes in all three titles. On these titles the hash path itself is exercised only by the tests below. @zaidhawk (Persona 3 Reload, PPSA10872), @dantdmdarealguy (Stray, PPSA02100) and @oneandonlydean (ASTRO BOT), could you run this head on the scene where you measured #7048's slowdown? Those are the titles where a unit is expected to lose the watch while idle. I don't have Persona 3 Reload, so it wasn't tested here. **Merge with `main`.** Since c0dbd1871c (`perf(agc): draw finisher pipeline`), #7048 conflicts with `main` in `StorageTexture::markLayersPending`: `main` reworked the loop that #7048 changes. Until #7048 is rebased, this branch carries a merge of #7048's head da9f0ead4 with `main` e3d03fbae6 (93c878b36): - #7048's part, in the merge commit: the loop keeps `main`'s structure (`unsaved` starts empty, the `CommitTrims()` prefilter, then `assign` and the full loop), with #7048's condition in the full loop. The prefilter checks `noBaseline && (layerGeneration == 0 || savedTicket == 0)`, which every unit #7048's condition selects passes, so `APS5_DRAW_PIPELINE` doesn't change which units are captured, and the byte comparison still runs only in the full loop. The merge also keeps `GenerationBaselineBytes` where #7048 moved it; `main` declared it a second time next to its new `SingleKeyColorFor`. - This PR's part: the commit has the same changes as d6138938c. Its only conflict was its rename of `guestMatchesUpload` to `guestMatchesBaseline`, on the line of the full loop that #7048 changes. - Second merge, with `main` 9d164f0d87 (df1b2d5e9): #6169 (`answer a collect memo hit with the generation of the last finished tracker update`) made `lockTracker()` return `TrackerLock`, which has no `unlock()`/`lock()`. This conflict is entirely in this PR's part. `markWritten` and the `leave` lambda in `ImportWatched` now release the tracker around `beforeUnwatchUnproven` with `Suspend()` and `Resume()`. Git merged the `ImportWatched` lambda without a conflict, but it no longer compiled. `TrackerLock::Unlock()` is not used here, because it publishes the generation, and both paths stamp blocks again after relocking; #6169 releases `markWritten` the same way. @eliasbruno124-dev reached the same adaptation and tested it on an RTX 3060 Laptop GPU ([comment](https://github.com/boykopovar/AnyPS5/pull/10026#issuecomment-6368139163)). - Third merge, with `main` cf528e78c6 (2853a75c1): #9159 (`keep a rewatched import's memory compared once it is shared`) marks each span of `ImportWatched` whose page walk succeeds as compared once it is shared, on Windows, in the loop where this PR takes a span whose walk failed out of the watch through the hook. Both are kept: a span whose walk fails goes through `leave` and is skipped, and a span whose walk succeeds is marked with `GuestArenaCompareResidentWhenShared`, as on `main`. #9159 doesn't add a way out of the watch without the hook. Marking a page compared stops arming its shared aliases but leaves the range covered, and a walk that is refused because of compared pages now stamps them and records them as refused, which `UnchangedSince` reports as changed. For this PR that can only turn a hash into the "watch saw CPU writes" skip, never bypass the hook. I counted the hook's decisions with local counters that aren't part of the PR. In the write-watch, storage image and import tests, #9159's included, only `agc_storage_pending_after_unwatch` reaches a hook decision, and none of its decisions came from a refused walk; its one CPU-writes skip is the case it makes on purpose. In a run of The Pathless's menu the hook decided for no unit at all. - Fourth merge, with `main` 4017310678 ([b61555e17](https://github.com/winstrex/AnyPS5/commit/b61555e175)): the only conflict was in `docs/dev/debt/libSceAgcDriver.md`, where #9275 added an entry under the one this PR rewrites. Both are kept: this PR's two entries, then #9275's unchanged. - Fifth merge, with `main` f55190f7e3 ([90be5898c](https://github.com/winstrex/AnyPS5/commit/90be5898ca)), for the conflict with #9685 (`store resident linear color targets at completion points, limited to their drawn rectangles`) in `Texture.cpp`. #9685 gives a pending unit a generation per 64 KiB block (`unitBlockGeneration`), raised where a completion store wrote, and no longer refuses a unit without a baseline in a target with drawn rectangles. Both are kept: - `markLayersPending`: this PR's capture with its baseline causes stays where it is, and #9685's loop that clears the blocks' completion generations replaces the one that marks the units pending. - `saveBeforeUnwatch`: this PR moved the written-block check into `keepWrittenSince`, which `captureGuestBytes` also calls. #9685's per-block generations are now in `keepWrittenSince`. Its other caller runs before the units are marked pending, where `unitBlockGeneration` returns the unit's generation, as before. - The refusal: #9685's condition (`unknown && !drawn.rect`), with this PR's cause inside it. The units #9685 no longer refuses need no cause. - [cfbe00cb4](https://github.com/winstrex/AnyPS5/commit/cfbe00cb4e) adds a case to #9685's `agc_driver_linear_target_cpu_writes`: the target's memory leaves the watch after the draw that records its rectangle, so the hook runs over the pending rectangle before the completion store, and the store must still keep the drawn half and the CPU's later stores to the other half. - Sixth merge, with `main` 27ad7244d2 ([339783405](https://github.com/winstrex/AnyPS5/commit/339783405e)), for the conflict with #7505 (`run the unwatch hook before an import whose range leaves the write watch whatever the import does`), which runs the hook for every range that leaves the watch, as this PR does: - `ImportWatched`: this PR's version is kept. #7505 runs the hook of a span whose window walk fails inside the loop over the window walks, with the tracker lock suspended, so another thread can collect a later span before its window walk. That is the race @ahmadmuj found in this PR's b61555e17, now on `main`. Here every window walk finishes before the failed spans' hooks run under one suspension, and `CheckImportWalkHookKeepsLaterWindows` reproduces the race. The rest of `main`'s changes to the file, such as #10369's `importMayWriteGuest`, merged without a conflict. - `tests/WriteTracking.cpp`: both sides are kept. `main()` runs this PR's `CheckImportWalkUnwatchHooks` and `CheckImportWalkHookKeepsLaterWindows` and #7505's `CheckUnwatchHooks`, which passes on this head. - `docs/dev/debt/libSceAgcDriver.md`: this PR's first entry, with #7505's "or whose page walk fails" in its parenthesis, and its second entry unchanged. #7505's last two sentences are dropped: the second entry covers the units without saved bytes that they describe. - Seventh merge, with `main` cda9c9bedf ([bfe0e86a3](https://github.com/winstrex/AnyPS5/commit/bfe0e86a39)), for the conflict with #10655 (`hash the pages of an import window on several threads`) in `ImportWatched`. `main`'s hashing is kept (`CheckRange` over the spans, then `HashPages`), still under the tracker lock and before the first page walks, and so are this PR's `failsWalk` and `leave`. #7505's `saveBytes` stays out, as in the sixth merge. #10655's tests are in `agc_write_tracking`. - When #7048 is rebased, this commit goes on its new head, with that adaptation. ### Tested Windows 11 (10.0.26300), NVIDIA GeForce RTX 5070 Ti, driver 591.86, WinLibs GCC 15.2.0 r7, Release, with Overwolf's implicit Vulkan layers disabled. All three builds are on `main` 83462cc57: `main` itself, `main` merged with #7048's head da9f0ead4 (e2c1fe440), and `main` merged with this PR's head (4989cab12). The merges are local and clean. - **The Pathless (PPSA01825), main menu:** `main` 319–326 presents per 10 s, `main` + #7048 85–105, `main` + #7048 + this PR 307–316. Two `APS5_TRACE_SECONDS=120:10` captures per build, alternated, no `APS5_PROFILE_*`. <details><summary>Measurements</summary> | | `main` | `main` | + #7048 | + #7048 | + #7048 + this PR | + #7048 + this PR | |---|---|---|---|---|---|---| | presents in the 10 s window | 319 | 330 | 104 | 85 | 304 | 316 | | mean of the menu's 10 s intervals | 319 | 326 | 104 | 88 | 307 | 316 | | frame p50 / p99 in the window (ms) | 27.7 / 64.6 | 27.6 / 59.7 | 110.2 / 127.9 | 130.3 / 175.1 | 28.2 / 71.7 | 27.8 / 65.3 | | GPU busy per present (ms) | 17.60 | 17.48 | 18.59 | 20.65 | 18.20 | 17.64 | | committer `Graphics.Draw` per frame (ms) | 15.1 | 14.6 | 77.4 | 96.2 | 16.3 | 15.5 | **Isolation:** #7048 with its upload hash turned off locally and without this PR's hook (`hashUnits = false`, a dirty local tree, alternated with two more `main` runs) gives 314 and 316 presents on average (windows 316 and 328), against 321 and 322 for `main` (windows 319 and 319). So the 2–4 % left between `main` and the two PRs together comes from the rest of #7048, not from the hook. `APS5_PLAYGO_UNLISTED_CHUNKS=absent`, warm caches, `APS5_TRACE_EVENTS=1048576` so no thread dropped events, and `APS5_TRACE_SUMMARY_EVERY=10`. The traces are in `pathless-traces-main-83462cc57.zip`, `pathless-traces-main-7048-e2c1fe440.zip`, `pathless-traces-pr-4989cab12.zip` and `pathless-traces-isolation-7048-no-upload-hash.zip`. `aps5-summary.jsonl`, `main`, `main` + #7048, then `main` + #7048 + this PR: ``` {"commit":"83462cc57dde","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":4146,"ms":10018.488},"presents":319,"frame_ms":{"p50":27.729,"p90":59.545,"p99":64.626,"max":73.425},"gpu_busy_ms_per_present":17.596,"worker_busy_pct":{"queue worker 0x0":92.006,"queue worker 0x20":10.334},"top_phases_ms_per_frame":{"Driver.Packet":31.437,"Graphics.Draw":15.107,"Driver.Packet.device_lock":14.321,"Graphics.Draw.draw_and_resource_release":13.759,"Driver.Packet.draw":6.495,"Driver.Draw":6.421,"Resources.Complete":4.895,"Driver.Draw.shader_compile_and_link":4.765},"trace_dropped":false,"trace":"aps5-trace-83462cc57dde-29980.json.gz"} {"commit":"83462cc57dde","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":4187,"ms":10020.868},"presents":330,"frame_ms":{"p50":27.649,"p90":54.126,"p99":59.696,"max":60.637},"gpu_busy_ms_per_present":17.480,"worker_busy_pct":{"queue worker 0x0":91.835,"queue worker 0x20":10.195},"top_phases_ms_per_frame":{"Driver.Packet":30.406,"Graphics.Draw":14.573,"Driver.Packet.device_lock":13.607,"Graphics.Draw.draw_and_resource_release":13.237,"Driver.Packet.draw":6.545,"Driver.Draw":6.470,"Driver.Draw.shader_compile_and_link":4.702,"Resources.Complete":4.549},"trace_dropped":false,"trace":"aps5-trace-83462cc57dde-33460.json.gz"} {"commit":"e2c1fe440ccd","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":1997,"ms":10040.790},"presents":104,"frame_ms":{"p50":110.226,"p90":120.240,"p99":127.892,"max":135.139},"gpu_busy_ms_per_present":18.587,"worker_busy_pct":{"queue worker 0x0":96.081,"queue worker 0x20":43.082},"top_phases_ms_per_frame":{"Driver.Packet":130.972,"Graphics.Draw":77.392,"Graphics.Draw.draw_and_resource_release":76.029,"Driver.Packet.draw":48.377,"Driver.Draw":48.303,"Driver.Draw.draw_enqueued":42.480,"Driver.Packet.dispatch":40.343,"Driver.Dispatch":40.177},"trace_dropped":false,"trace":"aps5-trace-e2c1fe440ccd-10948.json.gz"} {"commit":"e2c1fe440ccd","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":1841,"ms":10038.742},"presents":85,"frame_ms":{"p50":130.344,"p90":140.557,"p99":175.127,"max":175.127},"gpu_busy_ms_per_present":20.646,"worker_busy_pct":{"queue worker 0x0":95.237,"queue worker 0x20":42.248},"top_phases_ms_per_frame":{"Driver.Packet":155.389,"Graphics.Draw":96.209,"Graphics.Draw.draw_and_resource_release":94.571,"Driver.Packet.draw":55.405,"Driver.Draw":55.314,"Driver.Draw.draw_enqueued":48.652,"Driver.Packet.device_lock":47.731,"Driver.Packet.dispatch":45.805},"trace_dropped":false,"trace":"aps5-trace-e2c1fe440ccd-14240.json.gz"} {"commit":"4989cab1235e","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":3973,"ms":10026.852},"presents":304,"frame_ms":{"p50":28.193,"p90":64.734,"p99":71.709,"max":71.988},"gpu_busy_ms_per_present":18.203,"worker_busy_pct":{"queue worker 0x0":91.923,"queue worker 0x20":10.543},"top_phases_ms_per_frame":{"Driver.Packet":32.941,"Graphics.Draw":16.282,"Driver.Packet.device_lock":15.617,"Graphics.Draw.draw_and_resource_release":14.918,"Driver.Packet.draw":6.533,"Driver.Draw":6.461,"Resources.Complete":5.824,"VideoOut.Flip":5.168},"trace_dropped":false,"trace":"aps5-trace-4989cab1235e-38540.json.gz"} {"commit":"4989cab1235e","dirty":false,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_PLAYGO_UNLISTED_CHUNKS":"absent","APS5_TRACE_DIR":"<path>","APS5_TRACE_EVENTS":"1048576","APS5_TRACE_SECONDS":"120:10","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"NVIDIA GeForce RTX 5070 Ti","driver":"NVIDIA 591.86","os":"Windows 10.0.26300","cpu":"Genuine Intel(R) 0000","cpu_threads":24,"memory_mib":32509,"title_id":"PPSA01825","title":"The Pathless","content_version":"02.000.000","resolution":"2560x1440","window":{"spec":"seconds 120:10","first_present":4098,"ms":10021.926},"presents":316,"frame_ms":{"p50":27.804,"p90":60.844,"p99":65.277,"max":67.448},"gpu_busy_ms_per_present":17.637,"worker_busy_pct":{"queue worker 0x20":12.187,"queue worker 0x0":91.937},"top_phases_ms_per_frame":{"Driver.Packet":32.360,"Graphics.Draw":15.507,"Driver.Packet.device_lock":14.930,"Graphics.Draw.draw_and_resource_release":14.196,"Driver.Packet.draw":6.531,"Driver.Draw":6.459,"Driver.Packet.dispatch":5.332,"Resources.Complete":5.249},"trace_dropped":false,"trace":"aps5-trace-4989cab1235e-42320.json.gz"} ``` `tools/trace_digest.py`, `main`: ``` **16 intervals**, 0.0 to 160.7 s, 5420 presents NVIDIA GeForce RTX 5070 Ti, NVIDIA 591.86, Windows 10.0.26300, 3840x2160, commit 83462cc57dde commit, environment, GPU, driver or OS changed at interval 2 | # | seconds | presents | p50 | p90 | p99 | max | GPU busy | busiest worker | largest phase | |---|---|---|---|---|---|---|---|---|---| | 1 | 0-10 | 547 | 16.7 | 17.0 | 38.8 | 518.4 | 0.7 | 15 % | VideoOut.Flip 11.4 | | 2 | 10-20 | 454 | 16.7 | 16.9 | 193.1 | 1448.0 | 1.2 | 92 % | Driver.Packet 21.4 | | 3 | 20-30 | 259 | 27.9 | 55.9 | 228.4 | 454.0 | 18.1 | 93 % | Driver.Packet 40.8 | | 4 | 30-40 | 329 | 27.5 | 53.1 | 59.5 | 60.6 | 17.6 | 92 % | Driver.Packet 30.6 | | 5 | 40-50 | 331 | 27.6 | 53.1 | 56.6 | 58.5 | 17.7 | 93 % | Driver.Packet 30.6 | | 6 | 50-60 | 329 | 27.6 | 53.6 | 58.3 | 60.7 | 17.7 | 92 % | Driver.Packet 30.5 | | 7 | 60-70 | 326 | 27.8 | 53.5 | 60.8 | 61.3 | 17.7 | 92 % | Driver.Packet 31.1 | | 8 | 70-80 | 317 | 27.8 | 60.4 | 64.5 | 68.3 | 17.7 | 93 % | Driver.Packet 31.7 | | 9 | 80-90 | 315 | 27.9 | 60.5 | 67.2 | 73.4 | 17.6 | 92 % | Driver.Packet 31.9 | | 10 | 90-100 | 317 | 27.9 | 60.5 | 67.8 | 72.4 | 17.6 | 92 % | Driver.Packet 31.6 | | 11 | 100-110 | 315 | 27.7 | 62.2 | 66.8 | 70.0 | 17.6 | 92 % | Driver.Packet 32.2 | | 12 | 110-120 | 318 | 27.9 | 59.5 | 67.2 | 69.2 | 17.6 | 92 % | Driver.Packet 31.6 | | 13 | 120-131 | 309 | 27.7 | 59.6 | 67.2 | 653.6 | 17.6 | 92 % | Driver.Packet 33.4 | | 14 | 131-141 | 317 | 27.8 | 60.0 | 65.0 | 66.2 | 17.7 | 92 % | Driver.Packet 32.3 | | 15 | 141-151 | 318 | 27.8 | 59.8 | 66.6 | 71.4 | 17.6 | 92 % | Driver.Packet 31.1 | | 16 | 151-161 | 319 | 27.7 | 60.3 | 65.6 | 72.0 | 17.6 | 92 % | Driver.Packet 31.7 | ``` p99 ms :%@::::--------- 0-228.4 gpu ms ._@@@@@@@@@@@@@@ 0-18.1 ``` ``` `tools/trace_digest.py`, `main` + #7048: ``` **14 intervals**, 0.0 to 141.0 s, 2215 presents NVIDIA GeForce RTX 5070 Ti, NVIDIA 591.86, Windows 10.0.26300, 3840x2160, commit e2c1fe440ccd commit, environment, GPU, driver or OS changed at interval 2 | # | seconds | presents | p50 | p90 | p99 | max | GPU busy | busiest worker | largest phase | |---|---|---|---|---|---|---|---|---|---| | 1 | 0-10 | 541 | 16.7 | 18.8 | 36.1 | 500.6 | 0.7 | 30 % | VideoOut.Flip 8.7 | | 2 | 10-20 | 453 | 16.7 | 17.0 | 17.4 | 1341.9 | 1.1 | 94 % | Driver.Packet 22.7 | | 3 | 20-30 | 82 | 113.2 | 185.0 | 488.5 | 488.5 | 20.4 | 96 % | Driver.Packet 167.4 | | 4 | 30-40 | 103 | 110.5 | 121.0 | 126.0 | 126.4 | 18.4 | 96 % | Driver.Packet 138.4 | | 5 | 40-51 | 102 | 115.4 | 122.1 | 131.0 | 131.5 | 18.8 | 97 % | Driver.Packet 138.1 | | 6 | 51-61 | 102 | 115.9 | 122.0 | 127.3 | 128.5 | 18.7 | 96 % | Driver.Packet 138.3 | | 7 | 61-71 | 103 | 113.7 | 121.1 | 123.3 | 126.8 | 18.4 | 96 % | Driver.Packet 136.9 | | 8 | 71-81 | 102 | 116.7 | 121.8 | 128.7 | 139.8 | 18.7 | 96 % | Driver.Packet 135.9 | | 9 | 81-91 | 105 | 110.2 | 120.5 | 123.3 | 125.1 | 18.4 | 95 % | Driver.Packet 134.2 | | 10 | 91-101 | 105 | 109.5 | 119.6 | 123.0 | 125.2 | 18.8 | 96 % | Driver.Packet 133.2 | | 11 | 101-111 | 105 | 80.3 | 119.8 | 122.5 | 122.9 | 18.2 | 96 % | Driver.Packet 129.8 | | 12 | 111-121 | 103 | 110.6 | 120.3 | 128.5 | 130.3 | 18.5 | 95 % | Driver.Packet 133.0 | | 13 | 121-131 | 104 | 109.8 | 120.5 | 135.1 | 215.6 | 18.6 | 96 % | Driver.Packet 131.0 | | 14 | 131-141 | 105 | 110.4 | 119.4 | 123.8 | 125.0 | 18.7 | 95 % | Driver.Packet 128.4 | ``` p99 ms _.@::::::::::: 0-488.5 gpu ms ..@%%%%%%%%%%% 0-20.4 ``` ``` `tools/trace_digest.py`, `main` + #7048 + this PR: ``` **15 intervals**, 0.0 to 150.7 s, 4900 presents NVIDIA GeForce RTX 5070 Ti, NVIDIA 591.86, Windows 10.0.26300, 3840x2160, commit 4989cab1235e commit, environment, GPU, driver or OS changed at interval 2 | # | seconds | presents | p50 | p90 | p99 | max | GPU busy | busiest worker | largest phase | |---|---|---|---|---|---|---|---|---|---| | 1 | 0-10 | 538 | 16.7 | 17.0 | 45.0 | 567.6 | 0.7 | 16 % | VideoOut.Flip 13.1 | | 2 | 10-20 | 446 | 16.7 | 16.9 | 191.5 | 1366.8 | 1.0 | 88 % | Driver.Packet 21.6 | | 3 | 20-30 | 232 | 28.1 | 67.9 | 173.7 | 1038.1 | 19.2 | 92 % | Driver.Packet 47.2 | | 4 | 30-40 | 308 | 27.8 | 63.9 | 71.2 | 73.7 | 18.1 | 92 % | Driver.Packet 33.2 | | 5 | 40-50 | 304 | 28.0 | 65.6 | 71.4 | 73.0 | 18.2 | 92 % | Driver.Packet 33.3 | | 6 | 50-60 | 310 | 28.0 | 61.7 | 67.4 | 70.2 | 18.1 | 92 % | Driver.Packet 32.0 | | 7 | 60-70 | 307 | 28.0 | 63.4 | 70.4 | 73.3 | 18.1 | 92 % | Driver.Packet 32.9 | | 8 | 70-80 | 307 | 27.9 | 64.4 | 70.6 | 71.9 | 18.2 | 92 % | Driver.Packet 32.6 | | 9 | 80-90 | 310 | 27.9 | 62.3 | 68.3 | 68.9 | 18.2 | 92 % | Driver.Packet 32.8 | | 10 | 90-101 | 308 | 27.9 | 62.5 | 71.5 | 73.8 | 18.1 | 92 % | Driver.Packet 32.9 | | 11 | 101-111 | 307 | 27.9 | 62.8 | 69.1 | 79.4 | 18.1 | 92 % | Driver.Packet 32.9 | | 12 | 111-121 | 312 | 27.7 | 62.1 | 67.7 | 71.6 | 18.2 | 92 % | Driver.Packet 32.9 | | 13 | 121-131 | 289 | 28.2 | 64.8 | 71.9 | 634.7 | 18.2 | 93 % | Driver.Packet 35.2 | | 14 | 131-141 | 311 | 28.0 | 61.4 | 66.8 | 68.9 | 18.1 | 92 % | Driver.Packet 32.6 | | 15 | 141-151 | 311 | 28.0 | 61.3 | 69.2 | 71.4 | 18.1 | 92 % | Driver.Packet 32.8 | ``` p99 ms :@%------------ 0-191.5 gpu ms ..@%@%@@@@@@@@@ 0-19.2 ``` ``` </details> - **#7017's refusal on The Pathless:** 60 s runs, alternated. `main` stopped on `storing storage image results pending over memory outside the write watch without the guest bytes saved before them is not implemented` in 3 of 8 runs, 8 to 10 s in. `main` + #7048 + this PR stopped in none: 0 of 7 runs with the hook's first version (before the 1 MiB limit) and 0 of 6 with this head. - **LEGO Horizon Adventures (PPSA14632) and Hades (PPSA03355):** one run per side, `main` against `main` + #7048 + this PR. LEGO's loading screen gives 57–65 presents per 10 s against 63–65, and its menu 29–33 against 30–32. Hades gameplay gives 295–330 against 296–336. No refusal in any run. These two ran with the hook's first version; the 1 MiB limit only narrows the textures it visits. - **Persona 3 Reload (PPSA10872):** I don't have it. @zaidhawk ran df1b2d5e9 on an RTX 5090 ([comment](https://github.com/boykopovar/AnyPS5/pull/10026#issuecomment-6374132317)): the start-up screens and the opening animation are back at `main`'s rate (596–600 presents per 10 s, against 117–122 with #7048 alone), but 1 of 5 runs stopped on the refusal, which #7048 alone didn't in 5. Its log doesn't say which case it was; f27fcde50 adds that to the message. They ran d73e64951 again with 120 s runs ([comment](https://github.com/boykopovar/AnyPS5/pull/10026#issuecomment-6389544496)): 0 of 10 runs stopped on the refusal, against 2 of 5 on `main` 9d164f0d8 and 0 of 5 with `main` + #7048, so there is no cause line yet. Over both sessions this PR stopped in 1 of 15 runs, #7048 alone in 0 of 10 and `main` in 4 of 10. The start-up screens stayed at 594–596 presents per 10 s with this PR, against 120–122 with #7048. - **Tests:** - `agc_storage_pending_after_unwatch` checks the cause named in every refusal, with three new cases: the last block leaves the watch without the hook (refused at 1024×1024 for having no hash; stored at 256×256, which compares with the upload copy), the same while the results are pending (refused in both sizes), and a failed collect, on Windows (refused at 1024×1024 as unproven; stored at 256×256). Recording the wrong cause in the hook makes it fail. - `agc_storage_pending_after_unwatch` passes in both sizes (256×256 through the upload copy, 1024×1024 through the hash). New case: a CPU write into the last block while it is still watched, before it leaves the watch. The unit then has no baseline, and the capture is refused in both sizes with the CPU's bytes kept. The existing case with a CPU write after the unwatch, which is after the baseline, is still refused at 1024×1024. - `agc_write_tracking`: `CheckImportWalkUnwatchHooks` reaches both `ImportWatched` exits through `SetImportWalkFailureForTest`. It checks that each runs the hook once while its block is still watched, before the import for the first exit and after it for the second, and with the CPU writes reported as not proven. It also checks that `Unwatch` reports them as proven. `CheckFailedCollectUnwatch` now also checks that a failed collect reports them as not proven. `CheckImportWalkHookKeepsLaterWindows` fails the walk of only the first of two spans after the import, and its unwatch hook collects the second span while the lock is suspended, as another thread could. It checks that a page the import touched there without changing it still reads as unchanged, with its window walk's possible CPU touch. It fails on b61555e17 and passes from 43a9245e8. - Mutation check, redone at [660cef6fe](https://github.com/winstrex/AnyPS5/commit/660cef6fe9ada0979f22ed2dd9c76419ae36306b): 11 changes to the new code, one at a time, each rebuilt and run against these tests. 10 make a test fail. The one that doesn't is skipping the generation check in `baselineMiss`. A unit whose content changes through this emulator either has its hash forgotten (write-back, clear, alias borrow) or no longer matches it, so that check only refuses earlier. - At @oneandonlydean's request ([comment](https://github.com/boykopovar/AnyPS5/pull/10026#issuecomment-6454792317)), `agc_storage_pending_after_unwatch` no longer requires any case to be refused, so an implementation that stores these units safely still passes. It checks the cause named in a refusal, that a refused write-back leaves the CPU's bytes as they were, and that a store merges the GPU's texels with the CPU's bytes. Four new cases write the CPU's bytes into the last unit after GPU results that cover part of it were written: into the hashed unit, before the unwatch, after an unwatch without the hook, and before an unwatch through a failed collect. Accepting any of them would store the image's older bytes over the CPU's, and the byte checks catch it. Ignoring the hash or the upload copy, hashing a unit the watch saw written, or taking a missing hash for a baseline now fails on the bytes. Hashing after a failed collect is caught by the cause instead: the next collect still sees the CPU's write, so the hook refuses the unit for that write. A write the failed collect loses for good, which the test can't produce, is the case where it would store the wrong bytes. - **Validation layer:** the write-watch, storage image, import, draw, recorder and VideoOut tests pass on `main` 83462cc57 (59) and on `main` + #7048 + this PR (60, `agc_storage_pending_after_unwatch` included), with no `VUID-` messages on either side. They ran with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1`, and neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. The set is `ctest -V -R '^(agc_write_tracking.*|agc_storage_.*|agc_import_.*|agc_driver_store_over_untracked.*|agc_unit_shadow|agc_metadata_pass|agc_slice_dirty|agc_resident_present|agc_tiled_resolve|agc_queued_write_groups|agc_driver_graphics|agc_draw_.*|agc_recorder_.*|agc_driver_flip.*|video_out_flip_.*)$'`. - **After the merge with `main` e3d03fbae6**, at ec6ceece9, with NVIDIA driver 610.88: - The validation set above passes on `main` e3d03fbae6 (59) and on this head (60), with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages on either side. - The Pathless (PPSA01825), one `APS5_TRACE_SECONDS=120:10` control run per side: the menu's 10 s intervals give 327–330 presents on `main` and 324–329 on this head. - **After the second merge, with `main` 9d164f0d87**, at df1b2d5e9, with NVIDIA driver 610.88: - The validation set above passes on `main` 9d164f0d87 (59) and on this head (60), with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages on either side. - The Pathless (PPSA01825), two `APS5_TRACE_SECONDS=120:10` control runs per side, in alternated order: the menu's 10 s intervals give 303–313 and 299–318 presents on `main`, and 293–307 and 302–320 on this head. - **After f27fcde50**, with NVIDIA driver 610.88 (d73e64951 above it only changes the debt entry): - The validation set above passes at f27fcde50 (60) with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages; `main` 9d164f0d87 passes its 59 the same way (above). - The Pathless (PPSA01825), two `APS5_TRACE_SECONDS=120:10` control runs per side, alternated with `main` 9d164f0d87: the menu's 10 s intervals give 290–305 and 287–321 presents at f27fcde50 (one interval of 260 in the second run), and 289–313 and 281–304 on `main`. No refusal in any run. - **After the third merge, with `main` cf528e78c6**, at 2853a75c1, with NVIDIA driver 610.88: - The validation set above, plus #9159's new tests (`agc_rewatched_.*`, `agc_compared_.*`, `agc_driver_compared_.*` and `agc_driver_partially_resident.*`), passes on `main` (70) and on this head (71), with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages on either side. - The Pathless (PPSA01825), `APS5_TRACE_SECONDS=120:10` control runs alternated with `main` cf528e78c6: the menu's 10 s intervals from 20 s on give 332–345 and 308–360 presents on this head, and 342–358 and 351–363 on `main`. `main` stopped on the refusal in 1 of its 3 runs, and this head in none of its 3, nor in the one below. One more run of this head ran at 171–179 from start to end, with `Driver.Packet` at 54 ms per frame against 29 in the others; the same build gave 332–345 in its next run, so I've left that run out. - Full `ctest` suite with the GPU (`--parallel 4 --timeout 120`): 2278 of 2289 pass and 7 are skipped. The other 4 (`log_macros`, `log_macros_timestamps`, `agc_host_import_cut_lifetime` and `agc_driver_depth_plane_partial_store`) fail the same way on `main` cf528e78c6. - **After the fourth merge, with `main` 4017310678**, at b61555e17, with NVIDIA driver 610.88: - The same validation set passes on `main` (72) and on this head (73), with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages on either side and the layer loaded. - The full suite and The Pathless were not rerun for this merge, whose only conflict was the debt entry; the results above are from 2853a75c1. - **After the fix for the import walk hooks**, at 43a9245e8, with NVIDIA driver 610.88: - The same validation set passes on `main` 4017310678 (72) and on this head (73), with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages on either side and the layer loaded. In one run, `main` with `APS5_DRAW_PIPELINE=1` failed `agc_write_tracking_metadata_commit` (`an untouched leaf has a write stamp`); it passed 5 of 5 reruns on each side, and this branch doesn't change what it tests. - The full suite and The Pathless were not rerun for this fix; the results above are from 2853a75c1. - **After the fifth merge, with `main` f55190f7e3**, at cfbe00cb4, with NVIDIA driver 610.88: - The validation set passes on `main` (72) and on this head (73), and #9685's `agc_driver_linear_target_*` and `agc_driver_address_passes_*` tests pass on both (13), with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages on either side and the layer loaded. The new case passes seeded and unseeded. - Full `ctest` suite with the GPU (`--parallel 4 --timeout 120`): 2363 of 2375 pass on this head and 7 are skipped. The other 5 (`guest_wide_formatting`, `log_macros`, `log_macros_timestamps`, `agc_host_import_cut_lifetime` and `agc_driver_depth_plane_partial_store`) fail the same way on `main` f55190f7e3. `public_headers` timed out at 120 s on both sides, leaving its 64 compile tests not run; rerun on their own with `--timeout 1800`, all 65 pass on both, in 53 s. `video_out_flip_overlay` failed on `main` only, with an overlay's implicit Vulkan layer loaded, and passed when rerun with that layer disabled. - The Pathless (PPSA01825), one `APS5_TRACE_SECONDS=120:10` control run per side at 3840x2160, because #9685 changes how render targets are stored: the menu's 10 s intervals from 30 s on give 359–374 presents on `main` and 375–401 on this head. No refusal in either run. - @ahmadmuj's approval is on 43a9245e8, before this merge; the import walk change it covers is unchanged. - **After the sixth merge, with `main` 27ad7244d2**, at 339783405, with NVIDIA driver 621.01: - The validation set without its VideoOut tests, plus #9685's `agc_driver_linear_target_*` and `agc_driver_address_passes_*` tests without the one that flips, passes on `main` (66) and on this head (67), with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages on either side and the layer loaded. That includes #7505's `CheckUnwatchHooks` in `agc_write_tracking`. - The full suite and The Pathless were not rerun for this merge. - **After the seventh merge**, at bfe0e86a3, with NVIDIA driver 621.01, against `main` ad622fc18d: - The same set as after the sixth merge, plus #10973's `agc_copy_guest_bytes`, passes on `main` (72) and on this head (73), with `APS5_DRAW_PIPELINE` unset and set, with no `VUID-` messages on either side and the layer loaded. - The full suite and The Pathless were not rerun for this merge. - **Full `ctest` suite** at f27fcde50 (`--parallel 4 --timeout 120`): 2026 of 2036 pass and 5 are skipped. The other 5 (`log_macros`, `log_macros_timestamps`, `agc_driver_sample_order`, `agc_driver_sample_order_grid_reference` and `agc_driver_sample_order_recipe_depth_locations`) fail the same way on `main` 9d164f0d87. The fork's CI wasn't run: its runner has no Vulkan device and skips the GPU tests. - `tools/check_conventions.py` passes against `main`. - `tools/pr_overlap.py`: #7505 and #9159 touch `ImportWatched`; #7505 is described above, and #9159 only neighbours its lines. The other entries (#6108, #6848, #6946, #7642, #9275, #9508, #9565, #9898) come from #7048's own changes, which this branch carries. #10886 builds on this PR (`Depends on: #10026`) and keeps its `markLayersPending` scan inside its `AllIn` guard. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #7048 - [x] Fixes: none - [x] Unblocks: none on its own; with #7048, PPSA01825 (The Pathless) no longer stops on #7017's refusal (3 of 8 runs on `main`, 0 of 13 with both) and its menu runs at 307–316 presents per 10 s instead of #7048's 85–105 (`main`: 319–326) - [x] GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 591.86, Windows 11 (10.0.26300); not run on AMD or Intel - [x] AI-assisted: yes [pathless-traces-isolation-7048-no-upload-hash.zip](https://github.com/user-attachments/files/33856004/pathless-traces-isolation-7048-no-upload-hash.zip) [pathless-traces-main-7048-e2c1fe440.zip](https://github.com/user-attachments/files/33856005/pathless-traces-main-7048-e2c1fe440.zip) [pathless-traces-main-83462cc57.zip](https://github.com/user-attachments/files/33856006/pathless-traces-main-83462cc57.zip) [pathless-traces-pr-4989cab12.zip](https://github.com/user-attachments/files/33856007/pathless-traces-pr-4989cab12.zip)
MarcZX10 commented 2026-10-23 05:09:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:09:07Z.

Review: APPROVED


Reviewed the stacked diff through d6138938c, including the declared dependency #7048. The follow-up replaces the per-upload hash with a hash captured at a proven write-watch transition, gates it by the write generation, and invalidates it on writes/refreshes; the focused tests cover the tested import-walk failure paths and pending-result behavior. The PR reports same-machine Pathless measurements in which #7048 alone regresses from 319–330 to 85–104 presents/10s and the combined stack returns to 304–316; those are the author’s Windows captures, not a local reproduction. Local diff whitespace, conventions, and test-registration checks pass. I could not run the focused AGC executable here: the available pre-existing binary aborts before test startup because this host lacks LZCNT, BMI1, BMI2, MOVBE, and AVX2. Hosted product jobs are skipped by the current workflow policy. Please preserve the dependency/merge order so #7048 is not delivered without its performance correction.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624144744 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10026#pullrequestreview-5624144744). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T05:09:07Z. **Review:** APPROVED --- Reviewed the stacked diff through d6138938c, including the declared dependency #7048. The follow-up replaces the per-upload hash with a hash captured at a proven write-watch transition, gates it by the write generation, and invalidates it on writes/refreshes; the focused tests cover the tested import-walk failure paths and pending-result behavior. The PR reports same-machine Pathless measurements in which #7048 alone regresses from 319–330 to 85–104 presents/10s and the combined stack returns to 304–316; those are the author’s Windows captures, not a local reproduction. Local diff whitespace, conventions, and test-registration checks pass. I could not run the focused AGC executable here: the available pre-existing binary aborts before test startup because this host lacks LZCNT, BMI1, BMI2, MOVBE, and AVX2. Hosted product jobs are skipped by the current workflow policy. Please preserve the dependency/merge order so #7048 is not delivered without its performance correction.
MarcZX10 commented 2026-10-23 06:06:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T06:06:35Z.

Review: CHANGES_REQUESTED


I reviewed exact head d6138938c99c24a21b6dce947cf6cb31e0d9a89e. The change is correctly declared as depending on open #7048, and its author-provided test/performance report is unusually detailed. Local git diff --check and python3 tools/check_conventions.py --base upstream/main pass. The hosted eligibility, intake, conventions, labels, and report checks pass; hosted Linux and Windows product builds are skipped by repository policy. I could not run this Windows/GPU test suite locally.

I am requesting changes because the branch no longer merges cleanly into current main. python3 tools/check_main_sync.py --base upstream/main reports 9 commits ahead / 1,079 behind and a merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp; it also identifies eight changed files modified on both sides since the merge base. The repository's build guidance requires current-main builds and a clean merge before review/merge, so the reported tests and performance comparison against 83462cc57 do not validate the current merge result.

Please rebase onto current main, resolve the Texture.cpp conflict while preserving intervening changes, then rerun the focused write-watch/storage-image tests and the same-scene main versus rebased-PR comparison. Please include the exact tested heads and refresh the trace summaries/digests if the rebase changes the tested result. This request is for the concrete merge conflict and stale validation base; it is not about queue size.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624557775 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10026#pullrequestreview-5624557775). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T06:06:35Z. **Review:** CHANGES_REQUESTED --- I reviewed exact head `d6138938c99c24a21b6dce947cf6cb31e0d9a89e`. The change is correctly declared as depending on open #7048, and its author-provided test/performance report is unusually detailed. Local `git diff --check` and `python3 tools/check_conventions.py --base upstream/main` pass. The hosted eligibility, intake, conventions, labels, and report checks pass; hosted Linux and Windows product builds are skipped by repository policy. I could not run this Windows/GPU test suite locally. I am requesting changes because the branch no longer merges cleanly into current `main`. `python3 tools/check_main_sync.py --base upstream/main` reports 9 commits ahead / 1,079 behind and a merge conflict in `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp`; it also identifies eight changed files modified on both sides since the merge base. The repository's build guidance requires current-main builds and a clean merge before review/merge, so the reported tests and performance comparison against `83462cc57` do not validate the current merge result. Please rebase onto current `main`, resolve the `Texture.cpp` conflict while preserving intervening changes, then rerun the focused write-watch/storage-image tests and the same-scene `main` versus rebased-PR comparison. Please include the exact tested heads and refresh the trace summaries/digests if the rebase changes the tested result. This request is for the concrete merge conflict and stale validation base; it is not about queue size.
ahmadmuj commented 2026-10-25 14:38:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T14:38:40Z.

Review: COMMENTED


Reviewed head b61555e17 merged locally onto main 3a2c51afd (clean). I ran it on Linux: WSL2 Ubuntu 24.04, GCC 13.3, lavapipe (Mesa 25.2.8), with the Khronos validation layer loaded. As far as I can see, this is the first Linux run of this stack.

What I ran:

  • Your validation regex plus #9159's set, with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 and APS5_DRAW_PIPELINE unset and =1. The merge passes 56/56 and main 55/55, both ways. Both sides skip the same 18 tests: the video_out_flip_* ones, agc_import_settle_initial_dcc, agc_storage_clear_hand_over and agc_unit_shadow. The only VUID on either side is VUID-VkDeviceCreateInfo-pNext-pNext, which comes from my older local layer.
  • agc_storage_pending_after_unwatch really runs on lavapipe. Host imports are on, so it doesn't skip. It passed 3/3 alone with the layer. On Linux it runs 16 cases, because UnprovenUnwatch is Windows-only.
  • Red control: I built this PR's Recorder.cpp and CMake entry over main's production code. It fails on the first case with #7017's refusal.
  • tools/check_conventions.py --base 4017310678 passes.
  • In hashBeforeUnwatch, I checked whether a CPU write that lands between UnchangedSince and the hash read could get lost. I injected such a write locally and stored a 16x16 partial result. The CPU's bytes survive, so I see no issue there.

One thing in ImportWatched (Execution/src/GuestMemory.cpp):

On main, the tracker lock stays held from the import through every second walk. Nothing else can collect a span before its WindowCopy walk. Here leave (L1845) suspends and resumes the lock, and L1862 calls it inside the post-import loop. So if span A's second walk fails, the lock drops while a later span B still waits for its window walk. If another thread runs CollectWrites over B at that moment, it walks B without the window. Every page the import touched in B then gets a CPU-write stamp. The "Pages under an import window" debt entry describes that case for NVIDIA, and CheckImportWindowOtherThread guards against it.

A possible fix: inside the loop, only do the walks and note the spans that fail. Then suspend once, run the hooks for those spans, resume, and do the unwatchLocked pass. The pre-import leave loop at L1856 runs before the import, so it looks fine to me.

Limits: I couldn't trigger this here. lavapipe's import doesn't mark pages (the startup probe reports 0 after the import), and the race needs a second thread collecting while the hook runs. So this comes from reading the code, not from a repro. I have no NVIDIA, AMD or Windows runs.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643698267 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10026#pullrequestreview-5643698267). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T14:38:40Z. **Review:** COMMENTED --- Reviewed head `b61555e17` merged locally onto main `3a2c51afd` (clean). I ran it on Linux: WSL2 Ubuntu 24.04, GCC 13.3, lavapipe (Mesa 25.2.8), with the Khronos validation layer loaded. As far as I can see, this is the first Linux run of this stack. What I ran: - Your validation regex plus #9159's set, with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1` and `APS5_DRAW_PIPELINE` unset and `=1`. The merge passes 56/56 and main 55/55, both ways. Both sides skip the same 18 tests: the `video_out_flip_*` ones, `agc_import_settle_initial_dcc`, `agc_storage_clear_hand_over` and `agc_unit_shadow`. The only VUID on either side is `VUID-VkDeviceCreateInfo-pNext-pNext`, which comes from my older local layer. - `agc_storage_pending_after_unwatch` really runs on lavapipe. Host imports are on, so it doesn't skip. It passed 3/3 alone with the layer. On Linux it runs 16 cases, because `UnprovenUnwatch` is Windows-only. - Red control: I built this PR's `Recorder.cpp` and CMake entry over main's production code. It fails on the first case with #7017's refusal. - `tools/check_conventions.py --base 4017310678` passes. - In `hashBeforeUnwatch`, I checked whether a CPU write that lands between `UnchangedSince` and the hash read could get lost. I injected such a write locally and stored a 16x16 partial result. The CPU's bytes survive, so I see no issue there. One thing in `ImportWatched` (`Execution/src/GuestMemory.cpp`): On main, the tracker lock stays held from the import through every second walk. Nothing else can collect a span before its `WindowCopy` walk. Here `leave` (L1845) suspends and resumes the lock, and L1862 calls it inside the post-import loop. So if span A's second walk fails, the lock drops while a later span B still waits for its window walk. If another thread runs `CollectWrites` over B at that moment, it walks B without the window. Every page the import touched in B then gets a CPU-write stamp. The "Pages under an import window" debt entry describes that case for NVIDIA, and `CheckImportWindowOtherThread` guards against it. A possible fix: inside the loop, only do the walks and note the spans that fail. Then suspend once, run the hooks for those spans, resume, and do the `unwatchLocked` pass. The pre-import `leave` loop at L1856 runs before the import, so it looks fine to me. Limits: I couldn't trigger this here. lavapipe's import doesn't mark pages (the startup probe reports 0 after the import), and the race needs a second thread collecting while the hook runs. So this comes from reading the code, not from a repro. I have no NVIDIA, AMD or Windows runs.
ahmadmuj commented 2026-10-25 15:34:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T15:34:04Z.

Review: APPROVED


Re-checked head 43a9245e8 merged locally onto main d2b3ee3bc (clean). Same Linux setup as before: WSL2 Ubuntu 24.04, GCC 13.3, lavapipe (Mesa 25.2.8), Khronos validation layer loaded.

43a9245 fixes the ImportWatched point from my earlier review: every post-import window walk now finishes before the failed spans' hooks run under one Suspension, and that happens before any unwatchLocked.

What I ran:

  • CheckImportWalkHookKeepsLaterWindows runs on Linux (agc_write_tracking, rc 0, not the 77 skip) and passes 3/3.
  • Red/green: I moved span A's hook back inside the post-import loop, the b61555e order, and kept your new span selector so the test still builds. It fails with "a collect run by the unwatch hook of an earlier span counted a page the import touched without changing it as a CPU write". With the change restored it passes again.
  • The validation set from before (your regex plus #9159's), with the layer and APS5_DRAW_PIPELINE unset and =1: the merge passes 56/56 and main d2b3ee3bc 55/55, both ways. Both sides skip the same 18 tests, and the only VUID on either side is the old-layer VkDeviceCreateInfo-pNext-pNext.
  • agc_storage_pending_after_unwatch alone with the layer passes 3/3. tools/check_conventions.py passes.

Limits: lavapipe only. I have no Windows or NVIDIA runs and didn't redo the Pathless or Persona numbers. This approval covers the Linux side of this head, and my point is resolved. #7048 still has to land first.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643881803 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10026#pullrequestreview-5643881803). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T15:34:04Z. **Review:** APPROVED --- Re-checked head `43a9245e8` merged locally onto main `d2b3ee3bc` (clean). Same Linux setup as before: WSL2 Ubuntu 24.04, GCC 13.3, lavapipe (Mesa 25.2.8), Khronos validation layer loaded. 43a9245 fixes the `ImportWatched` point from my earlier review: every post-import window walk now finishes before the failed spans' hooks run under one `Suspension`, and that happens before any `unwatchLocked`. What I ran: - `CheckImportWalkHookKeepsLaterWindows` runs on Linux (`agc_write_tracking`, rc 0, not the 77 skip) and passes 3/3. - Red/green: I moved span A's hook back inside the post-import loop, the b61555e order, and kept your new span selector so the test still builds. It fails with "a collect run by the unwatch hook of an earlier span counted a page the import touched without changing it as a CPU write". With the change restored it passes again. - The validation set from before (your regex plus #9159's), with the layer and `APS5_DRAW_PIPELINE` unset and `=1`: the merge passes 56/56 and main `d2b3ee3bc` 55/55, both ways. Both sides skip the same 18 tests, and the only VUID on either side is the old-layer `VkDeviceCreateInfo-pNext-pNext`. - `agc_storage_pending_after_unwatch` alone with the layer passes 3/3. `tools/check_conventions.py` passes. Limits: lavapipe only. I have no Windows or NVIDIA runs and didn't redo the Pathless or Persona numbers. This approval covers the Linux side of this head, and my point is resolved. #7048 still has to land first.
MarcZX10 commented 2026-10-29 19:55:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T19:55:26Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The current head does not merge cleanly with live main: GuestBufferMemory.cpp and Texture.cpp conflict, so this exact change cannot be validated against the required current-base tree.

What I ran

  • PR head: 53c3cd4eee3b15cd6408cd78a8934c9fcfb1a8ec.
  • Current base: main 420b6a064eadaa7c5e50b080c7fad59c41150b4b.
  • Merge preview: git merge-tree --write-tree upstream/main refs/remotes/upstream/pr-10026 — conflicts in GuestBufferMemory.cpp and Texture.cpp.
  • Environment: Debian 12 x86-64, GCC 12.2.0, CMake 3.25.1, Ninja 1.11.1; host Xeon E5-1620 v2. QEMU user-mode TCG ran with llvmpipe (LLVM 15.0.6).
  • Commands:
cmake -S /dev/shm/AnyPS5-review-10026 -B /dev/shm/AnyPS5-build-10026 -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
cmake --build /dev/shm/AnyPS5-build-10026 --target agc_driver_recorder_tests -j2
git -C /dev/shm/AnyPS5-review-10026 diff --check cda9c9bedf143010185aa17cf04e221389dd78b5...HEAD
git -C /marc/AnyPS5 merge-tree --write-tree upstream/main refs/remotes/upstream/pr-10026
ctest --test-dir /dev/shm/AnyPS5-build-10026 -R '^agc_unwatch_hook_lock_order$' -V --timeout 120
cd /dev/shm/AnyPS5-build-10026/core/libs/prx/libSceAgcDriver
APS5_NO_PIPELINE_JOURNAL=1 qemu-x86_64 -cpu max /dev/shm/AnyPS5-build-10026/tests/agc_driver_recorder_tests --unwatch-lock-order-only

Results

Check Result
Current-main merge preview Fails with content conflicts in GuestBufferMemory.cpp and Texture.cpp.
Local configure and agc_driver_recorder_tests build Passed; target linked successfully.
git diff --check against the PR base Passed with no output.
Hosted exact-head checks Conventions and labels pass; no product build/test job is present for head 53c3cd4.
Native agc_unwatch_hook_lock_order CTest Could not start the test: the host CPU gate aborts because this Xeon lacks LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA.
QEMU --unwatch-lock-order-only run Skipped with exit 77: llvmpipe keeps host imports watched and does not provide the write-watch path this test requires.
Unedited command output
# Final lines from the successful initial build
[955/956] Building CXX object core/libs/prx/libSceAgcDriver/CMakeFiles/agc_driver_recorder_tests.dir/tests/Recorder.cpp.o
[956/956] Linking CXX executable tests/agc_driver_recorder_tests

# git diff --check cda9c9bedf143010185aa17cf04e221389dd78b5...HEAD
(no output; exit 0)

# Current-main merge preview
CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp

# Native CTest
[src/HostCpu.cpp:193 operator()] host CPU Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz: has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CMPXCHG16B, LAHF/SAHF, AVX, F16C, AES, PCLMULQDQ, RDRAND, XSAVEOPT, OS AVX state (XCR0); lacks LZCNT, BMI1, BMI2, MOVBE, AVX2, FMA, RDSEED, ADX, SHA, CLFLUSHOPT, CLWB, RDPID, XSAVEC, SSE4A, PREFETCHW, CLZERO
[libc] unhandled exception 'St13runtime_error' thrown from 0x7f64bac4f9b7
terminate called after throwing an instance of 'std::runtime_error'
  what():  The host CPU (Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz) lacks LZCNT, BMI1, BMI2, MOVBE, AVX2, FMA. The PS5's Zen 2 CPU has these extensions and titles run their instructions natively, so this CPU cannot run them.
1/1 Test #618: agc_unwatch_hook_lock_order ......Subprocess aborted***Exception:   0.01 sec

# QEMU user-mode run
[src/HostCpu.cpp:193 operator()] host CPU QEMU TCG CPU version 2.5+: has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, LZCNT, BMI1, BMI2, MOVBE, CMPXCHG16B, LAHF/SAHF, AVX, AVX2, FMA, F16C, AES, PCLMULQDQ, RDRAND, ADX, CLFLUSHOPT, CLWB, XSAVEOPT, SSE4A, OS AVX state (XCR0); lacks RDSEED, SHA, RDPID, XSAVEC, PREFETCHW, CLZERO
Vulkan device: llvmpipe (LLVM 15.0.6, 256 bits)
Vulkan device: llvmpipe (LLVM 15.0.6, 256 bits)
host imports stay watched
no write watching: the unwatch hook's lock order at a map-time import not tested

Negative control

Assertion Code change made Did the new test fail?
A map-time import is deferred before an unwatch hook can acquire the GPU mutex. None; I did not mutate the code. The test could not execute its write-watch path on this host. Not exercised.

Findings

Blocking

  • The exact PR head conflicts with current main in GuestBufferMemory.cpp and Texture.cpp. The repository's contribution instructions require rebasing a PR that no longer merges cleanly. Resolve both conflicts while preserving the current main changes and this PR's lock-order fix.

Non-blocking

  • I found no separate demonstrated defect in the new predicate from this static review. The new lock-order assertion remains unverified locally because the available host cannot exercise the required unwatch path.

Sources

Not verified

No actual write-watch/unwatch scenario ran on this host, and no PS5-console behavior was tested. The latest NVIDIA report predates commit 53c3cd4; its results do not validate this new lock-order change. Full Linux/Windows PR builds and tests are not automatic under the repository's current workflow.

To get this to a good state

Rebase onto 420b6a064eadaa7c5e50b080c7fad59c41150b4b, resolve both conflicts, then run the focused agc_unwatch_hook_lock_order test on a supported host where the write-watch path executes. Per AGENTS.md, compare the same focused test on that host's main and updated head with Vulkan validation enabled. I will rerun the merge preview, conventions, and available focused checks on the new head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5704097383 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10026#pullrequestreview-5704097383). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T19:55:26Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The current head does not merge cleanly with live `main`: `GuestBufferMemory.cpp` and `Texture.cpp` conflict, so this exact change cannot be validated against the required current-base tree. ## What I ran - PR head: `53c3cd4eee3b15cd6408cd78a8934c9fcfb1a8ec`. - Current base: `main` `420b6a064eadaa7c5e50b080c7fad59c41150b4b`. - Merge preview: `git merge-tree --write-tree upstream/main refs/remotes/upstream/pr-10026` — conflicts in `GuestBufferMemory.cpp` and `Texture.cpp`. - Environment: Debian 12 x86-64, GCC 12.2.0, CMake 3.25.1, Ninja 1.11.1; host Xeon E5-1620 v2. QEMU user-mode TCG ran with llvmpipe (LLVM 15.0.6). - Commands: ```sh cmake -S /dev/shm/AnyPS5-review-10026 -B /dev/shm/AnyPS5-build-10026 -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON cmake --build /dev/shm/AnyPS5-build-10026 --target agc_driver_recorder_tests -j2 git -C /dev/shm/AnyPS5-review-10026 diff --check cda9c9bedf143010185aa17cf04e221389dd78b5...HEAD git -C /marc/AnyPS5 merge-tree --write-tree upstream/main refs/remotes/upstream/pr-10026 ctest --test-dir /dev/shm/AnyPS5-build-10026 -R '^agc_unwatch_hook_lock_order$' -V --timeout 120 cd /dev/shm/AnyPS5-build-10026/core/libs/prx/libSceAgcDriver APS5_NO_PIPELINE_JOURNAL=1 qemu-x86_64 -cpu max /dev/shm/AnyPS5-build-10026/tests/agc_driver_recorder_tests --unwatch-lock-order-only ``` ## Results | Check | Result | |---|---| | Current-main merge preview | Fails with content conflicts in `GuestBufferMemory.cpp` and `Texture.cpp`. | | Local configure and `agc_driver_recorder_tests` build | Passed; target linked successfully. | | `git diff --check` against the PR base | Passed with no output. | | Hosted exact-head checks | Conventions and labels pass; no product build/test job is present for head `53c3cd4`. | | Native `agc_unwatch_hook_lock_order` CTest | Could not start the test: the host CPU gate aborts because this Xeon lacks LZCNT, BMI1, BMI2, MOVBE, AVX2 and FMA. | | QEMU `--unwatch-lock-order-only` run | Skipped with exit 77: llvmpipe keeps host imports watched and does not provide the write-watch path this test requires. | <details> <summary>Unedited command output</summary> ```text # Final lines from the successful initial build [955/956] Building CXX object core/libs/prx/libSceAgcDriver/CMakeFiles/agc_driver_recorder_tests.dir/tests/Recorder.cpp.o [956/956] Linking CXX executable tests/agc_driver_recorder_tests # git diff --check cda9c9bedf143010185aa17cf04e221389dd78b5...HEAD (no output; exit 0) # Current-main merge preview CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp # Native CTest [src/HostCpu.cpp:193 operator()] host CPU Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz: has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CMPXCHG16B, LAHF/SAHF, AVX, F16C, AES, PCLMULQDQ, RDRAND, XSAVEOPT, OS AVX state (XCR0); lacks LZCNT, BMI1, BMI2, MOVBE, AVX2, FMA, RDSEED, ADX, SHA, CLFLUSHOPT, CLWB, RDPID, XSAVEC, SSE4A, PREFETCHW, CLZERO [libc] unhandled exception 'St13runtime_error' thrown from 0x7f64bac4f9b7 terminate called after throwing an instance of 'std::runtime_error' what(): The host CPU (Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz) lacks LZCNT, BMI1, BMI2, MOVBE, AVX2, FMA. The PS5's Zen 2 CPU has these extensions and titles run their instructions natively, so this CPU cannot run them. 1/1 Test #618: agc_unwatch_hook_lock_order ......Subprocess aborted***Exception: 0.01 sec # QEMU user-mode run [src/HostCpu.cpp:193 operator()] host CPU QEMU TCG CPU version 2.5+: has SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, LZCNT, BMI1, BMI2, MOVBE, CMPXCHG16B, LAHF/SAHF, AVX, AVX2, FMA, F16C, AES, PCLMULQDQ, RDRAND, ADX, CLFLUSHOPT, CLWB, XSAVEOPT, SSE4A, OS AVX state (XCR0); lacks RDSEED, SHA, RDPID, XSAVEC, PREFETCHW, CLZERO Vulkan device: llvmpipe (LLVM 15.0.6, 256 bits) Vulkan device: llvmpipe (LLVM 15.0.6, 256 bits) host imports stay watched no write watching: the unwatch hook's lock order at a map-time import not tested ``` </details> ## Negative control | Assertion | Code change made | Did the new test fail? | |---|---|---| | A map-time import is deferred before an unwatch hook can acquire the GPU mutex. | None; I did not mutate the code. The test could not execute its write-watch path on this host. | Not exercised. | ## Findings ### Blocking - The exact PR head conflicts with current `main` in `GuestBufferMemory.cpp` and `Texture.cpp`. The repository's contribution instructions require rebasing a PR that no longer merges cleanly. Resolve both conflicts while preserving the current `main` changes and this PR's lock-order fix. ### Non-blocking - I found no separate demonstrated defect in the new predicate from this static review. The new lock-order assertion remains unverified locally because the available host cannot exercise the required unwatch path. ## Sources - [Contribution rule: a PR that no longer merges cleanly must be rebased](https://github.com/boykopovar/AnyPS5/blob/420b6a064eadaa7c5e50b080c7fad59c41150b4b/CONTRIBUTING.md#L43-L44) - [AGC test requirements for a same-machine main/change run](https://github.com/boykopovar/AnyPS5/blob/420b6a064eadaa7c5e50b080c7fad59c41150b4b/AGENTS.md#L15) - [Reviewed commit](https://github.com/boykopovar/AnyPS5/commit/53c3cd4eee3b15cd6408cd78a8934c9fcfb1a8ec) ## Not verified No actual write-watch/unwatch scenario ran on this host, and no PS5-console behavior was tested. The latest NVIDIA report predates commit `53c3cd4`; its results do not validate this new lock-order change. Full Linux/Windows PR builds and tests are not automatic under the repository's current workflow. ## To get this to a good state Rebase onto `420b6a064eadaa7c5e50b080c7fad59c41150b4b`, resolve both conflicts, then run the focused `agc_unwatch_hook_lock_order` test on a supported host where the write-watch path executes. Per `AGENTS.md`, compare the same focused test on that host's `main` and updated head with Vulkan validation enabled. I will rerun the merge preview, conventions, and available focused checks on the new head.
MarcZX10 commented 2026-10-29 23:06:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T23:06:04Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The new lock-order assertion is present, but head 8b14bde3ca1c256413582b8ec2d7d88889d560cd still conflicts with current main in GuestBufferMemory.cpp and Texture.cpp, and the available GPU report predates this head.

What I ran

Reviewed head 8b14bde3ca1c256413582b8ec2d7d88889d560cd against PR base cda9c9bedf143010185aa17cf04e221389dd78b5; current main is dc38224141e0b6096007b876b4c42fc9144d11b8. The merge preview is conflicted. Local checks ran in Linux; no compiler or build was invoked.

git merge-tree --write-tree refs/remotes/upstream/main refs/review/pr-10026-current
git diff --check cda9c9bedf143010185aa17cf04e221389dd78b5..refs/review/pr-10026-current
python3 tools/check_conventions.py --base cda9c9bedf143010185aa17cf04e221389dd78b5 --head refs/review/pr-10026-current
gh pr checks 10026 --repo boykopovar/AnyPS5

Results

Check Result
Current-main merge preview Conflicts in GuestBufferMemory.cpp and Texture.cpp
Diff check against PR base Passed; no output
Repository conventions against PR base Passed
Hosted checks Conventions and labels passed on the exact head; no product test job ran
NVIDIA GPU test report The latest report tests 660cef6fe9ada0979f22ed2dd9c76419ae36306b, not this head; it cannot verify the new lock-order assertion
Unedited local check output
CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp
CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
All conventions checks passed.

Findings

Blocking

  • The PR does not merge cleanly with current main, so the required current-base validation cannot be completed. Please rebase onto dc38224141e0b6096007b876b4c42fc9144d11b8 and preserve both main's changes and this PR's lock-order fix.
  • The new assertion/test commit 8b14bde3 is not covered by the posted NVIDIA report, which tested 660cef6fe. After resolving the conflicts, run the focused unwatch-lock-order test on the new exact head and a same-machine main baseline with Vulkan validation, as required by the AGC test guidance.

Non-blocking

The conventions check passes against the PR base. I did not find another new source-level blocker in the added assertion, but its GPU path is not verified by the existing report.

Sources

Not verified

No current-main merged build, focused GPU test on this head, or console run was performed. The latest NVIDIA test report is on an older commit.

To get this to a good state

Please resolve the two current-main conflicts, then run the focused lock-order test on the updated head and same-machine main baseline with Vulkan validation. I will rerun the merge preview, diff check, conventions, and review the new test evidence on that exact head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5706111796 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10026#pullrequestreview-5706111796). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T23:06:04Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The new lock-order assertion is present, but head `8b14bde3ca1c256413582b8ec2d7d88889d560cd` still conflicts with current `main` in `GuestBufferMemory.cpp` and `Texture.cpp`, and the available GPU report predates this head. ## What I ran Reviewed head `8b14bde3ca1c256413582b8ec2d7d88889d560cd` against PR base `cda9c9bedf143010185aa17cf04e221389dd78b5`; current `main` is `dc38224141e0b6096007b876b4c42fc9144d11b8`. The merge preview is conflicted. Local checks ran in Linux; no compiler or build was invoked. ```sh git merge-tree --write-tree refs/remotes/upstream/main refs/review/pr-10026-current git diff --check cda9c9bedf143010185aa17cf04e221389dd78b5..refs/review/pr-10026-current python3 tools/check_conventions.py --base cda9c9bedf143010185aa17cf04e221389dd78b5 --head refs/review/pr-10026-current gh pr checks 10026 --repo boykopovar/AnyPS5 ``` ## Results | Check | Result | |---|---| | Current-main merge preview | Conflicts in `GuestBufferMemory.cpp` and `Texture.cpp` | | Diff check against PR base | Passed; no output | | Repository conventions against PR base | Passed | | Hosted checks | Conventions and labels passed on the exact head; no product test job ran | | NVIDIA GPU test report | The latest report tests `660cef6fe9ada0979f22ed2dd9c76419ae36306b`, not this head; it cannot verify the new lock-order assertion | <details> <summary>Unedited local check output</summary> ```text CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp CONFLICT (content): Merge conflict in core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp All conventions checks passed. ``` </details> ## Findings ### Blocking - The PR does not merge cleanly with current `main`, so the required current-base validation cannot be completed. Please rebase onto `dc38224141e0b6096007b876b4c42fc9144d11b8` and preserve both `main`'s changes and this PR's lock-order fix. - The new assertion/test commit `8b14bde3` is not covered by the posted NVIDIA report, which tested `660cef6fe`. After resolving the conflicts, run the focused unwatch-lock-order test on the new exact head and a same-machine `main` baseline with Vulkan validation, as required by the AGC test guidance. ### Non-blocking The conventions check passes against the PR base. I did not find another new source-level blocker in the added assertion, but its GPU path is not verified by the existing report. ## Sources - [Lock-order assertion at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/8b14bde3ca1c256413582b8ec2d7d88889d560cd/core/libs/prx/libSceAgcDriver/Execution/src/GuestMemory.cpp) - [Unwatch lock-order test registration at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/8b14bde3ca1c256413582b8ec2d7d88889d560cd/core/libs/prx/libSceAgcDriver/CMakeLists.txt) - [AGC test guidance at current main](https://github.com/boykopovar/AnyPS5/blob/dc38224141e0b6096007b876b4c42fc9144d11b8/AGENTS.md) - [NVIDIA report for the older head](https://github.com/boykopovar/AnyPS5/pull/10026#issuecomment-6503518231) ## Not verified No current-main merged build, focused GPU test on this head, or console run was performed. The latest NVIDIA test report is on an older commit. ## To get this to a good state Please resolve the two current-main conflicts, then run the focused lock-order test on the updated head and same-machine `main` baseline with Vulkan validation. I will rerun the merge preview, diff check, conventions, and review the new test evidence on that exact head.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!10026
No description provided.