perf(agc): import resident direct memory through a section alias on Windows #5851

Closed
Pipodi wants to merge 3 commits from upstream-pr/5851 into main
Pipodi commented 2026-10-14 13:46:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-14T13:46:24Z.


What

Since #5596, a direct memory page mapped at one guest address is private write-watched memory on Windows. The AGC driver imported such ranges as plain read-write memory, without an alias. On Windows a host import without an alias is removed from guest write tracking, and its changes are found by comparison. Every use of these ranges was compared and refilled on the CPU, on the graphics queue worker.

With this change, an import range that holds resident direct memory takes the alias path. MapAlias moves every resident run the range touches into the section, as a second mapping already does, instead of refusing runs that extend past the range. The import then stays write-tracked through the guest views. Direct memory the GPU never imports keeps #5596's fault-free write watching.

MapAlias leaves a resident run alone while any of its pages has a host write open (an APR or file read, a socket receive), so a write in flight can neither fail on the fence nor be lost by the demotion. The driver imports such a range without an alias, as before. It does not wait, because some host writes block.

The libc debt entry for the Windows direct-memory backing now says that a GPU import also moves the run into the section.

Related: #5688 handles the same #5596 effect further down, in heap mirrors, for the Resident Evil Village abort ("an address-based build copies 419 MiB ... past 64 MiB"). With this change the window import of such a heap stays write-tracked, so the mirror should no longer meet unwatched blocks there. I could not test Village. The two changes touch different functions and do not conflict.

Tested

Windows 11 (10.0.26200), RTX 4090, NVIDIA 617.42, i9-13900K, 3840x2160. Title: Ghost of Yōtei (PPSA26344), intro presents 150–180 (APS5_TRACE_FRAMES=150:30). Caches were warm: the scene ran once and the title was restarted. No other APS5_TRACE_* or APS5_PROFILE_* switch was set and the log was not redirected.

A and B are not bare main. The title does not boot on main without #758, #4450 and #4475 plus a local startup patch. A (3b54a9f220ff) is main 9a3e2ac4d with #758, #4450 and #4475, #5089 reverted (it conflicts with #758), and our local patches; none of them touches the files of this PR. B (ff303dac6c56) is A plus this PR's commit, so git diff A B is exactly this PR's diff.

Summary lines (A1, B1, A2)
{"commit":"3b54a9f220ff","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PREPARED_SPIRV_MIB":"6144","APS5_STAGING_POOL_MIB":"2048","APS5_TRACE_FRAMES":"150:30"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 150:30","first_present":150,"ms":8574.588},"presents":30,"frame_ms":{"p50":282.899,"p90":302.919,"p99":305.510,"max":305.510},"gpu_busy_ms_per_present":94.666,"worker_busy_pct":{"queue worker 0x0":98.363,"queue worker 0x52":0.000,"queue worker 0x53":0.000,"queue worker 0x20":46.788,"queue worker 0x30":70.703,"queue worker 0x38":71.305,"queue worker 0x48":3.908},"top_phases_ms_per_frame":{"Driver.Packet":818.491,"Driver.Packet.memory_wait":489.418,"Driver.Packet.dispatch":191.796,"Driver.Dispatch":186.636,"Resources.Complete":108.687,"Vulkan.Dispatch":107.893,"Vulkan.Dispatch.shader_resources":107.510,"Driver.Packet.draw":105.486},"trace_dropped":false,"trace":"aps5-trace-3b54a9f220ff-26080.json.gz"}
{"commit":"ff303dac6c56","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PREPARED_SPIRV_MIB":"6144","APS5_STAGING_POOL_MIB":"2048","APS5_TRACE_FRAMES":"150:30"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 150:30","first_present":150,"ms":3483.679},"presents":30,"frame_ms":{"p50":117.339,"p90":120.558,"p99":121.085,"max":121.085},"gpu_busy_ms_per_present":60.324,"worker_busy_pct":{"queue worker 0x0":89.098,"queue worker 0x52":0.000,"queue worker 0x20":50.104,"queue worker 0x53":0.000,"queue worker 0x38":86.536,"queue worker 0x48":7.112,"queue worker 0x30":85.251},"top_phases_ms_per_frame":{"Driver.Packet":367.424,"Driver.Packet.memory_wait":202.386,"Driver.Packet.prepare_memory":85.112,"Driver.Packet.draw":42.368,"Driver.Draw":42.352,"Driver.Draw.draw_and_resource_release":42.022,"Driver.Packet.dispatch":36.036,"Recorder.WaitSerial":32.175},"trace_dropped":false,"trace":"aps5-trace-ff303dac6c56-18228.json.gz"}
{"commit":"3b54a9f220ff","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PREPARED_SPIRV_MIB":"6144","APS5_STAGING_POOL_MIB":"2048","APS5_TRACE_FRAMES":"150:30"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 150:30","first_present":150,"ms":8352.458},"presents":30,"frame_ms":{"p50":278.821,"p90":285.176,"p99":285.667,"max":285.667},"gpu_busy_ms_per_present":89.738,"worker_busy_pct":{"queue worker 0x0":98.673,"queue worker 0x52":0.000,"queue worker 0x53":0.000,"queue worker 0x20":47.306,"queue worker 0x30":71.005,"queue worker 0x38":71.590,"queue worker 0x48":3.072},"top_phases_ms_per_frame":{"Driver.Packet":801.068,"Driver.Packet.memory_wait":480.214,"Driver.Packet.dispatch":185.830,"Driver.Dispatch":181.216,"Resources.Complete":107.208,"Vulkan.Dispatch":105.886,"Vulkan.Dispatch.shader_resources":105.525,"Driver.Packet.draw":103.813},"trace_dropped":false,"trace":"aps5-trace-3b54a9f220ff-30260.json.gz"}
capture commit 30 presents frame ms p50 frame ms p90 gpu_busy ms/present queue worker 0x0 busy
A1 3b54a9f220ff 8.57 s 282.9 302.9 94.7 98.4 %
B1 ff303dac6c56 3.48 s 117.3 120.6 60.3 89.1 %
A2 3b54a9f220ff 8.35 s 278.8 285.2 89.7 98.7 %

B takes 58 % less time per frame than A (p50 117 ms vs 279–283 ms). In A, Resources.Complete costs 107–109 ms per frame on queue worker 0x0; in B it is no longer among the eight largest phases.

Queue worker 0x0, exclusive ms per frame over the 30 presents (from the traces):

phase A1 B1 A2
Resources.Complete 81.8 1.0 81.1
Graphics.Draw.draw_and_resource_release 56.5 21.4 55.7
Recorder.Sync 47.7 – 45.7
GpuMutex.wait.fill 20.3 – 19.4
Driver.Packet.prepare_memory 17.7 17.8 16.8
Vulkan.Dispatch.shader_resources 14.9 17.9 14.5
Graphics.DrawWithRecipe 14.4 15.7 14.4
Recorder.WaitSerial – 14.6 –

"–" means the phase is not among the worker's ten largest in that capture. The time A spends completing resources, syncing the recorder and waiting for fills is the comparison and refill of the unwatched direct-memory imports.

The three traces are available on request.

Tests:

  • agc_driver_recorder_tests --host-import-second-mapping-only passes. Its new assertion (the first import of singly mapped direct memory has an alias and is not unwatched) fails without the change.
  • guest_memory_tests passes, including the new CheckAliasLeavesResidentRunsUnderAHostWrite, which fails without the host-write commit (22091410a).
  • Full suite on this branch (ctest, Windows, RTX 4090): 1183 of 1184 pass. check_main_sync fails test_paths_with_spaces_and_unicode_are_reported_verbatim because this machine's console code page prints é as é; it does not touch this change.
  • agc_driver_recorder_tests (not registered with ctest) stops at (9) a scan under a pending write was kept in keyProofTests, the same on main 5a6ad0ed3 without this change.

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: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 (10.0.26200)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4858867426 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-14T13:46:24Z. --- ### What Since #5596, a direct memory page mapped at one guest address is private write-watched memory on Windows. The AGC driver imported such ranges as plain read-write memory, without an alias. On Windows a host import without an alias is removed from guest write tracking, and its changes are found by comparison. Every use of these ranges was compared and refilled on the CPU, on the graphics queue worker. With this change, an import range that holds resident direct memory takes the alias path. `MapAlias` moves every resident run the range touches into the section, as a second mapping already does, instead of refusing runs that extend past the range. The import then stays write-tracked through the guest views. Direct memory the GPU never imports keeps #5596's fault-free write watching. `MapAlias` leaves a resident run alone while any of its pages has a host write open (an APR or file read, a socket receive), so a write in flight can neither fail on the fence nor be lost by the demotion. The driver imports such a range without an alias, as before. It does not wait, because some host writes block. The libc debt entry for the Windows direct-memory backing now says that a GPU import also moves the run into the section. Related: #5688 handles the same #5596 effect further down, in heap mirrors, for the Resident Evil Village abort ("an address-based build copies 419 MiB ... past 64 MiB"). With this change the window import of such a heap stays write-tracked, so the mirror should no longer meet unwatched blocks there. I could not test Village. The two changes touch different functions and do not conflict. ### Tested Windows 11 (10.0.26200), RTX 4090, NVIDIA 617.42, i9-13900K, 3840x2160. Title: Ghost of Yōtei (PPSA26344), intro presents 150–180 (`APS5_TRACE_FRAMES=150:30`). Caches were warm: the scene ran once and the title was restarted. No other `APS5_TRACE_*` or `APS5_PROFILE_*` switch was set and the log was not redirected. A and B are not bare `main`. The title does not boot on `main` without #758, #4450 and #4475 plus a local startup patch. A (3b54a9f220ff) is `main` 9a3e2ac4d with #758, #4450 and #4475, #5089 reverted (it conflicts with #758), and our local patches; none of them touches the files of this PR. B (ff303dac6c56) is A plus this PR's commit, so `git diff A B` is exactly this PR's diff. <details><summary>Summary lines (A1, B1, A2)</summary> ``` {"commit":"3b54a9f220ff","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PREPARED_SPIRV_MIB":"6144","APS5_STAGING_POOL_MIB":"2048","APS5_TRACE_FRAMES":"150:30"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 150:30","first_present":150,"ms":8574.588},"presents":30,"frame_ms":{"p50":282.899,"p90":302.919,"p99":305.510,"max":305.510},"gpu_busy_ms_per_present":94.666,"worker_busy_pct":{"queue worker 0x0":98.363,"queue worker 0x52":0.000,"queue worker 0x53":0.000,"queue worker 0x20":46.788,"queue worker 0x30":70.703,"queue worker 0x38":71.305,"queue worker 0x48":3.908},"top_phases_ms_per_frame":{"Driver.Packet":818.491,"Driver.Packet.memory_wait":489.418,"Driver.Packet.dispatch":191.796,"Driver.Dispatch":186.636,"Resources.Complete":108.687,"Vulkan.Dispatch":107.893,"Vulkan.Dispatch.shader_resources":107.510,"Driver.Packet.draw":105.486},"trace_dropped":false,"trace":"aps5-trace-3b54a9f220ff-26080.json.gz"} {"commit":"ff303dac6c56","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PREPARED_SPIRV_MIB":"6144","APS5_STAGING_POOL_MIB":"2048","APS5_TRACE_FRAMES":"150:30"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 150:30","first_present":150,"ms":3483.679},"presents":30,"frame_ms":{"p50":117.339,"p90":120.558,"p99":121.085,"max":121.085},"gpu_busy_ms_per_present":60.324,"worker_busy_pct":{"queue worker 0x0":89.098,"queue worker 0x52":0.000,"queue worker 0x20":50.104,"queue worker 0x53":0.000,"queue worker 0x38":86.536,"queue worker 0x48":7.112,"queue worker 0x30":85.251},"top_phases_ms_per_frame":{"Driver.Packet":367.424,"Driver.Packet.memory_wait":202.386,"Driver.Packet.prepare_memory":85.112,"Driver.Packet.draw":42.368,"Driver.Draw":42.352,"Driver.Draw.draw_and_resource_release":42.022,"Driver.Packet.dispatch":36.036,"Recorder.WaitSerial":32.175},"trace_dropped":false,"trace":"aps5-trace-ff303dac6c56-18228.json.gz"} {"commit":"3b54a9f220ff","dirty":false,"env":{"APS5_HOST_IMPORT_MIB":"16384","APS5_NO_SNAPSHOT_CHECK":"1","APS5_PREPARED_SPIRV_MIB":"6144","APS5_STAGING_POOL_MIB":"2048","APS5_TRACE_FRAMES":"150:30"},"gpu":"NVIDIA GeForce RTX 4090","driver":"NVIDIA 617.42","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"frames 150:30","first_present":150,"ms":8352.458},"presents":30,"frame_ms":{"p50":278.821,"p90":285.176,"p99":285.667,"max":285.667},"gpu_busy_ms_per_present":89.738,"worker_busy_pct":{"queue worker 0x0":98.673,"queue worker 0x52":0.000,"queue worker 0x53":0.000,"queue worker 0x20":47.306,"queue worker 0x30":71.005,"queue worker 0x38":71.590,"queue worker 0x48":3.072},"top_phases_ms_per_frame":{"Driver.Packet":801.068,"Driver.Packet.memory_wait":480.214,"Driver.Packet.dispatch":185.830,"Driver.Dispatch":181.216,"Resources.Complete":107.208,"Vulkan.Dispatch":105.886,"Vulkan.Dispatch.shader_resources":105.525,"Driver.Packet.draw":103.813},"trace_dropped":false,"trace":"aps5-trace-3b54a9f220ff-30260.json.gz"} ``` </details> | capture | commit | 30 presents | frame ms p50 | frame ms p90 | gpu_busy ms/present | queue worker 0x0 busy | |---|---|---|---|---|---|---| | A1 | 3b54a9f220ff | 8.57 s | 282.9 | 302.9 | 94.7 | 98.4 % | | B1 | ff303dac6c56 | 3.48 s | 117.3 | 120.6 | 60.3 | 89.1 % | | A2 | 3b54a9f220ff | 8.35 s | 278.8 | 285.2 | 89.7 | 98.7 % | B takes 58 % less time per frame than A (p50 117 ms vs 279–283 ms). In A, `Resources.Complete` costs 107–109 ms per frame on queue worker 0x0; in B it is no longer among the eight largest phases. Queue worker 0x0, exclusive ms per frame over the 30 presents (from the traces): | phase | A1 | B1 | A2 | |---|---|---|---| | `Resources.Complete` | 81.8 | 1.0 | 81.1 | | `Graphics.Draw.draw_and_resource_release` | 56.5 | 21.4 | 55.7 | | `Recorder.Sync` | 47.7 | – | 45.7 | | `GpuMutex.wait.fill` | 20.3 | – | 19.4 | | `Driver.Packet.prepare_memory` | 17.7 | 17.8 | 16.8 | | `Vulkan.Dispatch.shader_resources` | 14.9 | 17.9 | 14.5 | | `Graphics.DrawWithRecipe` | 14.4 | 15.7 | 14.4 | | `Recorder.WaitSerial` | – | 14.6 | – | "–" means the phase is not among the worker's ten largest in that capture. The time A spends completing resources, syncing the recorder and waiting for fills is the comparison and refill of the unwatched direct-memory imports. The three traces are available on request. Tests: - `agc_driver_recorder_tests --host-import-second-mapping-only` passes. Its new assertion (the first import of singly mapped direct memory has an alias and is not unwatched) fails without the change. - `guest_memory_tests` passes, including the new `CheckAliasLeavesResidentRunsUnderAHostWrite`, which fails without the host-write commit (22091410a). - Full suite on this branch (`ctest`, Windows, RTX 4090): 1183 of 1184 pass. `check_main_sync` fails `test_paths_with_spaces_and_unicode_are_reported_verbatim` because this machine's console code page prints `é` as `é`; it does not touch this change. - `agc_driver_recorder_tests` (not registered with ctest) stops at `(9) a scan under a pending write was kept` in `keyProofTests`, the same on `main` 5a6ad0ed3 without this change. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical 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: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4090, driver 617.42, Windows 11 (10.0.26200) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-14 13:51:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T13:51:54Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3965 docs/dev/debt/libc.md L36
#5599 docs/dev/debt/libc.md L35-36
#5816 docs/dev/debt/libc.md L36-37
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6169960234 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6169960234). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T13:51:54Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3965 | `docs/dev/debt/libc.md` [L36](https://github.com/boykopovar/AnyPS5/blob/839d242405aee2c0efa7d167d9fe1a89fd5e1e9d/docs/dev/debt/libc.md#L36) | | | | #5599 | `docs/dev/debt/libc.md` [L35-36](https://github.com/boykopovar/AnyPS5/blob/839d242405aee2c0efa7d167d9fe1a89fd5e1e9d/docs/dev/debt/libc.md#L35-L36) | | | | #5816 | `docs/dev/debt/libc.md` [L36-37](https://github.com/boykopovar/AnyPS5/blob/839d242405aee2c0efa7d167d9fe1a89fd5e1e9d/docs/dev/debt/libc.md#L36-L37) | | |
adriadam10 commented 2026-10-14 13:55:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T13:55:42Z.


Checked the diff against #5596's WindowsMappings code: demote already moves the whole resident run into the section, so dropping the "run extends outside the range" refusal in MapAlias is consistent, and GuestArenaResidentSpan gates the alias path correctly. Linux build and the libSceAgcDriver/libc ctest scope are green (only the pre-existing agc_driver_tessellation segfault on main).

Added one commit: removed "A host import alias over part of a resident run is refused" from the libc debt entry, since this PR makes it false.

The Windows job (full Build dispatch) must be green before merging; merging once it is.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6170039821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6170039821). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T13:55:42Z. --- Checked the diff against #5596's `WindowsMappings` code: `demote` already moves the whole resident run into the section, so dropping the "run extends outside the range" refusal in `MapAlias` is consistent, and `GuestArenaResidentSpan` gates the alias path correctly. Linux build and the libSceAgcDriver/libc ctest scope are green (only the pre-existing `agc_driver_tessellation` segfault on main). Added one commit: removed "A host import alias over part of a resident run is refused" from the libc debt entry, since this PR makes it false. The Windows job (full Build dispatch) must be green before merging; merging once it is.
Sevthered commented 2026-10-14 14:16:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Sevthered on 2026-10-14T14:16:08Z.


Tested on Windows with Astro Bot PPSA21567 v01.019.000 (my own copy, from a repack folder; its fakelib and ampr_emu.index are kept out of app0). Windows 11 (build 26300), Ryzen 7 5800X, RTX 3080 Ti 12 GB (NVIDIA 616.56), 32 GB RAM, system-managed page file, WinLibs GCC 15.2.0 r7, Release. A is main 85f240e3c; B is the same commit with this PR's two commits cherry-picked (they apply cleanly, local commit ad293e25faab), so git diff A B is this PR. Same relinked executable, warm shader cache, no switches.

On A the title is bound by queue worker 0 from the title intro on: 1.3 to 1.9 presents per second for the 200 s it ran there, with [rescache] taking the full walk for 96 % of revalidations (fast-fail by reason: collect) and about 2 GiB of storage uploads per 10 s marked untracked. The full A report is in #357.

With B the logos run at 36 to 50 presents per second instead of 11 to 13, and the title intro and the save-slot menu after it at 8.5 to 10.6 for the 140 s I watched, against 1.3 to 1.9 on A. In that time B reaches the save-slot menu, which A never got to in 300 s. Traces early in the title intro (Team Asobi logo), A by seconds and B by presents because B gets there sooner:

{"commit":"85f240e3c3af","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"115:40"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 616.56","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 115:40","first_present":1015,"ms":40237.740},"presents":70,"frame_ms":{"p50":571.748,"p90":617.035,"p99":688.981,"max":688.981},"gpu_busy_ms_per_present":102.411,"worker_busy_pct":{"queue worker 0x0":99.877,"queue worker 0x40":98.808,"queue worker 0x48":98.701,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":1708.541,"Driver.Packet.memory_wait":1119.404,"Driver.Packet.draw":491.848,"Driver.Draw":491.643,"Driver.Draw.draw_and_resource_release":452.311,"Graphics.Draw":449.294,"Graphics.Draw.draw_and_resource_release":447.230,"Driver.Packet.dispatch":69.105},"trace_dropped":false,"trace":"aps5-trace-85f240e3c3af-1340.json.gz"}
{"commit":"ad293e25faab","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1660:70"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 616.56","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"frames 1660:70","first_present":1660,"ms":5220.057},"presents":70,"frame_ms":{"p50":67.651,"p90":94.209,"p99":106.710,"max":106.710},"gpu_busy_ms_per_present":49.960,"worker_busy_pct":{"queue worker 0x0":99.127,"queue worker 0x40":98.791,"queue worker 0x48":94.712,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":217.952,"Driver.Packet.memory_wait":143.003,"Driver.Packet.draw":36.486,"Driver.Draw":36.364,"Driver.Packet.prepare_memory":24.720,"Driver.Draw.draw_and_resource_release":18.256,"Graphics.Draw":18.009,"Graphics.Draw.draw_and_resource_release":16.852},"trace_dropped":false,"trace":"aps5-trace-ad293e25faab-28332.json.gz"}

Graphics.Draw goes from 449 to 18 ms per frame.

Two costs that may be worth knowing. The first frame comes at 46 and 60 s on B against 10 s on A with the same warm cache. And the working set at the title is 30.5 GB on B against 19.5 GB on A (private bytes 9 to 10 GB against 22.7 GB, so the direct memory now sits in the section). During the second B run the system commit reached 36.8 of 37.7 GB while Windows grew the page file from 2.6 to 5.9 GB. About 15 GB of that was committed by other programs before the start, and I didn't sample commit on A, so I can't say how much of it is the change.

No error or abort in either B run, and the logos and the title intro look as they do on A. I didn't go past the save-slot menu.

GPUs tested here: NVIDIA RTX 3080 Ti, 616.56, Windows 11.

AI-assisted: yes (Claude Code); the runs are from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6170460039 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6170460039). Originally posted by [Sevthered](https://github.com/Sevthered) on 2026-10-14T14:16:08Z. --- Tested on Windows with Astro Bot PPSA21567 v01.019.000 (my own copy, from a repack folder; its `fakelib` and `ampr_emu.index` are kept out of `app0`). Windows 11 (build 26300), Ryzen 7 5800X, RTX 3080 Ti 12 GB (NVIDIA 616.56), 32 GB RAM, system-managed page file, WinLibs GCC 15.2.0 r7, Release. A is `main` `85f240e3c`; B is the same commit with this PR's two commits cherry-picked (they apply cleanly, local commit `ad293e25faab`), so `git diff A B` is this PR. Same relinked executable, warm shader cache, no switches. On A the title is bound by queue worker 0 from the title intro on: 1.3 to 1.9 presents per second for the 200 s it ran there, with `[rescache]` taking the full walk for 96 % of revalidations (`fast-fail by reason: collect`) and about 2 GiB of storage uploads per 10 s marked `untracked`. The full A report is in #357. With B the logos run at 36 to 50 presents per second instead of 11 to 13, and the title intro and the save-slot menu after it at 8.5 to 10.6 for the 140 s I watched, against 1.3 to 1.9 on A. In that time B reaches the save-slot menu, which A never got to in 300 s. Traces early in the title intro (Team Asobi logo), A by seconds and B by presents because B gets there sooner: ``` {"commit":"85f240e3c3af","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"115:40"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 616.56","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"seconds 115:40","first_present":1015,"ms":40237.740},"presents":70,"frame_ms":{"p50":571.748,"p90":617.035,"p99":688.981,"max":688.981},"gpu_busy_ms_per_present":102.411,"worker_busy_pct":{"queue worker 0x0":99.877,"queue worker 0x40":98.808,"queue worker 0x48":98.701,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":1708.541,"Driver.Packet.memory_wait":1119.404,"Driver.Packet.draw":491.848,"Driver.Draw":491.643,"Driver.Draw.draw_and_resource_release":452.311,"Graphics.Draw":449.294,"Graphics.Draw.draw_and_resource_release":447.230,"Driver.Packet.dispatch":69.105},"trace_dropped":false,"trace":"aps5-trace-85f240e3c3af-1340.json.gz"} {"commit":"ad293e25faab","dirty":false,"env":{"APS5_TRACE_DIR":"<path>","APS5_TRACE_FRAMES":"1660:70"},"gpu":"NVIDIA GeForce RTX 3080 Ti","driver":"NVIDIA 616.56","os":"Windows 10.0.26300","resolution":"3840x2160","window":{"spec":"frames 1660:70","first_present":1660,"ms":5220.057},"presents":70,"frame_ms":{"p50":67.651,"p90":94.209,"p99":106.710,"max":106.710},"gpu_busy_ms_per_present":49.960,"worker_busy_pct":{"queue worker 0x0":99.127,"queue worker 0x40":98.791,"queue worker 0x48":94.712,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":217.952,"Driver.Packet.memory_wait":143.003,"Driver.Packet.draw":36.486,"Driver.Draw":36.364,"Driver.Packet.prepare_memory":24.720,"Driver.Draw.draw_and_resource_release":18.256,"Graphics.Draw":18.009,"Graphics.Draw.draw_and_resource_release":16.852},"trace_dropped":false,"trace":"aps5-trace-ad293e25faab-28332.json.gz"} ``` `Graphics.Draw` goes from 449 to 18 ms per frame. Two costs that may be worth knowing. The first frame comes at 46 and 60 s on B against 10 s on A with the same warm cache. And the working set at the title is 30.5 GB on B against 19.5 GB on A (private bytes 9 to 10 GB against 22.7 GB, so the direct memory now sits in the section). During the second B run the system commit reached 36.8 of 37.7 GB while Windows grew the page file from 2.6 to 5.9 GB. About 15 GB of that was committed by other programs before the start, and I didn't sample commit on A, so I can't say how much of it is the change. No error or abort in either B run, and the logos and the title intro look as they do on A. I didn't go past the save-slot menu. GPUs tested here: NVIDIA RTX 3080 Ti, 616.56, Windows 11. AI-assisted: yes (Claude Code); the runs are from my machine.
Pipodi commented 2026-10-14 14:16:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-14T14:16:31Z.


Please hold this one: a 25-minute run of Ghost of Yōtei with it crashed when an APR file read failed (_readFile, std::ios_base::failure from the stream). The likely cause is a race this change makes common: demote() fences a resident run read-only and then replaces its pages with section views, without waiting for host writes that are in flight on those pages (an APR or file read between BeginHostWrite and EndHostWrite). Such a write can fail, or land in the private pages after they were copied and be lost. A second mapping already had this race, but it was rare.

I'm moving it to draft while I make MapAlias wait for open host writes on the runs it demotes, and will mark it ready again after a long run passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6170467887 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6170467887). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-14T14:16:31Z. --- Please hold this one: a 25-minute run of Ghost of Yōtei with it crashed when an APR file read failed (`_readFile`, `std::ios_base::failure` from the stream). The likely cause is a race this change makes common: `demote()` fences a resident run read-only and then replaces its pages with section views, without waiting for host writes that are in flight on those pages (an APR or file read between `BeginHostWrite` and `EndHostWrite`). Such a write can fail, or land in the private pages after they were copied and be lost. A second mapping already had this race, but it was rare. I'm moving it to draft while I make `MapAlias` wait for open host writes on the runs it demotes, and will mark it ready again after a long run passes.
Pipodi commented 2026-10-14 14:43:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-14T14:43:59Z.


Pushed 22091410a on top of your docs commit, for the race above. MapAlias now returns null, without demoting anything, when a page of a run it would demote has a host write open (between BeginHostWrite and EndHostWrite). The driver then imports that range without an alias, as it did before this PR, and the next import of the range can take the alias once the write has ended. MapAlias does not wait for the write, because some host writes block: sceNetRecv holds one across ::recv.

CheckAliasLeavesResidentRunsUnderAHostWrite in tests/GuestMemory.cpp holds a host write open on one page of a two-page resident run. It checks that MapAlias leaves the run as it is and that a byte written during the host write survives the later demotion. It fails without the guard, at the MapAlias(...) == nullptr check.

A Ghost of Yōtei run with both commits had no failed APR read through the loading screen, 1,104 s in. It then stopped at present 841 on "guest buffer view ... exceeds its GPU owner ... (direct 1)", the same abort as a main-based run without this PR at present 829. That abort comes from something else, and I'll look at it separately.

Marking this ready again.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6171032777 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6171032777). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-14T14:43:59Z. --- Pushed 22091410a on top of your docs commit, for the race above. `MapAlias` now returns null, without demoting anything, when a page of a run it would demote has a host write open (between `BeginHostWrite` and `EndHostWrite`). The driver then imports that range without an alias, as it did before this PR, and the next import of the range can take the alias once the write has ended. `MapAlias` does not wait for the write, because some host writes block: `sceNetRecv` holds one across `::recv`. `CheckAliasLeavesResidentRunsUnderAHostWrite` in `tests/GuestMemory.cpp` holds a host write open on one page of a two-page resident run. It checks that `MapAlias` leaves the run as it is and that a byte written during the host write survives the later demotion. It fails without the guard, at the `MapAlias(...) == nullptr` check. A Ghost of Yōtei run with both commits had no failed APR read through the loading screen, 1,104 s in. It then stopped at present 841 on "guest buffer view ... exceeds its GPU owner ... (direct 1)", the same abort as a `main`-based run without this PR at present 829. That abort comes from something else, and I'll look at it separately. Marking this ready again.
EagleBearerYS commented 2026-10-14 14:48:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T14:48:43Z.


Resident Evil Village (PPSA01556, 01.210.000) with this PR, at the title on current main. Windows 11 Home 10.0.26300, RTX 3070 Laptop (driver 617.42), Ryzen 9 5900HS.

It boots without #5688. main without #5688 aborts 19-48 s in with an address-based build copies 419 MiB .... With this PR instead, there's no abort and no other fatal error in 16 minutes, and it reaches the title.

The last 5 minutes at the title, 30 reports on each side, the same save and inputs, warm shader caches, APS5_PROFILE_DRAW=1:

this PR, without #5688 #5688, without this PR
presents per 10 s 11-12 (mean 11.5) 1-2 (mean 1.7)
[guestmem] compare over the 5 min 0 calls, 0 MiB, 0 s 121,759 calls, 329,264 MiB, 34.7 s
[address] per 10 s 6,221-6,362 builds, compare 0 us per build 580-589 builds, compare 6,394-6,542 us per build (1,292 blocks)
draw packets per 10 s, driver us per packet about 8,700 at about 900 about 830 at about 7,150

So with this PR the title runs about 6.6 times as many frames, and the CPU compares in [guestmem] and the address space drop to zero. This is the title screen only; the first 3D scene isn't measured yet.

Setup: main 23be5a02b with #5703 and #5815, plus local commits that prepare shaders at their first draw (APS5_RE8_LAZY_PREPARE=1, with APS5_NO_GPL=1) and fix later stops. The two sides differ only in this PR versus #5688's three commits. The [guestmem] counters are running totals, so the 5-minute figures are differences between reports.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6171130227 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6171130227). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T14:48:43Z. --- Resident Evil Village (PPSA01556, 01.210.000) with this PR, at the title on current `main`. Windows 11 Home 10.0.26300, RTX 3070 Laptop (driver 617.42), Ryzen 9 5900HS. It boots without #5688. `main` without #5688 aborts 19-48 s in with `an address-based build copies 419 MiB ...`. With this PR instead, there's no abort and no other fatal error in 16 minutes, and it reaches the title. The last 5 minutes at the title, 30 reports on each side, the same save and inputs, warm shader caches, `APS5_PROFILE_DRAW=1`: | | this PR, without #5688 | #5688, without this PR | |---|---|---| | presents per 10 s | 11-12 (mean 11.5) | 1-2 (mean 1.7) | | `[guestmem]` compare over the 5 min | 0 calls, 0 MiB, 0 s | 121,759 calls, 329,264 MiB, 34.7 s | | `[address]` per 10 s | 6,221-6,362 builds, compare 0 us per build | 580-589 builds, compare 6,394-6,542 us per build (1,292 blocks) | | draw packets per 10 s, driver us per packet | about 8,700 at about 900 | about 830 at about 7,150 | So with this PR the title runs about 6.6 times as many frames, and the CPU compares in `[guestmem]` and the address space drop to zero. This is the title screen only; the first 3D scene isn't measured yet. Setup: `main` 23be5a02b with #5703 and #5815, plus local commits that prepare shaders at their first draw (`APS5_RE8_LAZY_PREPARE=1`, with `APS5_NO_GPL=1`) and fix later stops. The two sides differ only in this PR versus #5688's three commits. The `[guestmem]` counters are running totals, so the 5-minute figures are differences between reports.
EagleBearerYS commented 2026-10-14 15:28:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T15:28:19Z.


For the record, the Village runs above used 59b49aac0, before 22091410a.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6171930061 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6171930061). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T15:28:19Z. --- For the record, the Village runs above used 59b49aac0, before 22091410a.
kjhq commented 2026-10-14 15:36:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kjhq on 2026-10-14T15:36:40Z.


Tested on Sifu (PPSA03001, Unreal Engine 4, #5908), together with #5906. Windows 11 (build 26300), NVIDIA GeForce RTX 2070 (610.88), MinGW GCC 15.2.0, main 8dfaafe62, APS5_PROFILE_DRAW=1. Same title screen, 200 s runs.

main + #5906 main + #5906 + #5851
draws recorded per 10 s on queue 0 19,000-30,000 89,000-90,000
average recorded draw 243-398 µs 49 µs
resource-cache revalidations 305,026 in 35.5 s, 51,359 failed (fast-fail reason: collect 139,963) 623,287 in 3.3 s, 867 failed (no collect fast-fails)
draw templates invalidated per 10 s about 4,700 0
title screen frame rate 0.47 FPS 2.94 FPS

So on this title most of the remaining queue-0 cost was compared (unwatched) direct-memory imports: template revalidation failed on collect and rebuilt the draw's resources. With this PR those ranges stay write-tracked. I saw no new errors or aborts in the log.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6172099943 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6172099943). Originally posted by [kjhq](https://github.com/kjhq) on 2026-10-14T15:36:40Z. --- Tested on Sifu (PPSA03001, Unreal Engine 4, #5908), together with #5906. Windows 11 (build 26300), NVIDIA GeForce RTX 2070 (610.88), MinGW GCC 15.2.0, main 8dfaafe62, `APS5_PROFILE_DRAW=1`. Same title screen, 200 s runs. | | main + #5906 | main + #5906 + #5851 | |---|---|---| | draws recorded per 10 s on queue 0 | 19,000-30,000 | 89,000-90,000 | | average recorded draw | 243-398 µs | 49 µs | | resource-cache revalidations | 305,026 in 35.5 s, 51,359 failed (fast-fail reason: collect 139,963) | 623,287 in 3.3 s, 867 failed (no collect fast-fails) | | draw templates invalidated per 10 s | about 4,700 | 0 | | title screen frame rate | 0.47 FPS | 2.94 FPS | So on this title most of the remaining queue-0 cost was compared (unwatched) direct-memory imports: template revalidation failed on `collect` and rebuilt the draw's resources. With this PR those ranges stay write-tracked. I saw no new errors or aborts in the log.
EagleBearerYS commented 2026-10-14 15:45:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T15:45:04Z.


The same Village A/B on this PR's current head, 22091410a: the gain holds. The last 5 minutes at the title, warm cache, the same setup as above, plus a frame-trace aid that was switched off:

  • 8-11 presents per 10 s (mean 10.0), against 1-2 (mean 1.7) with #5688 instead;
  • [guestmem] and the address-based builds compare nothing;
  • about 7,600 draw packets per 10 s, at about 1,040 us each.

No ios_base or _readFile failure, and no fatal error, in 12 minutes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6172272192 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6172272192). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T15:45:04Z. --- The same Village A/B on this PR's current head, 22091410a: the gain holds. The last 5 minutes at the title, warm cache, the same setup as above, plus a frame-trace aid that was switched off: - 8-11 presents per 10 s (mean 10.0), against 1-2 (mean 1.7) with #5688 instead; - `[guestmem]` and the address-based builds compare nothing; - about 7,600 draw packets per 10 s, at about 1,040 us each. No `ios_base` or `_readFile` failure, and no fatal error, in 12 minutes.
Pipodi commented 2026-10-14 17:08:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-14T17:08:24Z.


@Sevthered thanks for the Astro Bot numbers. I measured the first-frame and memory cost on Ghost of Yōtei, to see whether it comes from the demotion.

Setup: three 300 s boots from the same warm cache on Windows (RTX 4090, i9-13900K), identical except for this PR.

  • The demotion was instrumented to count runs, bytes and zero pages, and to time the copy into the section and the per-page remapping.
  • The instrumentation lives only in our local build.
without this PR with this PR
first lit frame 80 s 40 s
peak private memory 35.0 GB 24.0 GB
moved into the section before the first frame – 4.1 GiB in 2,817 runs, 99.7 % zero pages
demotion time before the first frame – 4.0 s (copy 2.3 s, remapping 1.7 s)

On this title the demotion costs about 4 s and the change saves about 40 s and 11 GB, so it doesn't explain what you saw on Astro Bot.

One candidate: before #5698 (merged today), a watched import first copied its whole range, to compare pages when its window closed. With this PR, Astro Bot's direct memory takes that watched path, so on a base without #5698 its imports were copied in full. Your test predates #5698.

If you have time, could you rerun Astro Bot on current main with this PR applied? It would show whether the first-frame delay and the working set are still there.

Separately, the demotion copies every page of a run, although almost all of them are zero. I have a follow-up that copies only nonzero pages. It brings the copy before Yōtei's first frame from 2.3 s to 1.1 s, and I'll open it after this PR merges.

Measured and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6173913464 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6173913464). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-14T17:08:24Z. --- @Sevthered thanks for the Astro Bot numbers. I measured the first-frame and memory cost on Ghost of Yōtei, to see whether it comes from the demotion. Setup: three 300 s boots from the same warm cache on Windows (RTX 4090, i9-13900K), identical except for this PR. - The demotion was instrumented to count runs, bytes and zero pages, and to time the copy into the section and the per-page remapping. - The instrumentation lives only in our local build. | | without this PR | with this PR | |---|---|---| | first lit frame | 80 s | 40 s | | peak private memory | 35.0 GB | 24.0 GB | | moved into the section before the first frame | – | 4.1 GiB in 2,817 runs, 99.7 % zero pages | | demotion time before the first frame | – | 4.0 s (copy 2.3 s, remapping 1.7 s) | On this title the demotion costs about 4 s and the change saves about 40 s and 11 GB, so it doesn't explain what you saw on Astro Bot. One candidate: before #5698 (merged today), a watched import first copied its whole range, to compare pages when its window closed. With this PR, Astro Bot's direct memory takes that watched path, so on a base without #5698 its imports were copied in full. Your test predates #5698. If you have time, could you rerun Astro Bot on current `main` with this PR applied? It would show whether the first-frame delay and the working set are still there. Separately, the demotion copies every page of a run, although almost all of them are zero. I have a follow-up that copies only nonzero pages. It brings the copy before Yōtei's first frame from 2.3 s to 1.1 s, and I'll open it after this PR merges. *Measured and written by Claude (AI assistant) on a contributor's machine.*
parl0v commented 2026-10-14 17:54:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-14T17:54:47Z.


Measured on a second title: PPSA25344 (Sword of the Sea, UE5), title screen. It recovers what #5596 cost there, and the image is unchanged. It also brings back the #361 red-zone crash on this title, in 1 of 6 runs.

What #5596 cost, as a merge-boundary A/B (box 2: RTX 3060, i5-12400F, 32 GB, NVIDIA 617.42, Windows 10; one relinked executable, libraries from 0a56aaaf4 = main just before the merge vs 3e4fe4ce3 = the merge, 3 alternating rounds × 300 s, mean of the last twelve 10 s windows):

before #5596 #5596 merge
FPS 8.14 / 8.12 / 8.12 2.08 / 2.09 / 2.10
[guestmem] compare per 10 s 1 call ~579,500 calls, 2.2 TB, 166 s
[storage] uploads, reason untracked 0 ~1,020 (5.4 GB)

This PR, main f0854887d vs f0854887d + this PR (22091410a), same executable, alternating:

main + this PR
Box 2 (RTX 3060), 3 × 300 s 3.70 / 3.70 / 3.70 FPS, GPU 105 ms/present 9.10 / 9.10 / 9.10 FPS, GPU 90 ms/present
[guestmem] compare per 10 s ~367,000 calls, 1.26 TB, 97 s 1 call
readTarget per 10 s 1,559 ms 120 ms
[storage] untracked uploads ~1,820 (9.7 GB) 0
Box 1 (RTX 4060, i5-14400F, 16 GB), 2 × 200 s 2.70 / 2.70 FPS 7.14 / 7.18 FPS

Frame dumps (box 2, frame 2 of the title): mean difference 0.13 of 255 between main and this PR, 0.12 between two main runs.

The crash: one of the six runs with this PR (box 1, ~170 s in, on a game worker thread) stopped at app.exe+0x37f77b3, read of 0x740. That's the same leaf as SotS's boot crash before #5596 (#361, also hit by the pre-#5596 build in 1 of 4 boots today). With the alias imports, the GPU-imported direct memory is a section view tracked by write faults again, and those faults clobber the red zone. 0 in 3 main runs and in 4 runs of this PR on box 2. So this is the trade between #5596 and #5851 on this title: about 2.5× the frame rate back, and some of the fault exposure back with it.

cc @AlxcBTW (SotS working group)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6174794505 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6174794505). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-14T17:54:47Z. --- Measured on a second title: **PPSA25344 (Sword of the Sea, UE5)**, title screen. It recovers what #5596 cost there, and the image is unchanged. It also brings back the #361 red-zone crash on this title, in 1 of 6 runs. **What #5596 cost**, as a merge-boundary A/B (box 2: RTX 3060, i5-12400F, 32 GB, NVIDIA 617.42, Windows 10; one relinked executable, libraries from `0a56aaaf4` = `main` just before the merge vs `3e4fe4ce3` = the merge, 3 alternating rounds × 300 s, mean of the last twelve 10 s windows): | | before #5596 | #5596 merge | |---|---|---| | FPS | 8.14 / 8.12 / 8.12 | 2.08 / 2.09 / 2.10 | | `[guestmem]` compare per 10 s | 1 call | ~579,500 calls, 2.2 TB, 166 s | | `[storage]` uploads, reason `untracked` | 0 | ~1,020 (5.4 GB) | **This PR**, `main` `f0854887d` vs `f0854887d` + this PR (`22091410a`), same executable, alternating: | | `main` | + this PR | |---|---|---| | Box 2 (RTX 3060), 3 × 300 s | 3.70 / 3.70 / 3.70 FPS, GPU 105 ms/present | **9.10 / 9.10 / 9.10 FPS**, GPU 90 ms/present | | `[guestmem]` compare per 10 s | ~367,000 calls, 1.26 TB, 97 s | 1 call | | `readTarget` per 10 s | 1,559 ms | 120 ms | | `[storage]` `untracked` uploads | ~1,820 (9.7 GB) | 0 | | Box 1 (RTX 4060, i5-14400F, 16 GB), 2 × 200 s | 2.70 / 2.70 FPS | **7.14 / 7.18 FPS** | Frame dumps (box 2, frame 2 of the title): mean difference 0.13 of 255 between `main` and this PR, 0.12 between two `main` runs. **The crash:** one of the six runs with this PR (box 1, ~170 s in, on a game worker thread) stopped at `app.exe+0x37f77b3`, `read of 0x740`. That's the same leaf as SotS's boot crash before #5596 (#361, also hit by the pre-#5596 build in 1 of 4 boots today). With the alias imports, the GPU-imported direct memory is a section view tracked by write faults again, and those faults clobber the red zone. 0 in 3 `main` runs and in 4 runs of this PR on box 2. So this is the trade between #5596 and #5851 on this title: about 2.5× the frame rate back, and some of the fault exposure back with it. cc @AlxcBTW (SotS working group)
Sevthered commented 2026-10-14 18:17:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Sevthered on 2026-10-14T18:17:26Z.


@Pipodi reran it on current main 763ad20fc, which has #5698, with this PR's three commits cherry-picked (they apply cleanly). Same machine, run folder, relinked executable, save and warm cache as before; runs alternate between builds, each started after the previous process exited and free memory was back above 16 GB.

main main + this PR
first frame 11, 11 s 44, 44, 45, 44, 49 s
working set at 80 s 18.0 GB 29.3 to 29.7 GB
private bytes at 80 s 19.9 GB 7.1 to 8.3 GB

So with #5698 the delay and the larger working set are both still there on Astro Bot. Timing put around demote in a local build (not for merging) shows where the delay goes: 6144 runs, 12 GiB, 98.3 % of the 4 KiB pages zero, 15.6 s copying and 14.1 s remapping before the first frame, so about 30 of the 33 extra seconds. On this 5800X that is about 2.5 s per GiB against your 1 s per GiB on Yōtei, which would explain why it shows here and not there.

I have a commit for it on my fork: github.com/Sevthered/AnyPS5@2c87d02b4 (branch perf/demote-resident-run, on this PR's head). It does two things in demote:

  • it copies only nonzero pages whose slot was never stored, the same idea as your follow-up;
  • after the run's private pages are released, it splits each page off the run's placeholder with one VirtualFree instead of split(), which queries the allocation twice per page (the last page keeps split() as a check). mapShared and the layout, one view per page, are unchanged.

With it, on the same current main + this PR: demote 17.2 s (7.9 s copying, 9.3 s remapping) and the first frame at 32, 33 and 36 s against 44, 44 and 45 s in alternating runs. The full suite passes on it (1184 of 1184, Windows). I also tried mapping a demoted run as one view (remapping drops to 0.7 s), but a later unmap or protection change of part of the run would have to unmap the whole view, and a host write in flight elsewhere in the run would not survive that, the same race as 22091410a, so it isn't in the commit.

Since your follow-up covers the nonzero copy: would you like me to open this as a follow-up PR that depends on this one, or would you rather take the remapping part into yours? Either is fine with me.

One more data point: booting with the game's -lvl hub_crashsite works with this PR. Crash Site renders correctly (banner, HUD, Astro) at about 3 fps, after a loading screen that stays black for a few minutes.

AI-assisted: yes (Claude Code); the runs are from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175218716 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6175218716). Originally posted by [Sevthered](https://github.com/Sevthered) on 2026-10-14T18:17:26Z. --- @Pipodi reran it on current `main` `763ad20fc`, which has #5698, with this PR's three commits cherry-picked (they apply cleanly). Same machine, run folder, relinked executable, save and warm cache as before; runs alternate between builds, each started after the previous process exited and free memory was back above 16 GB. | | `main` | `main` + this PR | |---|---|---| | first frame | 11, 11 s | 44, 44, 45, 44, 49 s | | working set at 80 s | 18.0 GB | 29.3 to 29.7 GB | | private bytes at 80 s | 19.9 GB | 7.1 to 8.3 GB | So with #5698 the delay and the larger working set are both still there on Astro Bot. Timing put around `demote` in a local build (not for merging) shows where the delay goes: 6144 runs, 12 GiB, 98.3 % of the 4 KiB pages zero, 15.6 s copying and 14.1 s remapping before the first frame, so about 30 of the 33 extra seconds. On this 5800X that is about 2.5 s per GiB against your 1 s per GiB on Yōtei, which would explain why it shows here and not there. I have a commit for it on my fork: https://github.com/Sevthered/AnyPS5/commit/2c87d02b4 (branch `perf/demote-resident-run`, on this PR's head). It does two things in `demote`: - it copies only nonzero pages whose slot was never stored, the same idea as your follow-up; - after the run's private pages are released, it splits each page off the run's placeholder with one `VirtualFree` instead of `split()`, which queries the allocation twice per page (the last page keeps `split()` as a check). `mapShared` and the layout, one view per page, are unchanged. With it, on the same current `main` + this PR: `demote` 17.2 s (7.9 s copying, 9.3 s remapping) and the first frame at 32, 33 and 36 s against 44, 44 and 45 s in alternating runs. The full suite passes on it (1184 of 1184, Windows). I also tried mapping a demoted run as one view (remapping drops to 0.7 s), but a later unmap or protection change of part of the run would have to unmap the whole view, and a host write in flight elsewhere in the run would not survive that, the same race as 22091410a, so it isn't in the commit. Since your follow-up covers the nonzero copy: would you like me to open this as a follow-up PR that depends on this one, or would you rather take the remapping part into yours? Either is fine with me. One more data point: booting with the game's `-lvl hub_crashsite` works with this PR. Crash Site renders correctly (banner, HUD, Astro) at about 3 fps, after a loading screen that stays black for a few minutes. AI-assisted: yes (Claude Code); the runs are from my machine.
EagleBearerYS commented 2026-10-14 18:23:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T18:23:15Z.


Village's write faults with this PR, for the trade parl0v describes above. Run on Resident Evil Village (PPSA01556, 01.210.000), Windows 11 Home 10.0.26300, RTX 3070 Laptop (driver 617.42), Ryzen 9 5900HS.

Setup:

  • main 23be5a02b, which is before #5698;
  • this PR at 22091410a (its three commits), three commits from #5761 and #5815's two;
  • local commits that prepare shaders at their first draw and fix later stops;
  • two local debug aids: a counter of the write faults the handler resumes, and a registry of the runs MapAlias moves into sections.

The executable was relinked with a local red-zone framer (a workaround, not for merging). No stop in this run.

write faults resumed in runs MapAlias moved (at least) runs moved
at the title 52,257 12,128 12,786
first control in the first 3D scene 625,011 253,554 20,130
about 2 minutes later 719,334 292,479 –
  • In the 3D scene, the counter's 10 s summaries show about 10,000 faults each.
  • "At least": the registry kept only the first 4,096 moved runs, so a fault in a run moved after that counts as outside. The two largest regions below aren't attributed yet.
  • By thread at first control: AudioOutputThread 293,330; MovieBuffering 60,136; AK::EventManager 34,075; an unnamed thread 30,045; two JobThread(High) threads, 29,892 and 22,697. Up to the title: MovieBuffering 32,646; an unnamed thread 4,918; Renderer::DelayEndTask 4,893; GameThread 2,945.
  • By 64 MiB region at first control: 0x25c000000 264,912; 0x230000000 232,131; 0x260000000 30,586; 0x2018000000 24,255; 0x210c000000 16,320; 0x2108000000 14,293.

Separately, without the framer, Wwise's AK::EventManager thread stopped during the scene load in 1 of 4 scene loads today: 0xc0000005, a read of 0xffffffffffffffff in a list walk. 10 of 10 scene loads with the framer, from yesterday and today, were clean. That matches the #361 class parl0v reports on Sword of the Sea.

A full attribution, with every moved run, on a base with #5698 follows. If you try a variant that avoids these faults, I can run it on Village.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175327315 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6175327315). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T18:23:15Z. --- Village's write faults with this PR, for the trade parl0v describes above. Run on Resident Evil Village (PPSA01556, 01.210.000), Windows 11 Home 10.0.26300, RTX 3070 Laptop (driver 617.42), Ryzen 9 5900HS. Setup: - `main` 23be5a02b, which is before #5698; - this PR at 22091410a (its three commits), three commits from #5761 and #5815's two; - local commits that prepare shaders at their first draw and fix later stops; - two local debug aids: a counter of the write faults the handler resumes, and a registry of the runs `MapAlias` moves into sections. The executable was relinked with a local red-zone framer (a workaround, not for merging). No stop in this run. | | write faults resumed | in runs `MapAlias` moved (at least) | runs moved | |---|---|---|---| | at the title | 52,257 | 12,128 | 12,786 | | first control in the first 3D scene | 625,011 | 253,554 | 20,130 | | about 2 minutes later | 719,334 | 292,479 | – | - In the 3D scene, the counter's 10 s summaries show about 10,000 faults each. - "At least": the registry kept only the first 4,096 moved runs, so a fault in a run moved after that counts as outside. The two largest regions below aren't attributed yet. - By thread at first control: AudioOutputThread 293,330; MovieBuffering 60,136; AK::EventManager 34,075; an unnamed thread 30,045; two JobThread(High) threads, 29,892 and 22,697. Up to the title: MovieBuffering 32,646; an unnamed thread 4,918; Renderer::DelayEndTask 4,893; GameThread 2,945. - By 64 MiB region at first control: 0x25c000000 264,912; 0x230000000 232,131; 0x260000000 30,586; 0x2018000000 24,255; 0x210c000000 16,320; 0x2108000000 14,293. Separately, without the framer, Wwise's `AK::EventManager` thread stopped during the scene load in 1 of 4 scene loads today: 0xc0000005, a read of 0xffffffffffffffff in a list walk. 10 of 10 scene loads with the framer, from yesterday and today, were clean. That matches the #361 class parl0v reports on Sword of the Sea. A full attribution, with every moved run, on a base with #5698 follows. If you try a variant that avoids these faults, I can run it on Village.
Pipodi commented 2026-10-14 18:40:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-14T18:40:36Z.


I'm working on the demotion cost (@Sevthered) and the write faults it brings back (@parl0v, @EagleBearerYS), so please don't start a separate fix for them. I'll post results here tomorrow.

The approach is to keep private direct memory write-watched through a direct import, with no section alias. That would avoid the demotion and its write faults altogether.

  • Windows compares direct imports because of #1434: the NVIDIA driver marked imported pages of shared views as written after the import.
  • With #5596, direct memory mapped at one address is private MEM_WRITE_WATCH memory. A standalone probe on an RTX 4090 (NVIDIA 617.42) imported such memory with VK_EXT_external_memory_host. The import marks every page, but only during vkAllocateMemory itself, inside ImportWatched's window. After a reset there were no marks over 1 s: none idle, none after GPU reads, none after GPU writes, in 3 rounds. CPU writes were reported exactly.
  • So those imports may be able to stay watched as they are. Shared views would still be compared, and a startup probe would make the decision per device, since other drivers may differ.

@Sevthered, could you hold your demote follow-up until then? If this works, demotion may not be needed. If it doesn't, your commit is the way to make it cheaper. Your rerun also showed that #5698 doesn't explain the delay, as I had suggested; thanks for the timing.

Written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175652080 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6175652080). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-14T18:40:36Z. --- I'm working on the demotion cost (@Sevthered) and the write faults it brings back (@parl0v, @EagleBearerYS), so please don't start a separate fix for them. I'll post results here tomorrow. The approach is to keep private direct memory write-watched through a direct import, with no section alias. That would avoid the demotion and its write faults altogether. - Windows compares direct imports because of #1434: the NVIDIA driver marked imported pages of shared views as written after the import. - With #5596, direct memory mapped at one address is private `MEM_WRITE_WATCH` memory. A standalone probe on an RTX 4090 (NVIDIA 617.42) imported such memory with `VK_EXT_external_memory_host`. The import marks every page, but only during `vkAllocateMemory` itself, inside `ImportWatched`'s window. After a reset there were no marks over 1 s: none idle, none after GPU reads, none after GPU writes, in 3 rounds. CPU writes were reported exactly. - So those imports may be able to stay watched as they are. Shared views would still be compared, and a startup probe would make the decision per device, since other drivers may differ. @Sevthered, could you hold your `demote` follow-up until then? If this works, demotion may not be needed. If it doesn't, your commit is the way to make it cheaper. Your rerun also showed that #5698 doesn't explain the delay, as I had suggested; thanks for the timing. *Written by Claude (AI assistant) on a contributor's machine.*
AnzouBelilita commented 2026-10-14 18:40:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AnzouBelilita on 2026-10-14T18:40:40Z.


Independent local validation on PR head 22091410a602030a23d9dc33819f57cc38daab69 (Windows 10, Intel Core i5-4570, Radeon RX 580, MinGW-w64 GCC 16.2):

  • ctest --repeat until-fail:25 -R "^guest_memory$" --output-on-failure: 25/25 passed (about 74.7 s total).
  • tests\agc_driver_recorder_tests.exe --host-import-second-mapping-only: 25/25 passed (loop exit code 0); output reported that host imports are compared and separate shared aliases retain guest write tracking.
  • git diff --check: passed; the review checkout remains clean.

This is a repeatability check on the PR head, not a main-vs-PR performance benchmark, and the local RX 580 results do not independently verify the reported NVIDIA game-performance gains. I did not rerun the full unregistered agc_driver_recorder_tests.exe suite; its documented keyProofTests failure is reported in this PR as also occurring on main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175653345 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6175653345). Originally posted by [AnzouBelilita](https://github.com/AnzouBelilita) on 2026-10-14T18:40:40Z. --- Independent local validation on PR head `22091410a602030a23d9dc33819f57cc38daab69` (Windows 10, Intel Core i5-4570, Radeon RX 580, MinGW-w64 GCC 16.2): - `ctest --repeat until-fail:25 -R "^guest_memory$" --output-on-failure`: 25/25 passed (about 74.7 s total). - `tests\agc_driver_recorder_tests.exe --host-import-second-mapping-only`: 25/25 passed (loop exit code 0); output reported that host imports are compared and separate shared aliases retain guest write tracking. - `git diff --check`: passed; the review checkout remains clean. This is a repeatability check on the PR head, not a main-vs-PR performance benchmark, and the local RX 580 results do not independently verify the reported NVIDIA game-performance gains. I did not rerun the full unregistered `agc_driver_recorder_tests.exe` suite; its documented `keyProofTests` failure is reported in this PR as also occurring on main.
EagleBearerYS commented 2026-10-14 18:44:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T18:44:48Z.


Thanks, we won't start one. When your variant is up, I'll run the same Village count on it: write faults by thread and region, and scene loads without the framer.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175731366 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6175731366). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-14T18:44:48Z. --- Thanks, we won't start one. When your variant is up, I'll run the same Village count on it: write faults by thread and region, and scene loads without the framer.
parl0v commented 2026-10-14 18:53:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-14T18:53:37Z.


A variant that keeps these imports write-tracked without moving runs into the section, so no views, no demotion and no write faults. Measured on Sword of the Sea; one question is open before it can be a PR.

Why it can work: on Windows, a host import without an alias leaves guest write tracking (watchedHostPointer = entry.alias != nullptr || !state.unwatchImports, and unwatchImports is always true there; ProbeImportWriteProtection returns "the Linux write watch"). Since #5596 the memory behind these imports is private MEM_WRITE_WATCH memory, so GetWriteWatch could keep tracking it if an import doesn't break it. A standalone probe (import MEM_WRITE_WATCH memory with VK_EXT_external_memory_host, then GPU reads, GPU writes and CPU stores, collecting GetWriteWatch with reset after each step) gives the same result on an RTX 3060 and an RTX 4060, NVIDIA 617.42, 16 and 4,096 pages:

step pages reported written
after the import all
after the first GPU read (also with a 4-byte read) all
after the 2nd, 3rd, 4th GPU read 0
after a GPU fill / a GPU copy into the import 0 (the fill is visible to the CPU)
after CPU stores to 2 pages 2
a CPU store after a GPU read 1

So CPU stores stay exactly reported, and GPU writes are invisible to it (the driver stamps its own). The noise is a one-time mark of every page. It's asynchronous: in three runs, 1,632–3,033 of 4,096 pages were marked before any submit, the rest by the first GPU use completing. Nothing after that.

Experiment: with APS5_EXP_WATCH_PRIVATE_IMPORTS=1, a direct import of all-private read-write memory stays watched (|| (writable && GuestMemory::WriteWatched()), staysWatched in ImportWatched). Same binary (main f0854887d + the 3-line change), env off vs on, alternating:

env off (main behaviour) env on this PR (from my run above)
Box 2 (RTX 3060), 300 s rows 3.70 / 3.68 / 3.69 FPS 8.90 / 8.76 / 8.90 / 8.88 / 8.90 9.10
Box 1 (RTX 4060), 200 s rows 2.70 / 2.70 7.00 / 7.05 / 7.09 / 7.04 7.14 / 7.18
[guestmem] compare per 10 s 158k–366k calls, 0.56–1.26 TB 1–2 calls 1 call
readTarget per 10 s (box 2) ~1,550 ms ~181 ms 120 ms
crashes at +0x37f77b3 0 / 5 0 / 9 1 / 6

Frame dumps: mean difference 0.13 env on vs off, 0.13 between two off runs. About 97–98 % of this PR's frame rate, with nothing moved into a section.

Open question: the one-time marks after the import. ImportWatched's window filters the ones that land inside it (saved copy, compare). The rest arrive later and get stamped as CPU stores on unchanged bytes. Where storage-image results are pending over such a range, a spurious CPU stamp could make a refresh prefer guest memory. I tried closing the window after a 4-byte GPU read of the new import, which settles the marks in the probe. But importAllocation runs under the imports mutex without the GPU lock (lock order is GpuMutex → imports), so it can't submit there. Two ways I see: settle the import at its first submission by the recorder (keep the saved copy until that batch completes and compare then), or check content for CPU stamps on fresh imports. Is one of those acceptable to you, or is there a hazard I'm missing that made Windows direct imports compared in the first place?

Branch with the experiment and the probe: parl0v/AnyPS5 exp/watch-private-imports (20c2d0262, the 3-line switch; 207abb46a, tools/wwprobe/wwprobe.cpp). @EagleBearerYS, this is a variant that avoids the faults. If you can run it on Village with APS5_EXP_WATCH_PRIVATE_IMPORTS=1 (on main, without this PR), the fault counter and the AK::EventManager stop rate would show whether it holds there. The probe would also be worth one run on an AMD or Intel GPU.

cc @AlxcBTW

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175897485 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6175897485). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-14T18:53:37Z. --- A variant that keeps these imports write-tracked without moving runs into the section, so no views, no demotion and no write faults. Measured on Sword of the Sea; one question is open before it can be a PR. **Why it can work:** on Windows, a host import without an alias leaves guest write tracking (`watchedHostPointer = entry.alias != nullptr || !state.unwatchImports`, and `unwatchImports` is always true there; `ProbeImportWriteProtection` returns "the Linux write watch"). Since #5596 the memory behind these imports is private `MEM_WRITE_WATCH` memory, so `GetWriteWatch` could keep tracking it if an import doesn't break it. A standalone probe (import `MEM_WRITE_WATCH` memory with `VK_EXT_external_memory_host`, then GPU reads, GPU writes and CPU stores, collecting `GetWriteWatch` with reset after each step) gives the same result on an RTX 3060 and an RTX 4060, NVIDIA 617.42, 16 and 4,096 pages: | step | pages reported written | |---|---| | after the import | all | | after the first GPU read (also with a 4-byte read) | all | | after the 2nd, 3rd, 4th GPU read | 0 | | after a GPU fill / a GPU copy into the import | 0 (the fill is visible to the CPU) | | after CPU stores to 2 pages | 2 | | a CPU store after a GPU read | 1 | So CPU stores stay exactly reported, and GPU writes are invisible to it (the driver stamps its own). The noise is a one-time mark of every page. It's asynchronous: in three runs, 1,632–3,033 of 4,096 pages were marked before any submit, the rest by the first GPU use completing. Nothing after that. **Experiment:** with `APS5_EXP_WATCH_PRIVATE_IMPORTS=1`, a direct import of all-private read-write memory stays watched (`|| (writable && GuestMemory::WriteWatched())`, `staysWatched` in `ImportWatched`). Same binary (`main` `f0854887d` + the 3-line change), env off vs on, alternating: | | env off (`main` behaviour) | env on | this PR (from my run above) | |---|---|---|---| | Box 2 (RTX 3060), 300 s rows | 3.70 / 3.68 / 3.69 FPS | **8.90 / 8.76 / 8.90 / 8.88 / 8.90** | 9.10 | | Box 1 (RTX 4060), 200 s rows | 2.70 / 2.70 | **7.00 / 7.05 / 7.09 / 7.04** | 7.14 / 7.18 | | `[guestmem]` compare per 10 s | 158k–366k calls, 0.56–1.26 TB | 1–2 calls | 1 call | | `readTarget` per 10 s (box 2) | ~1,550 ms | ~181 ms | 120 ms | | crashes at `+0x37f77b3` | 0 / 5 | **0 / 9** | 1 / 6 | Frame dumps: mean difference 0.13 env on vs off, 0.13 between two off runs. About 97–98 % of this PR's frame rate, with nothing moved into a section. **Open question:** the one-time marks after the import. `ImportWatched`'s window filters the ones that land inside it (saved copy, compare). The rest arrive later and get stamped as CPU stores on unchanged bytes. Where storage-image results are pending over such a range, a spurious CPU stamp could make a refresh prefer guest memory. I tried closing the window after a 4-byte GPU read of the new import, which settles the marks in the probe. But `importAllocation` runs under the imports mutex without the GPU lock (lock order is `GpuMutex` → imports), so it can't submit there. Two ways I see: settle the import at its first submission by the recorder (keep the saved copy until that batch completes and compare then), or check content for CPU stamps on fresh imports. Is one of those acceptable to you, or is there a hazard I'm missing that made Windows direct imports compared in the first place? Branch with the experiment and the probe: [parl0v/AnyPS5 `exp/watch-private-imports`](https://github.com/parl0v/AnyPS5/tree/exp/watch-private-imports) (`20c2d0262`, the 3-line switch; `207abb46a`, `tools/wwprobe/wwprobe.cpp`). @EagleBearerYS, this is a variant that avoids the faults. If you can run it on Village with `APS5_EXP_WATCH_PRIVATE_IMPORTS=1` (on `main`, without this PR), the fault counter and the AK::EventManager stop rate would show whether it holds there. The probe would also be worth one run on an AMD or Intel GPU. cc @AlxcBTW
parl0v commented 2026-10-14 19:04:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-14T19:04:20Z.


Correction to my variant above: the open question isn't hypothetical. It loses GPU results. libSceAgcDriver ctest on main 6bb4fdc4f + the switch (RTX 4060, Windows 10): 544 of 546 pass either way. But agc_driver_layered_volume_submit fails 3 of 3 with APS5_EXP_WATCH_PRIVATE_IMPORTS=1 and passes 3 of 3 without it:

AGC graphics: layered volume draw through the driver: slice 1 texel (0, 0) channel 0 is 64, expected 255 (the band of layer 0)

64 is the test's CPU pre-fill (Kept = 0x40), so the draw's results never reached guest memory. The volume is committed arena memory, imported directly by the draw. That fits the one-time marks the driver makes after an import landing after the GPU write and being taken as a newer CPU store. So keeping these imports watched needs those marks filtered before they're trusted, and the 3-line switch alone is not safe. Frames on Sword of the Sea's title looked unchanged, but that was the wrong test.

@EagleBearerYS please don't spend a Village run on the branch as it is. I'll come back if I get a version that passes this test.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176104195 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6176104195). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-14T19:04:20Z. --- Correction to my variant above: the open question isn't hypothetical. It loses GPU results. `libSceAgcDriver` ctest on `main` `6bb4fdc4f` + the switch (RTX 4060, Windows 10): 544 of 546 pass either way. But **`agc_driver_layered_volume_submit` fails 3 of 3 with `APS5_EXP_WATCH_PRIVATE_IMPORTS=1` and passes 3 of 3 without it**: ``` AGC graphics: layered volume draw through the driver: slice 1 texel (0, 0) channel 0 is 64, expected 255 (the band of layer 0) ``` 64 is the test's CPU pre-fill (`Kept = 0x40`), so the draw's results never reached guest memory. The volume is committed arena memory, imported directly by the draw. That fits the one-time marks the driver makes after an import landing after the GPU write and being taken as a newer CPU store. So keeping these imports watched needs those marks filtered before they're trusted, and the 3-line switch alone is not safe. Frames on Sword of the Sea's title looked unchanged, but that was the wrong test. @EagleBearerYS please don't spend a Village run on the branch as it is. I'll come back if I get a version that passes this test.
simonbronk commented 2026-10-14 19:12:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-14T19:12:03Z.


@Pipodi i love you <3

A Windows run of this PR with Onimusha: Way of the Sword (PPSA27836, RE Engine, like Village):

  • The head 22091410a merges cleanly into main ed835aa76 together with the title's other PRs (#5769), and builds with WinLibs GCC 15.2.0 r7. Runs were on an RTX 5070, Windows 11 Pro 26200.
  • The title then stopped at presentation with guest snapshot differs from registered memory. The same stop happens without this PR, so it isn't caused by it; #5484 lets the run continue.
  • I couldn't measure the frame rate yet: on current main the title shows a black screen after that point, with and without this PR. I'll post aps5-summary.jsonl lines for main and for this PR once it reaches a stable scene.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176252725 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6176252725). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-14T19:12:03Z. --- @Pipodi i love you <3 A Windows run of this PR with Onimusha: Way of the Sword (PPSA27836, RE Engine, like Village): - The head `22091410a` merges cleanly into `main` ed835aa76 together with the title's other PRs (#5769), and builds with WinLibs GCC 15.2.0 r7. Runs were on an RTX 5070, Windows 11 Pro 26200. - The title then stopped at presentation with `guest snapshot differs from registered memory`. The same stop happens without this PR, so it isn't caused by it; #5484 lets the run continue. - I couldn't measure the frame rate yet: on current `main` the title shows a black screen after that point, with and without this PR. I'll post `aps5-summary.jsonl` lines for `main` and for this PR once it reaches a stable scene.
JAB-dev commented 2026-10-14 20:27:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JAB-dev on 2026-10-14T20:27:08Z.


Besiege (PPSA20313), main at a1b6be7ef vs the same plus this PR (22091410a), Windows 11, RTX 4070 SUPER, 1080p: title screen 14.6 / 15.1 -> 23.8 / 25.1 FPS (+66%). Frames presented in the first 40 s: 420 / 720 / 727 -> 877 / 951 / 965.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6177719890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6177719890). Originally posted by [JAB-dev](https://github.com/JAB-dev) on 2026-10-14T20:27:08Z. --- Besiege (PPSA20313), `main` at `a1b6be7ef` vs the same plus this PR (`22091410a`), Windows 11, RTX 4070 SUPER, 1080p: title screen 14.6 / 15.1 -> 23.8 / 25.1 FPS (+66%). Frames presented in the first 40 s: 420 / 720 / 727 -> 877 / 951 / 965.
oneandonlydean commented 2026-10-14 20:44:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T20:44:55Z.


@adriadam10 this looks like the forward fix for the Windows cost #5596 left: issues #5692 and #5842 trace it to the same thing (every frame compares the unaliased imports; on #5842 each frame waits out the title's 1 s timeout, and the Sword of the Sea title drops from ~7.4 to 2.4 FPS). With the Besiege (+66%) and Onimusha runs above, it would help to have those two reporters rerun on this head too, so #5692 and #5842 can close with it. We're happy to review the MapAlias demotion path (the case where a host write is open and the range is imported without an alias) if that's useful; we can't run Windows here, so the numbers would have to come from the reporters.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178053040 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6178053040). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T20:44:55Z. --- @adriadam10 this looks like the forward fix for the Windows cost #5596 left: issues #5692 and #5842 trace it to the same thing (every frame compares the unaliased imports; on #5842 each frame waits out the title's 1 s timeout, and the Sword of the Sea title drops from ~7.4 to 2.4 FPS). With the Besiege (+66%) and Onimusha runs above, it would help to have those two reporters rerun on this head too, so #5692 and #5842 can close with it. We're happy to review the `MapAlias` demotion path (the case where a host write is open and the range is imported without an alias) if that's useful; we can't run Windows here, so the numbers would have to come from the reporters.
parl0v commented 2026-10-14 21:03:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-14T21:03:03Z.


Follow-up to the variant and its correction above: it's now #6060, with the asynchronous import marks handled. Each new import of write-watched private memory is settled inside ImportWatched's window by a 4-byte read on a second queue of the graphics family, and a Windows ProbeImportWriteProtection decides per device. agc_driver_layered_volume_submit passes with it (it failed 3/3 without the settle). On Sword of the Sea's title: box 2 3.01 → 9.51 FPS. Over 120 s boots it stopped at +0x37f77b3 in 0 of 20, against 5 of 20 for this PR on the same boxes and executable. The two can coexist: this keeps private memory private, while yours moves runs into sections. @EagleBearerYS, #6060 is the one worth a Village run if you have time.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178442953 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6178442953). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-14T21:03:03Z. --- Follow-up to the variant and its correction above: it's now #6060, with the asynchronous import marks handled. Each new import of write-watched private memory is settled inside `ImportWatched`'s window by a 4-byte read on a second queue of the graphics family, and a Windows `ProbeImportWriteProtection` decides per device. `agc_driver_layered_volume_submit` passes with it (it failed 3/3 without the settle). On Sword of the Sea's title: box 2 3.01 → 9.51 FPS. Over 120 s boots it stopped at `+0x37f77b3` in 0 of 20, against 5 of 20 for this PR on the same boxes and executable. The two can coexist: this keeps private memory private, while yours moves runs into sections. @EagleBearerYS, #6060 is the one worth a Village run if you have time.
winstrex commented 2026-10-14 21:55:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by winstrex on 2026-10-14T21:55:03Z.


Tested on The Pathless (PPSA01825) at the main menu: Windows 11, RTX 5070 Ti, APS5_PROFILE_DRAW=1, alternated runs.

#5596 alone (its merge 3e4fe4ce3 against the parent, 3+3): 84 → 422 ms per frame; template-hit draws 135 → 1710 µs.

This PR on main f59d91ffc (2+2):

main main + #5851
ms per frame 145 (142–147) 50 (49–50)
µs per recorded draw 663 116
template hit 584 µs 63 µs
guest memory compared per 10 s ~39 GB, 3.0 s ~40 MB, 0.0 s

On queue worker 0 (sampled on the previous main, e6ef803ce), memcmp drops from 37.8 % to 2.4 % of the samples and StorageTexture::Refresh from 33.5 % to 1.7 %.

Wwise red-zone crash (#361, AK::EventManager, app.exe+0x54c313a): 0 of 8 runs to the menu with this PR (0 of 16 counting the measured runs). Before #5596 it was 4 of 16 (on 758aca737). The hazard is back for these pages, though. With this PR the title's direct memory is all section views, and about 1.15 GiB of it is read-only (armed) 55 s into a run. That includes the pages Wwise wrote in the old crash; on main they are private read-write. So these pages fault on write again; the crash just didn't show up in these runs.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179348715 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6179348715). Originally posted by [winstrex](https://github.com/winstrex) on 2026-10-14T21:55:03Z. --- Tested on The Pathless (PPSA01825) at the main menu: Windows 11, RTX 5070 Ti, `APS5_PROFILE_DRAW=1`, alternated runs. #5596 alone (its merge 3e4fe4ce3 against the parent, 3+3): 84 → 422 ms per frame; template-hit draws 135 → 1710 µs. This PR on `main` f59d91ffc (2+2): | | main | main + #5851 | |---|---|---| | ms per frame | 145 (142–147) | 50 (49–50) | | µs per recorded draw | 663 | 116 | | template hit | 584 µs | 63 µs | | guest memory compared per 10 s | ~39 GB, 3.0 s | ~40 MB, 0.0 s | On queue worker 0 (sampled on the previous main, e6ef803ce), `memcmp` drops from 37.8 % to 2.4 % of the samples and `StorageTexture::Refresh` from 33.5 % to 1.7 %. Wwise red-zone crash (#361, `AK::EventManager`, `app.exe+0x54c313a`): 0 of 8 runs to the menu with this PR (0 of 16 counting the measured runs). Before #5596 it was 4 of 16 (on `758aca737`). The hazard is back for these pages, though. With this PR the title's direct memory is all section views, and about 1.15 GiB of it is read-only (armed) 55 s into a run. That includes the pages Wwise wrote in the old crash; on main they are private read-write. So these pages fault on write again; the crash just didn't show up in these runs.
frankea commented 2026-10-14 22:16:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-14T22:16:43Z.


Windows run of 22091410a on this box, since no NVIDIA full-suite result was posted: merged onto main 4808d9c20 (clean); Windows 11 10.0.26200, Ryzen 7 5800X, RTX 4090 (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 r7, Release, BUILD_TESTING=ON, default environment.

  • Full ctest: 1234 of 1234, 14 environment skips, the same as main on this machine.
  • guest_memory (which carries CheckAliasLeavesResidentRunsUnderAHostWrite) 5 of 5; libSceAgcDriver scope 556 of 556; agc_driver_layered_volume_submit 5 of 5.

No title here, so nothing on the first-frame cost or the write faults @parl0v and @EagleBearerYS measured. Tested with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179713825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6179713825). Originally posted by [frankea](https://github.com/frankea) on 2026-10-14T22:16:43Z. --- Windows run of `22091410a` on this box, since no NVIDIA full-suite result was posted: merged onto `main` `4808d9c20` (clean); Windows 11 10.0.26200, Ryzen 7 5800X, RTX 4090 (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, default environment. - Full ctest: 1234 of 1234, 14 environment skips, the same as `main` on this machine. - `guest_memory` (which carries `CheckAliasLeavesResidentRunsUnderAHostWrite`) 5 of 5; `libSceAgcDriver` scope 556 of 556; `agc_driver_layered_volume_submit` 5 of 5. No title here, so nothing on the first-frame cost or the write faults @parl0v and @EagleBearerYS measured. Tested with AI assistance (Claude Code).
LeandroLP23 commented 2026-10-14 22:22:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-14T22:22:15Z.


AMD and homebrew data point: SuperTuxKart (PPSA69421, catalog release), the title screen it starts on. Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Ryzen AI 7 350, WinLibs GCC 15.2.0, Release, relinked with --windows --trap-sdk-syscall-stubs, warm caches, 60 s per run. main 9bec20233 and the same with this PR's head 22091410a merged; the runs alternate between the builds, same relinked executable, only the .prx files swapped.

Run main main + this PR
1 5.08 FPS 7.30 FPS
2 5.03 FPS 7.26 FPS
3 5.11 FPS 7.26 FPS

That's +43%. From one APS5_PROFILE_DRAW=1 run each (difference between the last two [guestmem] reports, and the last [draws] line):

main + this PR
[guestmem] compare per 10 s 5333 calls, 44.4 GiB, 2.0 s 0
readTarget per 10 s 2782 ms over 2984 lookups (0.93 ms each) 89 ms over 4306 (0.02 ms)

The time goes to refreshResidentTarget → StorageTexture::Refresh, collecting writes over the colour target for every draw (details in #5692). No stop, crash or visible change in the image in any run. Not measured: write faults, memory use, longer runs.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179812577 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6179812577). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-14T22:22:15Z. --- AMD and homebrew data point: SuperTuxKart (PPSA69421, catalog release), the title screen it starts on. Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Ryzen AI 7 350, WinLibs GCC 15.2.0, Release, relinked with `--windows --trap-sdk-syscall-stubs`, warm caches, 60 s per run. `main` 9bec20233 and the same with this PR's head 22091410a merged; the runs alternate between the builds, same relinked executable, only the `.prx` files swapped. | Run | `main` | `main` + this PR | |---|---|---| | 1 | 5.08 FPS | 7.30 FPS | | 2 | 5.03 FPS | 7.26 FPS | | 3 | 5.11 FPS | 7.26 FPS | That's +43%. From one `APS5_PROFILE_DRAW=1` run each (difference between the last two `[guestmem]` reports, and the last `[draws]` line): | | `main` | + this PR | |---|---|---| | `[guestmem]` compare per 10 s | 5333 calls, 44.4 GiB, 2.0 s | 0 | | `readTarget` per 10 s | 2782 ms over 2984 lookups (0.93 ms each) | 89 ms over 4306 (0.02 ms) | The time goes to `refreshResidentTarget` → `StorageTexture::Refresh`, collecting writes over the colour target for every draw (details in #5692). No stop, crash or visible change in the image in any run. Not measured: write faults, memory use, longer runs. AI-assisted: yes (Claude Code)
Amoenus commented 2026-10-14 23:24:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-14T23:24:51Z.

Review: COMMENTED


User-data scope correction (2026-10-15 UTC): the earlier manifest restored tracked legacy /app0 files; the game uses /data/UnleashedRecomp, which was outside that audit. Protected original/runtime/guest-libc hashes remain verified, but full active-user-data restoration and identical active-save state were not established. The first “None” configuration trial edited the legacy file and is invalid as a no-AA test. Maintained correction and verified two-root snapshot/restore scope. Numeric fixture evidence remains valid.

Independent Windows retest of #5851 head 22091410a602030a23d9dc33819f57cc38daab69 in our retained Sonic integration (2026-10-15 UTC).

Retained integration 9e4925b75 refreshes the earlier E1 composition onto main ab9a4768407d862d1879d7d0ee66bd9c3d9d67a8 and adds #5496's reviewed test corrections. It preserves the broad initial/expanded DCC imports, transfers, immutable snapshots, tracked publication, MSAA arrays and native-depth work. #5851 remains at unchanged head 22091410a602030a23d9dc33819f57cc38daab69, applied through its three range-equivalent commits. This is composed-stack evidence, not untouched PR-head or unchanged-main title validation.

Full Windows app/libs/conventions/registration pass.75 focused CTest groups pass once (maximum25.0983s);40 critical groups pass five times under each NVIDIA/AMD selector (maximum5.3113/5.49355s).22 critical fixtures have physical-device evidence for both RTX5080 (610.62) and AMD Radeon Graphics (32.0.21036.18); the other18 have no recorded device evidence and are not counted as GPU coverage. No CTest failures/skips or tests over30s. StoreOverUntracked still has three internal “not run” cases. Windows11 Enterprise26200, WinLibs GCC15.2.0. The126-PRX/three-DLL frozen profile loads5/5. No Linux/full-suite/performance or console-hardware claim.

Sonic Unleashed Recompiled PPSA99902,01.003.000 (#4443):

Fresh conversion of the original executable/guest libc reaches the title/autosave screen, opening cutscene and level-loading screen. It stops after 703.882s, exit 0xC0000409, without a timeout:

AGC graphics: guest writes to a resident multisample target or its metadata are not implemented

All six scheduled input pulses were sent;48 ordinary BMPs were captured. The inspected frame_047.bmp at602.301s shows NOW LOADING. No gameplay or FPS result is established. The changed plane, first writer and failing import predicate remain unidentified. The same message is emitted by two revalidation branches, so it does not identify a producer or root cause. No refusal or tracking check was bypassed. Original binaries, baseline runtime/guest libc and user data were restored and hash-verified, with zero cleanup errors.

Comparison: the preceding integration without #5851 stopped at32.816s on untracked color reuse. The first #5851 composition, E1 on main4808, reached the same loading screen and stopped at the same revalidation guard after706.129s. This refresh retains that progress; the timings are not a performance comparison.

Partial validation, not an approval recommendation. Controlled neighboring-alias observation: alias/no-alias/restored controls confirm conservative generation invalidation on public synthetic memory. Its role in the game's stop remains unverified.

The neighboring-import test checkpoint is 669170ea1 on maind92. Its public test-only extension verifies all1024 samples of a GPU-written16x16/4x RGBA16F target across a declined neighboring import, retaining its watch. Five runs per actual NVIDIA/AMD GPU pass before and after the control; removing only the optional-import safety check gives ten intended assertions. Full Windows app/libs/checkers and15 related groups per selector pass in both positive stages (max24.21s). Details and remaining metadata/title/Linux limits are in the maintained report linked below. Earlier8a3 applies #6225 to the recorder test harness; full Windows build/checkers and42 recorder groups pass per actual GPU, with two internal compared-import paths untested. The measured title replay remains5aa. The original PR-composition evidence above remains pinned to9e42. The separate local import correction at6bd passes the full Windows matrix but its original-dump replay still ends at the same guard after704.404s. The later whole-buffer regression4310b82cc checks all64KiB; ten partial-fill controls fail as intended and ten restored runs pass. The refreshed5aa composition passes full build/checkers and the affected test matrix. Maintained correction, device scope and negative title result. A fresh5aa title replay also reaches loading and the same guard after706.328s without timeout. Its wrapper ended during restoration; separate recovery completed and verified all baseline hashes and archived the48 frames. No isolated PR-head or gameplay claim.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5526028708 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#pullrequestreview-5526028708). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-14T23:24:51Z. **Review:** COMMENTED --- <!-- codex-active-user-root-correction-v2 --> **User-data scope correction (2026-10-15 UTC):** the earlier manifest restored tracked legacy `/app0` files; the game uses `/data/UnleashedRecomp`, which was outside that audit. Protected original/runtime/guest-libc hashes remain verified, but full active-user-data restoration and identical active-save state were not established. The first “None” configuration trial edited the legacy file and is invalid as a no-AA test. [Maintained correction and verified two-root snapshot/restore scope](https://github.com/boykopovar/AnyPS5/issues/3036). Numeric fixture evidence remains valid. <!-- /codex-active-user-root-correction-v2 --> Independent Windows retest of #5851 head `22091410a602030a23d9dc33819f57cc38daab69` in our retained Sonic integration (2026-10-15 UTC). [Retained integration `9e4925b75`](https://github.com/Amoenus/AnyPS5/commit/9e4925b755401f0e2963a181073277cada7165fb) refreshes the earlier E1 composition onto main `ab9a4768407d862d1879d7d0ee66bd9c3d9d67a8` and adds #5496's reviewed test corrections. It preserves the broad initial/expanded DCC imports, transfers, immutable snapshots, tracked publication, MSAA arrays and native-depth work. #5851 remains at unchanged head `22091410a602030a23d9dc33819f57cc38daab69`, applied through its three range-equivalent commits. This is composed-stack evidence, not untouched PR-head or unchanged-main title validation. Full Windows app/libs/conventions/registration pass.75 focused CTest groups pass once (maximum25.0983s);40 critical groups pass five times under each NVIDIA/AMD selector (maximum5.3113/5.49355s).22 critical fixtures have physical-device evidence for both RTX5080 (610.62) and AMD Radeon Graphics (32.0.21036.18); the other18 have no recorded device evidence and are not counted as GPU coverage. No CTest failures/skips or tests over30s. StoreOverUntracked still has three internal “not run” cases. Windows11 Enterprise26200, WinLibs GCC15.2.0. The126-PRX/three-DLL frozen profile loads5/5. No Linux/full-suite/performance or console-hardware claim. Sonic Unleashed Recompiled **PPSA99902**,01.003.000 ([#4443](https://github.com/boykopovar/AnyPS5/discussions/4443)): Fresh conversion of the original executable/guest libc reaches the title/autosave screen, opening cutscene and **level-loading screen**. It stops after **703.882s**, exit `0xC0000409`, without a timeout: ```text AGC graphics: guest writes to a resident multisample target or its metadata are not implemented ``` All six scheduled input pulses were sent;48 ordinary BMPs were captured. The inspected `frame_047.bmp` at602.301s shows NOW LOADING. **No gameplay or FPS result is established.** The changed plane, first writer and failing import predicate remain unidentified. The same message is emitted by two revalidation branches, so it does not identify a producer or root cause. No refusal or tracking check was bypassed. Original binaries, baseline runtime/guest libc and user data were restored and hash-verified, with zero cleanup errors. Comparison: the preceding integration without #5851 stopped at32.816s on untracked color reuse. The first #5851 composition, [E1](https://github.com/Amoenus/AnyPS5/commit/e1c6af65bbfb7809113bea1f58074452a4927647) on main4808, reached the same loading screen and stopped at the same revalidation guard after706.129s. This refresh retains that progress; the timings are not a performance comparison. Partial validation, not an approval recommendation. [Controlled neighboring-alias observation](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6182008730): alias/no-alias/restored controls confirm conservative generation invalidation on public synthetic memory. Its role in the game's stop remains unverified. The neighboring-import test checkpoint is [669170ea1](https://github.com/Amoenus/AnyPS5/commit/669170ea154867215b57cabae227bad07e37f7c6) on maind92. Its public test-only extension verifies all1024 samples of a GPU-written16x16/4x RGBA16F target across a declined neighboring import, retaining its watch. Five runs per actual NVIDIA/AMD GPU pass before and after the control; removing only the optional-import safety check gives ten intended assertions. Full Windows app/libs/checkers and15 related groups per selector pass in both positive stages (max24.21s). Details and remaining metadata/title/Linux limits are in the maintained report linked below. Earlier8a3 applies #6225 to the recorder test harness; full Windows build/checkers and42 recorder groups pass per actual GPU, with two internal compared-import paths untested. The measured title replay remains5aa. The original PR-composition evidence above remains pinned to9e42. The separate local import correction at6bd passes the full Windows matrix but its original-dump replay still ends at the same guard after704.404s. The later [whole-buffer regression4310b82cc](https://github.com/Amoenus/AnyPS5/commit/4310b82cc80f78de2ec891e41407ce9eb80ea016) checks all64KiB; ten partial-fill controls fail as intended and ten restored runs pass. The refreshed5aa composition passes full build/checkers and the affected test matrix. [Maintained correction, device scope and negative title result](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6182008730). A fresh5aa title replay also reaches loading and the same guard after706.328s without timeout. Its wrapper ended during restoration; separate recovery completed and verified all baseline hashes and archived the48 frames. No isolated PR-head or gameplay claim. AI-assisted: yes.
orishamir commented 2026-10-14 23:59:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-14T23:59:14Z.


This PR and #6060 side by side on free catalog titles, on one NVIDIA machine and one base. Windows 11, RTX 4080 (616.56), WinLibs GCC 15.2.0 r7, Release. Builds: main 6239ceffc, #6060 at its head f97762019 (based on it), and this PR's 22091410a merged onto it. Warm run directories, a 40 s warm-up, then two 30 s windows (APS5_TRACE_SECONDS=20:30, no other switch), in FPS:

title main this PR #6060
PS5 OpenGL Showcase (PPSA99005, 3840x2160) 3.86, 3.82 6.49, 6.59 6.95, 7.09
Homebrew UI Lab (PPSA99050) 17.39, 17.53 20.17, 19.38 24.59, 24.34
ProsperoStore (PPSA99000) 18.36, 18.25 22.03, 21.80 25.82, 25.51
SuperTuxKart (PPSA69421, start screen) 5.51, 5.50 8.65, 8.59 7.43, 7.49
  • An earlier set on main 153d5d469, with #6060 at e13268f4f, gives the same order: Showcase 3.7 / 6.5 / 7.0, UI Lab 16.1 / 20.0 / 24.3, ProsperoStore 17.9 / 21.8 / 25.6, SuperTuxKart 5.5 / 8.65 / 7.15.
  • On SuperTuxKart, #6060 halves the GPU time per present (8.3 against 15.7 ms with this PR and 16.2 on main), yet its frame rate is lower than this PR's. A frame dump of the start screen looks the same in all three builds.
  • On main 153d5d469, the worker sampler puts 69% of queue worker 0's samples during the Showcase in StorageTexture::Refresh. 39% are under compareUntracked → GuestMemory::EqualsCommittedUnsynced and 24% under StorageTexture::upload.
  • The Showcase also shows that this cost now reaches a correct image. Since #5321, its floor grid and bloom match the console screenshot in ps5-opengl's README. Before, the floor was dim. On this machine #5321 took the Showcase from 5.81 to 2.86 FPS (bisected), and #5522 brought it to about 3.7. Frame dumps with this PR and with #6060 both show the bright floor.
  • #6060's probe on this machine: keep the write watch: yes (4096 of 4096 scratch pages reported written at the import, 0 by its 4-byte settle read, 0 after it, 0 after a full GPU read, 0 after a second, 0 after a GPU write, 1 after a CPU store).

Summary lines and traces: https://gist.github.com/orishamir/028d13ae9e4b8551c8b3538748f94948 (the 153d5d469 set, with digests and the symbolized samples: https://gist.github.com/orishamir/ec021f52703c05926631c38b953414d6).

AI-assisted: yes (Claude Code Opus 5.5)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6181154787 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6181154787). Originally posted by [orishamir](https://github.com/orishamir) on 2026-10-14T23:59:14Z. --- This PR and #6060 side by side on free catalog titles, on one NVIDIA machine and one base. Windows 11, RTX 4080 (616.56), WinLibs GCC 15.2.0 r7, Release. Builds: `main` 6239ceffc, #6060 at its head f97762019 (based on it), and this PR's 22091410a merged onto it. Warm run directories, a 40 s warm-up, then two 30 s windows (`APS5_TRACE_SECONDS=20:30`, no other switch), in FPS: | title | `main` | this PR | #6060 | |---|---|---|---| | PS5 OpenGL Showcase (PPSA99005, 3840x2160) | 3.86, 3.82 | 6.49, 6.59 | 6.95, 7.09 | | Homebrew UI Lab (PPSA99050) | 17.39, 17.53 | 20.17, 19.38 | 24.59, 24.34 | | ProsperoStore (PPSA99000) | 18.36, 18.25 | 22.03, 21.80 | 25.82, 25.51 | | SuperTuxKart (PPSA69421, start screen) | 5.51, 5.50 | 8.65, 8.59 | 7.43, 7.49 | - An earlier set on `main` 153d5d469, with #6060 at e13268f4f, gives the same order: Showcase 3.7 / 6.5 / 7.0, UI Lab 16.1 / 20.0 / 24.3, ProsperoStore 17.9 / 21.8 / 25.6, SuperTuxKart 5.5 / 8.65 / 7.15. - On SuperTuxKart, #6060 halves the GPU time per present (8.3 against 15.7 ms with this PR and 16.2 on `main`), yet its frame rate is lower than this PR's. A frame dump of the start screen looks the same in all three builds. - On `main` 153d5d469, the worker sampler puts 69% of queue worker 0's samples during the Showcase in `StorageTexture::Refresh`. 39% are under `compareUntracked` → `GuestMemory::EqualsCommittedUnsynced` and 24% under `StorageTexture::upload`. - The Showcase also shows that this cost now reaches a correct image. Since #5321, its floor grid and bloom match the console screenshot in ps5-opengl's README. Before, the floor was dim. On this machine #5321 took the Showcase from 5.81 to 2.86 FPS (bisected), and #5522 brought it to about 3.7. Frame dumps with this PR and with #6060 both show the bright floor. - #6060's probe on this machine: `keep the write watch: yes (4096 of 4096 scratch pages reported written at the import, 0 by its 4-byte settle read, 0 after it, 0 after a full GPU read, 0 after a second, 0 after a GPU write, 1 after a CPU store)`. Summary lines and traces: https://gist.github.com/orishamir/028d13ae9e4b8551c8b3538748f94948 (the 153d5d469 set, with digests and the symbolized samples: https://gist.github.com/orishamir/ec021f52703c05926631c38b953414d6). AI-assisted: yes (Claude Code Opus 5.5)
parl0v commented 2026-10-15 00:25:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by parl0v on 2026-10-15T00:25:20Z.


@Pipodi heads-up for longer runs: this PR on SotS (title, ~8.5 FPS) stops after about 12 min with vkAllocateDescriptorSets texture detiler: Vulkan result -2, the same stop #6060 hit. It's a main bug that any title fast enough to keep the recorder busy reaches: the detiler only reset its descriptor pools when the recorder was idle. #6168 fixes it; with it, SotS ran the full 40 min at 10.4 GB private.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6181490693 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6181490693). Originally posted by [parl0v](https://github.com/parl0v) on 2026-10-15T00:25:20Z. --- @Pipodi heads-up for longer runs: this PR on SotS (title, ~8.5 FPS) stops after about 12 min with `vkAllocateDescriptorSets texture detiler: Vulkan result -2`, the same stop #6060 hit. It's a `main` bug that any title fast enough to keep the recorder busy reaches: the detiler only reset its descriptor pools when the recorder was idle. #6168 fixes it; with it, SotS ran the full 40 min at 10.4 GB private.
Amoenus commented 2026-10-15 01:06:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-15T01:06:45Z.


Independent safety follow-up: #6260 preserves and revalidates @Pipodi's open-host-write guard separately from the superseded alias optimization: main-pin test fails5/5; the three-line guard passes5/5. No title corruption or producer is attributed. The retained MSAA migration/control results are maintained in our #6060 comment.

User-data scope correction (2026-10-15 UTC): the earlier manifest restored tracked legacy /app0 files; the game uses /data/UnleashedRecomp, which was outside that audit. Protected original/runtime/guest-libc hashes remain verified, but full active-user-data restoration and identical active-save state were not established. The first “None” configuration trial edited the legacy file and is invalid as a no-AA test. Maintained correction and verified two-root snapshot/restore scope. Numeric fixture evidence remains valid.

Synthetic reproduction: neighboring alias/import triggers resident-MSAA revalidation

Extended the earlier CPU-only control with a real AGC/Vulkan fixture. Only the existing test file changes; production remains the retained integration on main 8cd937e291da28aaa7080be13cb08d7f55d1da33, including unchanged #5851 head 22091410a and the disclosed MSAA stack.

Setup: one private resident run of two 64 KiB blocks. A zero-initialized 64×64, 4× RGBA8 native target occupies the first block. Initial creation and a baseline reuse succeed. There are no preceding draws or DCC/CMASK/FMASK metadata. The alias/import cases make no explicit store into the target block.

Transition before another target reuse Watched Result
None 1 Reuse succeeds
Alias only the second block 1 Revalidation refuses
Actual Vulkan host import of only the second block 1 Same refusal
Same-value CPU store into the first block 1 Same refusal, positive control

Both import assertions pass: a tracked section alias is used (alias != nullptr, unwatched == false), and its returned span has offset=65536, bytes=65536. It does not directly cover the native target block.

The three refusal cases emit:

AGC graphics: guest writes to a resident multisample target or its metadata are not implemented

Five complete fixture runs per actual GPU, 40 case observations: NVIDIA RTX 5080/610.62 and AMD Radeon Graphics/32.0.21036.18, Windows 11 Enterprise26200. Matching library/fixture builds and conventions pass; zero skips, timeouts or device-loss errors. Slowest invocation in the final span-checked run:0.42s NVIDIA/0.45s AMD (the first earlier validation peaked at1.02s). This is the existing MSAA runtime fixture with its earlier tests retained.

The earlier CPU-only reproducer observed unchanged=0 written=1 stored=1 for the untouched first block after aliasing its neighbor. Omitting only the alias gives unchanged=1 written=0 stored=0; restoration reproduces the original result, five runs each. All15 same-value-store controls detected the store. The first setup attempt was excluded and its section cleanup corrected.

Source matches: demote migrates the whole resident run, resets seen and invalidates every shared page. The AGC fixture now demonstrates that this transition can reach the resident-MSAA guard even when the requested import is disjoint.

Local fork proposal

Small production/test delta: decline the optional alias import when its full private resident-run span overlaps a GPU-owned image. The existing copied-buffer path executes the requested operation.

With this change, a real GPU fill stores 0x12345678 into neighboring guest memory and native-target reuse succeeds. Direct alias creation and a same-value CPU store retain their refusals. Both actual GPUs pass five runs before and after the one-line fault control; removing the safety check produces ten intended assertions (five/vendor), with no device loss or abort.

The full-buffer regression4310b82cc, on maina077, verifies all65536 bytes of the copied fill. Full Windows app/libs/checkers pass;75 focused groups once (max24.7584s),40 critical groups five times per selector (max5.54321/5.17630s), with22 fixtures showing the requested physical device per vendor. Four new main draw/sample-mask fixtures also pass five times per actual GPU. The half-fill control leaves the first16 bytes correct but triggers the new whole-buffer assertion in all10 runs; restoration gives10 passes. No CTest failures/skips in the normal runs; three internal StoreOverUntracked “not run” cases remain. No Linux/full-suite claim.

The native-image tracking helper and MSAA revalidation involved here belong to our retained implementation; this is a composed integration proposal.

GPU-written native-target extension

The public synthetic fixture delta draws a triangle into a 16x16, 4x RGBA16F native target in the first 64 KiB block of a private resident run of four blocks. Shader sample loads verify all 1024 samples, including partly covered pixels. An optional import of the second block is declined; the target remains watched and every sample and its triangle coverage are preserved. The earlier whole-buffer copied-fill case remains separately tested; this extension does not add a neighboring fill while the drawn target is live.

At 669170ea154867215b57cabae227bad07e37f7c6, full Windows app/libs and conventions pass. The extended fixture passes five times per physical GPU before and after the control: NVIDIA RTX 5080/610.62 and AMD Radeon Graphics/32.0.21036.18, Windows 11 Enterprise26200. The fault control removes only the optional-import safety check and triggers the neighboring import would migrate a GPU-written resident target in all ten runs (five/vendor). The MSAA guest-write guard remains intact. Exact source restoration and matching rebuild give ten more positive runs. The 15 related groups also pass once per selector both before and after the control (60 runs, maximum24.21s); nine groups record the requested physical device. No CTest skips, timeouts, device-loss errors or internal not-run messages in this matrix. No Linux/full-suite claim.

This test's fork checkpoint is 669170ea1, with this test-only delta above 8a3efe771. The game replay remains the measured5aa run below; this synthetic extension does not establish its triggering import, plane or first writer.

**Original-dump retests completed:**9e42,6bd and5aa reach loading and the same guard text after703.882/704.404/706.328s respectively, all0xC0000409 without timeout. Latest5aa sends six inputs and records48 BMPs; frame047 at601.211s shows loading. Its wrapper ended during restoration; a separate recovery completed and hash-verified originals/runtime/guest/user-data restoration, archived all48 frames and removed the temporary executable. For9e42→6bd only AGC changes; the6bd→5aa refresh rebuilds all126 PRXs, with three DLLs and converted executable/guest libc unchanged. This does not establish an isolated cause. The import correction fixes its synthetic case but does not unblock the title's first stop; plane, writer and failed predicate remain unidentified. No FPS or speed claim.

Earlier integration8a3efe771 retains the correction on maind92 and applies #6225 to the private recorder fixture's GPU selector. Full Windows build/checkers and42 recorder groups per physical NVIDIA/AMD pass,0 CTest failures/skips (39 device-recorded fixtures plus three CPU groups, max0.457s). Unit-shadow and kept-index internal compared-import paths remain untested. Earlier5aa's full4x source-footprint adaptation remains; its initial unadapted merge failed that explicit check. Title evidence remains the5aa replay above;8a3's own delta is in the test harness. Continue ordinary bring-up and public synthetic narrowing with the guard preserved.

Scope: clean native-target reuse and the GPU-written16x16/4x RGBA16F neighboring-import case on the disclosed composition. Other dirty-target formats/modes, metadata transitions, isolated #5851/main-only reproduction and Linux remain unverified. Our Sonic replay reaches loading and stops at the same message, but its triggering import, plane and first writer are unidentified. The local proposal is shared with the demotion work already coordinated here; no upstream PR is opened from this composed source.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182008730 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6182008730). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-15T01:06:45Z. --- <!-- codex-host-write-guard-followup-v1 --> **Independent safety follow-up:** [#6260](https://github.com/boykopovar/AnyPS5/issues/6260) preserves and revalidates @Pipodi's open-host-write guard separately from the superseded alias optimization: main-pin test fails5/5; the three-line guard passes5/5. No title corruption or producer is attributed. The retained MSAA migration/control results are maintained in [our #6060 comment](https://github.com/boykopovar/AnyPS5/pull/6060#issuecomment-6180274490). <!-- /codex-host-write-guard-followup-v1 --> <!-- codex-active-user-root-correction-v2 --> **User-data scope correction (2026-10-15 UTC):** the earlier manifest restored tracked legacy `/app0` files; the game uses `/data/UnleashedRecomp`, which was outside that audit. Protected original/runtime/guest-libc hashes remain verified, but full active-user-data restoration and identical active-save state were not established. The first “None” configuration trial edited the legacy file and is invalid as a no-AA test. [Maintained correction and verified two-root snapshot/restore scope](https://github.com/boykopovar/AnyPS5/issues/3036). Numeric fixture evidence remains valid. <!-- /codex-active-user-root-correction-v2 --> ### Synthetic reproduction: neighboring alias/import triggers resident-MSAA revalidation Extended the earlier CPU-only control with a [real AGC/Vulkan fixture](https://github.com/Amoenus/AnyPS5/compare/ef554bf59515b1014e42998e3c076c356ba1ea14...12f0607c18b935f24039c0a89556545e6f636665). Only the existing test file changes; production remains the retained integration on main `8cd937e291da28aaa7080be13cb08d7f55d1da33`, including unchanged #5851 head `22091410a` and the disclosed MSAA stack. Setup: one private resident run of two 64 KiB blocks. A zero-initialized 64×64, 4× RGBA8 native target occupies the first block. Initial creation and a baseline reuse succeed. There are no preceding draws or DCC/CMASK/FMASK metadata. The alias/import cases make no explicit store into the target block. | Transition before another target reuse | Watched | Result | | --- | --- | --- | | None | 1 | Reuse succeeds | | Alias only the second block | 1 | Revalidation refuses | | Actual Vulkan host import of only the second block | 1 | Same refusal | | Same-value CPU store into the first block | 1 | Same refusal, positive control | Both import assertions pass: a tracked section alias is used (`alias != nullptr`, `unwatched == false`), and its returned span has **offset=65536, bytes=65536**. It does not directly cover the native target block. The three refusal cases emit: ```text AGC graphics: guest writes to a resident multisample target or its metadata are not implemented ``` **Five complete fixture runs per actual GPU, 40 case observations:** NVIDIA RTX 5080/610.62 and AMD Radeon Graphics/32.0.21036.18, Windows 11 Enterprise26200. Matching library/fixture builds and conventions pass; zero skips, timeouts or device-loss errors. Slowest invocation in the final span-checked run:0.42s NVIDIA/0.45s AMD (the first earlier validation peaked at1.02s). This is the existing MSAA runtime fixture with its earlier tests retained. The earlier [CPU-only reproducer](https://github.com/Amoenus/AnyPS5/compare/9e4925b755401f0e2963a181073277cada7165fb...daef940720ddaab9cb16fed61ee54a724819c7b3) observed `unchanged=0 written=1 stored=1` for the untouched first block after aliasing its neighbor. [Omitting only the alias](https://github.com/Amoenus/AnyPS5/commit/03e84052f9f052feede712503495f657d38abb66) gives `unchanged=1 written=0 stored=0`; restoration reproduces the original result, five runs each. All15 same-value-store controls detected the store. The first setup attempt was excluded and its section cleanup corrected. Source matches: [demote](https://github.com/Amoenus/AnyPS5/blob/9e4925b755401f0e2963a181073277cada7165fb/core/libs/prx/libc/include/WindowsMappings.hpp#L624-L650) migrates the whole resident run, resets `seen` and invalidates every shared page. The AGC fixture now demonstrates that this transition can reach the resident-MSAA guard even when the requested import is disjoint. ### Local fork proposal [Small production/test delta](https://github.com/Amoenus/AnyPS5/compare/12f0607c18b935f24039c0a89556545e6f636665...6bd1fff07401564ff89b7440a7a27cddfc39567f): decline the optional alias import when its full private resident-run span overlaps a GPU-owned image. The existing copied-buffer path executes the requested operation. With this change, a real GPU fill stores `0x12345678` into neighboring guest memory and native-target reuse succeeds. Direct alias creation and a same-value CPU store retain their refusals. Both actual GPUs pass five runs before and after the [one-line fault control](https://github.com/Amoenus/AnyPS5/commit/f3832e64291f4b20882d7872f5ed310e8203369c); removing the safety check produces ten intended assertions (five/vendor), with no device loss or abort. The [full-buffer regression4310b82cc](https://github.com/Amoenus/AnyPS5/commit/4310b82cc80f78de2ec891e41407ce9eb80ea016), on maina077, verifies **all65536 bytes** of the copied fill. Full Windows app/libs/checkers pass;75 focused groups once (max24.7584s),40 critical groups five times per selector (max5.54321/5.17630s), with22 fixtures showing the requested physical device per vendor. Four new main draw/sample-mask fixtures also pass five times per actual GPU. The [half-fill control](https://github.com/Amoenus/AnyPS5/commit/eb00ca465316f810915d4ed4e165979c9eacb0c9) leaves the first16 bytes correct but triggers the new whole-buffer assertion in all10 runs; restoration gives10 passes. No CTest failures/skips in the normal runs; three internal StoreOverUntracked “not run” cases remain. No Linux/full-suite claim. The native-image tracking helper and MSAA revalidation involved here belong to our retained implementation; this is a composed integration proposal. ### GPU-written native-target extension The [public synthetic fixture delta](https://github.com/Amoenus/AnyPS5/compare/8a3efe771955bdd6eca9254c5fdd07d33c8b23fd...669170ea154867215b57cabae227bad07e37f7c6) draws a triangle into a 16x16, 4x RGBA16F native target in the first 64 KiB block of a private resident run of four blocks. Shader sample loads verify all 1024 samples, including partly covered pixels. An optional import of the second block is declined; the target remains watched and every sample and its triangle coverage are preserved. The earlier whole-buffer copied-fill case remains separately tested; this extension does not add a neighboring fill while the drawn target is live. At `669170ea154867215b57cabae227bad07e37f7c6`, full Windows app/libs and conventions pass. The extended fixture passes five times per physical GPU before and after the control: NVIDIA RTX 5080/610.62 and AMD Radeon Graphics/32.0.21036.18, Windows 11 Enterprise26200. The [fault control](https://github.com/Amoenus/AnyPS5/commit/410891351b9f9b5c62d0b9b696f294dbcfdfc014) removes only the optional-import safety check and triggers `the neighboring import would migrate a GPU-written resident target` in all ten runs (five/vendor). The MSAA guest-write guard remains intact. Exact source restoration and matching rebuild give ten more positive runs. The 15 related groups also pass once per selector both before and after the control (60 runs, maximum24.21s); nine groups record the requested physical device. No CTest skips, timeouts, device-loss errors or internal not-run messages in this matrix. No Linux/full-suite claim. This test's fork checkpoint is [669170ea1](https://github.com/Amoenus/AnyPS5/commit/669170ea154867215b57cabae227bad07e37f7c6), with this test-only delta above 8a3efe771. The game replay remains the measured5aa run below; this synthetic extension does not establish its triggering import, plane or first writer. **Original-dump retests completed:**9e42,6bd and5aa reach loading and the same guard text after703.882/704.404/706.328s respectively, all0xC0000409 without timeout. Latest5aa sends six inputs and records48 BMPs; frame047 at601.211s shows loading. Its wrapper ended during restoration; a separate recovery completed and hash-verified originals/runtime/guest/user-data restoration, archived all48 frames and removed the temporary executable. For9e42→6bd only AGC changes; the6bd→5aa refresh rebuilds all126 PRXs, with three DLLs and converted executable/guest libc unchanged. This does not establish an isolated cause. The import correction fixes its synthetic case but **does not unblock the title's first stop**; plane, writer and failed predicate remain unidentified. No FPS or speed claim. Earlier [integration8a3efe771](https://github.com/Amoenus/AnyPS5/commit/8a3efe771955bdd6eca9254c5fdd07d33c8b23fd) retains the correction on maind92 and applies [#6225](https://github.com/boykopovar/AnyPS5/pull/6225) to the private recorder fixture's GPU selector. Full Windows build/checkers and42 recorder groups per physical NVIDIA/AMD pass,0 CTest failures/skips (39 device-recorded fixtures plus three CPU groups, max0.457s). Unit-shadow and kept-index internal compared-import paths remain untested. Earlier5aa's [full4x source-footprint adaptation](https://github.com/Amoenus/AnyPS5/commit/5aa3282c38cfaacc9db1bfdc2ef1307756ac1f66) remains; its initial unadapted merge failed that explicit check. Title evidence remains the5aa replay above;8a3's own delta is in the test harness. Continue ordinary bring-up and public synthetic narrowing with the guard preserved. Scope: clean native-target reuse and the GPU-written16x16/4x RGBA16F neighboring-import case on the disclosed composition. Other dirty-target formats/modes, metadata transitions, isolated #5851/main-only reproduction and Linux remain unverified. Our [Sonic replay](https://github.com/boykopovar/AnyPS5/issues/3036) reaches loading and stops at the same message, but its triggering import, plane and first writer are unidentified. The local proposal is shared with the demotion work already coordinated here; no upstream PR is opened from this composed source. AI-assisted: yes.
Pipodi commented 2026-10-15 06:36:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-15T06:36:28Z.


Closing this in favour of #6060, which fixes the same #5596 cost without moving direct memory into sections.

The side-by-side results point that way:

  • @orishamir ran both on one base (RTX 4080): #6060 is faster on the OpenGL Showcase, Homebrew UI Lab and ProsperoStore. This PR is faster only on SuperTuxKart, where #6060's settle runs once per submission (@Dripl1x measured about 320 settles a second there).
  • On Yōtei (#6060 A/B in my review there): first lit frame is 40 s with both, against 80 s on main. Frames are about the same, and guest-memory compares drop from ~105k to ~1.4k per window with both. Private peak is 29 GB with #6060 against 24.5 GB with this PR, but #6060 doesn't need the demotion copy and remap.
  • @winstrex: with this PR, about 1.15 GiB of The Pathless's direct memory is armed read-only again, so the #361 write-fault hazard is back on those pages even though it didn't crash in their runs. #6060 keeps private memory private and watched, so it avoids that.
  • @Amoenus's synthetic case shows a neighbouring alias triggering an MSAA revalidation refusal. That path only exists with the alias.

The two can't usefully coexist: with both merged, writable = !GuestArenaResidentSpan(...) here routes resident runs to MapAlias, so #6060's settle never applies to them.

Thanks to everyone who tested this: @JAB-dev, @LeandroLP23, @frankea, @winstrex, @orishamir, @Amoenus, @Sevthered, @EagleBearerYS and @parl0v. The numbers carry over to #6060's review. The SuperTuxKart per-submission settle cost is the one thing I'd still like to see addressed there (batching or skipping the settle for a range that's re-imported at the same address).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6186084262 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6186084262). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-15T06:36:28Z. --- Closing this in favour of #6060, which fixes the same #5596 cost without moving direct memory into sections. The side-by-side results point that way: - @orishamir ran both on one base (RTX 4080): #6060 is faster on the OpenGL Showcase, Homebrew UI Lab and ProsperoStore. This PR is faster only on SuperTuxKart, where #6060's settle runs once per submission (@Dripl1x measured about 320 settles a second there). - On Yōtei (#6060 A/B in my review there): first lit frame is 40 s with both, against 80 s on `main`. Frames are about the same, and guest-memory compares drop from ~105k to ~1.4k per window with both. Private peak is 29 GB with #6060 against 24.5 GB with this PR, but #6060 doesn't need the demotion copy and remap. - @winstrex: with this PR, about 1.15 GiB of The Pathless's direct memory is armed read-only again, so the #361 write-fault hazard is back on those pages even though it didn't crash in their runs. #6060 keeps private memory private and watched, so it avoids that. - @Amoenus's synthetic case shows a neighbouring alias triggering an MSAA revalidation refusal. That path only exists with the alias. The two can't usefully coexist: with both merged, `writable = !GuestArenaResidentSpan(...)` here routes resident runs to `MapAlias`, so #6060's settle never applies to them. Thanks to everyone who tested this: @JAB-dev, @LeandroLP23, @frankea, @winstrex, @orishamir, @Amoenus, @Sevthered, @EagleBearerYS and @parl0v. The numbers carry over to #6060's review. The SuperTuxKart per-submission settle cost is the one thing I'd still like to see addressed there (batching or skipping the settle for a range that's re-imported at the same address).
frankea commented 2026-10-15 17:52:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-15T17:52:58Z.


Astro Bot on an RTX 4090 (NVIDIA 616.92), the title intro, this PR against main and #6060 on one base, three alternating rounds each: main 3.0 FPS, this PR 16.0 FPS, #6060 15.1 FPS; GPU busy per present 164 → 33 ms. No stop in three 200 s runs. The full table, setup and summary lines are in https://github.com/boykopovar/AnyPS5/pull/6060#issuecomment-6198650709 (same executable, only libs/ swapped). Round 1 here was the cold shader cache and still completed its window. I did not measure the first-frame delay @Sevthered reported.

Tested with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6198654297 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5851#issuecomment-6198654297). Originally posted by [frankea](https://github.com/frankea) on 2026-10-15T17:52:58Z. --- Astro Bot on an RTX 4090 (NVIDIA 616.92), the title intro, this PR against `main` and #6060 on one base, three alternating rounds each: `main` 3.0 FPS, this PR **16.0 FPS**, #6060 15.1 FPS; GPU busy per present 164 → 33 ms. No stop in three 200 s runs. The full table, setup and summary lines are in https://github.com/boykopovar/AnyPS5/pull/6060#issuecomment-6198650709 (same executable, only `libs/` swapped). Round 1 here was the cold shader cache and still completed its window. I did not measure the first-frame delay @Sevthered reported. Tested with AI assistance (Claude Code).

Pull request closed

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!5851
No description provided.