perf(libc): fast-path resident-run scans in WindowsMappings::collect and collectable #27250

Merged
birdmarty merged 2 commits from upstream-pr/27250 into main 2026-11-27 09:41:11 +00:00
birdmarty commented 2026-11-25 15:44:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by birdmarty on 2026-11-25T15:44:57Z.


What

On Windows, WindowsMappings::collect and WindowsMappings::collectable walked the per-64 KiB views map entry by entry even across multi-megabyte resident runs tracked in residentRuns. On large surfaces (render targets, buffers, and textures), each write-watch query did redundant views.lower_bound / map iteration and per-page clamping even when the entire range lay inside a single resident run with no PAGE_NOACCESS pages.

Changes

  • core/libs/prx/libc/include/WindowsMappings.hpp:
    • Track hasNoAccess on each resident Run via updateResidentNoAccess(start, end, protection) on both Commit and SetProtection (follow-up bc6c3abd98): sets hasNoAccess on PAGE_NOACCESS, clears it in O(1) when an entire run is restored, and rescans the run's views on partial restoration so the fast path resumes once no PAGE_NOACCESS pages remain.
    • In collectable and collect (including Collection::Fresh), advance directly across resident runs from residentRuns before touching views, initializing the views iterator lazily only when a non-resident range is reached.
    • Skip ownedWords.erase in disown when ownedWords is empty, and skip the per-page clamp loop in collectResident when from is already 4 KiB aligned.
    • Under #ifdef APS5_COUNT_MAPPING_QUERIES, expose ResidentRunHasNoAccess(address) for write-watch tests.
  • core/libs/tests/WindowsWriteWatch.cpp: add CheckResidentRunNoAccessTransitions() covering full and partial PAGE_NOACCESS set and restore transitions via Map, SetProtection, and Commit, verifying both Collect outcomes and hasNoAccess flag restoration.

Tested

Windows 11 Pro (build 26300), i9-9900K, MinGW-w64 GCC 15.3.0, Release build.

Unit tests on bc6c3abd98 (follow-up on 2f6c010189, base origin/main c032ba7c52):

  • ctest -R "^(windows_write_watch|windows_mappings|agc_private_collect)": 9 / 9 passed (windows_write_watch, windows_write_watch_verify_direct, windows_mappings_release, windows_mappings_release_mismatch_{0,1,2}, windows_mappings_lock, windows_mappings_lock_pthread, agc_private_collect).
  • ctest -R "^public_headers": 65 / 65 passed.
  • Negative control (disabling hasNoAccess clearing to match 2f6c010189): windows_write_watch fails with restoring a full resident run via SetProtection did not clear hasNoAccess; passes on bc6c3abd98.
  • tools/check_conventions.py --base origin/main: passed.
  • tools/debt_fold.py --check: passed.

Lies of P (PPSA10621, v01.012.000, 3200x1800, Krat Central Station Plaza, AMD Radeon RX 6800, driver 26.10.1):

  • Measured as part of the Wave 1 stack (local test stack on 61250ca018 (together with #26581, #26681, and #26778)): 9.94 → 10.83 FPS (p50 99.9 → 91.0 ms, p90 108.9 → 99.2 ms, Graphics.Draw 65.7 → 62.1 ms/f), clean exit with 0 write-back errors.

Performance captures (APS5_TRACE_SECONDS=120:30, clean warm shader cache, no extra APS5_TRACE_* or APS5_PROFILE_* switches)

Same machine, title (PPSA10621, v01.012.000, 3200x1800, Krat Central Station Plaza), and flags (APS5_DRAW_PIPELINE=1 APS5_NO_DRAW_STAGING=1 APS5_PIPELINE_DISPATCH=1 APS5_PIPELINE_DISPATCH_MISSES=1 APS5_FAST_F32=1):

  • Baseline (main, c032ba7c52): 9.00 FPS, p50 110.5 ms, p90 117.7 ms, max 151.1 ms, gpu 70.31 ms/f, Graphics.Draw 72.33 ms/f (aps5-trace-c032ba7c5273-23148.json.gz).
  • This PR (2f6c010189): 9.31 FPS (+0.31), p50 106.1 ms (-4.4 ms), p90 114.7 ms (-3.0 ms), max 149.1 ms, gpu 68.70 ms/f (-1.61 ms/f), Graphics.Draw 72.86 ms/f (+0.53 ms/f) (aps5-trace-2f6c010189b9-35796.json.gz).

Baseline aps5-summary.jsonl (c032ba7c52):

{"commit":"c032ba7c5273","dirty":false,"env":{"APS5_DRAW_PIPELINE":"1","APS5_FAST_F32":"1","APS5_NO_DRAW_STAGING":"1","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DISPATCH_MISSES":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:30"},"gpu":"AMD Radeon RX 6800","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32705,"title_id":"PPSA10621","title":"Lies of P","content_version":"01.012.000","resolution":"3200x1800","window":{"spec":"seconds 120:30","first_present":1868,"ms":30000.335},"presents":270,"frame_ms":{"p50":110.451,"p90":117.685,"p99":136.262,"max":151.058},"gpu_busy_ms_per_present":70.305,"worker_busy_pct":{"queue worker 0x0":76.542,"queue worker 0x20":99.732},"phase_totals_ms":{"Driver.Completion":6.857,"Driver.Dispatch":2576.211,"Driver.Dispatch.capture_resources":776.998,"Driver.Dispatch.decode_key_device_setup":90.334,"Driver.Dispatch.lookup_cache":24.295,"Driver.Dispatch.materialize":107.798,"Driver.Dispatch.prepared_invocation":85.609,"Driver.Draw":11311.458,"Driver.Draw.device_setup":2083.563,"Driver.Draw.draw_enqueued":74.404,"Driver.Draw.draw_handed_off":2299.969,"Driver.Draw.post_compile_prepare":4.101,"Driver.Draw.prepare":6471.236,"Driver.Draw.shader_compile_and_link":335.428,"Driver.DrawFinish":13623.764,"Driver.DrawFinish.draw_enqueued":6140.677,"Driver.DrawFinish.post_compile_prepare":173.565,"Driver.DrawFinish.shader_compile_and_link":7239.851,"Driver.EndSubmission":360.907,"Driver.Packet":52514.955,"Driver.Packet.device_lock":253.798,"Driver.Packet.dispatch":3719.685,"Driver.Packet.draw":11447.079,"Driver.Packet.execute":2730.492,"Driver.Packet.flip_flush":6.178,"Driver.Packet.flush_between_packets":606.336,"Driver.Packet.memory_wait":26653.660,"Driver.Packet.pipeline_drain":3757.506,"Driver.Packet.pipeline_prepare":355.259,"Driver.Packet.prepare_memory":1068.661,"Driver.Packet.rendering_wait":0.887,"Driver.Present":1078.304,"Driver.Present.acquire_image":254.049,"Driver.Present.device_setup":0.153,"Driver.Present.gpu_mutex_wait":63.352,"Driver.Present.inflight_wait":0.586,"Driver.Present.present_display_buffer":36.162,"Driver.Present.queue_present":32.722,"Driver.Present.release_and_callback":0.469,"Driver.Present.render_fence_wait":690.093,"Driver.Present.resize":0.449,"Driver.Present.validate":0.114,"Driver.Suspend":0.074,"GpuMutex.wait.copy":0.000,"GpuMutex.wait.dispatch":413.521,"GpuMutex.wait.draw":184.806,"GpuMutex.wait.end":177.694,"GpuMutex.wait.fill":480.794,"GpuMutex.wait.flush":136.035,"GpuMutex.wait.hook":463.906,"GpuMutex.wait.indirect":0.179,"GpuMutex.wait.label":552.065,"GpuMutex.wait.other":282.692,"GpuMutex.wait.present":62.604,"Graphics.Draw":19528.738,"Graphics.Draw.draw_and_resource_release":16102.692,"Graphics.Draw.index_upload":1387.602,"Graphics.Draw.validate":733.456,"Graphics.Draw.vertex_upload":1141.137,"Recorder.Reap":861.632,"Recorder.Submit":1319.579,"Recorder.Sync":1178.759,"Resources.Complete":753.864,"Resources.Prepare":728.019,"Shader.DrawStage":6992.760,"Shader.DrawStage.capture_resources":3601.401,"Shader.DrawStage.materialize":2383.009,"Shader.DrawStage.prepared_invocation":927.267,"VideoOut.Flip":1083.682,"VideoOut.Flip.completion_mutex_wait":0.258,"VideoOut.Flip.config_mutex_wait":0.032,"VideoOut.Flip.frame_limit":0.133,"VideoOut.Flip.notify_game":4.699,"VideoOut.Flip.present":1075.826,"VideoOut.Flip.validate":0.307,"VideoOut.Flip.vblank_wait":0.170,"VideoOut.Flip.window_prepare":0.356,"VideoOut.Flip.window_title":1.683,"VideoOut.Readiness":0.685,"VideoOut.Readiness.locks_validate":0.254,"Vulkan.Acquire":253.762,"Vulkan.Acquire.acquire_fence_wait":232.181,"Vulkan.Acquire.acquire_image":20.320,"Vulkan.Acquire.fence_reset":0.655,"Vulkan.Acquire.retired_swapchains":0.489,"Vulkan.Dispatch":1208.475,"Vulkan.Dispatch.command_record":368.902,"Vulkan.Dispatch.shader_resources":822.450,"Vulkan.DispatchRecipe":32.147,"Vulkan.DispatchRecipe.command_record":31.604,"Vulkan.Present":17.962,"Vulkan.Present.command_record_scale":8.194,"Vulkan.Present.pixel_upload":5.610,"Vulkan.Present.queue_submit":3.959,"Vulkan.QueuePresent":32.203,"Vulkan.QueuePresent.queue_present":31.778,"Vulkan.Retire":1036.495,"Vulkan.Retire.wait":683.040},"top_phases_ms_per_frame":{"Driver.Packet":194.500,"Driver.Packet.memory_wait":98.717,"Graphics.Draw":72.329,"Graphics.Draw.draw_and_resource_release":59.640,"Driver.DrawFinish":50.458,"Driver.Packet.draw":42.397,"Driver.Draw":41.894,"Driver.DrawFinish.shader_compile_and_link":26.814},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":18469,"Graphics.Barrier.dcc-clear":6752,"Graphics.Barrier.dcc-keys":4044,"Graphics.Barrier.dispatch-lead":29397,"Graphics.Barrier.dispatch-trail":44403,"Graphics.Barrier.draw":200066,"Graphics.Barrier.fill":5996,"Graphics.Barrier.fill-clear":1620,"Graphics.Barrier.indirect-args":1080,"Graphics.Barrier.input-mirror":31,"Graphics.Barrier.label-run":285608,"Graphics.Barrier.present-blit":540,"Graphics.Barrier.shadow-publish":927,"Graphics.Barrier.staging-in":43119,"Graphics.Barrier.staging-out":20753,"Graphics.Barrier.storage-upload":292,"Graphics.Barrier.storage-writeback":10235,"Graphics.BarrierMerged.copy":201,"Graphics.BarrierMerged.dispatch-lead":17166,"Graphics.BarrierMerged.fill":2374,"Graphics.BarrierMerged.label-run":1753,"Graphics.BarrierMerged.shadow-publish":927,"Graphics.BarrierMerged.staging-in":19140,"Graphics.BarrierMerged.staging-out":20753,"Graphics.BarrierMerged.storage-writeback":2277,"Graphics.Copy":63947,"Graphics.Copy.bytes":18255207206,"Graphics.RenderPass":119930,"Graphics.RenderPass.Close.command":8707,"Graphics.RenderPass.Close.image":48617,"Graphics.RenderPass.Close.key":14146,"Graphics.RenderPass.Close.label":1753,"Graphics.RenderPass.Close.new-batch":46707,"Graphics.RenderPass.Continued":378527},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":19.158,"events_lost":147525,"totals_full":false},"draw committer":{"events_full_after_s":12.580,"events_lost":360672,"totals_full":false},"draw finisher":{"events_full_after_s":19.018,"events_lost":151019,"totals_full":false}},"trace":"aps5-trace-c032ba7c5273-23148.json.gz"}

Candidate aps5-summary.jsonl (2f6c010189):

{"commit":"2f6c010189b9","dirty":false,"env":{"APS5_DRAW_PIPELINE":"1","APS5_FAST_F32":"1","APS5_NO_DRAW_STAGING":"1","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DISPATCH_MISSES":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:30"},"gpu":"AMD Radeon RX 6800","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32705,"title_id":"PPSA10621","title":"Lies of P","content_version":"01.012.000","resolution":"3200x1800","window":{"spec":"seconds 120:30","first_present":1975,"ms":30088.239},"presents":280,"frame_ms":{"p50":106.056,"p90":114.705,"p99":145.854,"max":149.091},"gpu_busy_ms_per_present":68.696,"worker_busy_pct":{"queue worker 0x0":75.474,"queue worker 0x20":99.734},"phase_totals_ms":{"Driver.Completion":7.540,"Driver.Dispatch":2949.785,"Driver.Dispatch.capture_resources":837.235,"Driver.Dispatch.decode_key_device_setup":100.518,"Driver.Dispatch.lookup_cache":26.040,"Driver.Dispatch.materialize":118.669,"Driver.Dispatch.prepared_invocation":91.901,"Driver.Draw":10519.151,"Driver.Draw.device_setup":2496.281,"Driver.Draw.draw_enqueued":88.677,"Driver.Draw.draw_handed_off":2548.037,"Driver.Draw.post_compile_prepare":4.353,"Driver.Draw.prepare":4975.941,"Driver.Draw.shader_compile_and_link":359.968,"Driver.DrawFinish":12168.356,"Driver.DrawFinish.draw_enqueued":4120.460,"Driver.DrawFinish.post_compile_prepare":190.457,"Driver.DrawFinish.shader_compile_and_link":7775.130,"Driver.EndSubmission":372.979,"Driver.Packet":52336.613,"Driver.Packet.device_lock":265.312,"Driver.Packet.dispatch":3998.503,"Driver.Packet.draw":10663.636,"Driver.Packet.execute":2491.091,"Driver.Packet.flip_flush":6.487,"Driver.Packet.flush_between_packets":667.598,"Driver.Packet.memory_wait":26485.923,"Driver.Packet.pipeline_drain":3692.309,"Driver.Packet.pipeline_prepare":376.981,"Driver.Packet.prepare_memory":1267.905,"Driver.Packet.rendering_wait":0.973,"Driver.Present":902.945,"Driver.Present.acquire_image":209.502,"Driver.Present.device_setup":0.181,"Driver.Present.gpu_mutex_wait":7.256,"Driver.Present.inflight_wait":0.673,"Driver.Present.present_display_buffer":36.915,"Driver.Present.queue_present":36.734,"Driver.Present.release_and_callback":0.577,"Driver.Present.render_fence_wait":610.392,"Driver.Present.resize":0.479,"Driver.Present.validate":0.059,"Driver.Suspend":0.079,"GpuMutex.wait.dispatch":516.912,"GpuMutex.wait.draw":210.676,"GpuMutex.wait.end":177.440,"GpuMutex.wait.fill":607.958,"GpuMutex.wait.flush":109.836,"GpuMutex.wait.hook":411.366,"GpuMutex.wait.indirect":0.168,"GpuMutex.wait.label":627.068,"GpuMutex.wait.other":409.623,"GpuMutex.wait.present":6.411,"Graphics.Draw":20401.695,"Graphics.Draw.draw_and_resource_release":16847.117,"Graphics.Draw.index_upload":1410.405,"Graphics.Draw.validate":785.981,"Graphics.Draw.vertex_upload":1179.492,"Recorder.Reap":961.220,"Recorder.Submit":1358.832,"Recorder.Sync":128.516,"Resources.Complete":782.407,"Resources.Prepare":747.037,"Shader.DrawStage":7516.980,"Shader.DrawStage.capture_resources":3859.974,"Shader.DrawStage.materialize":2592.194,"Shader.DrawStage.prepared_invocation":978.350,"VideoOut.Flip":908.717,"VideoOut.Flip.completion_mutex_wait":0.287,"VideoOut.Flip.config_mutex_wait":0.036,"VideoOut.Flip.frame_limit":0.146,"VideoOut.Flip.notify_game":4.928,"VideoOut.Flip.present":900.415,"VideoOut.Flip.validate":0.330,"VideoOut.Flip.vblank_wait":0.224,"VideoOut.Flip.window_prepare":0.407,"VideoOut.Flip.window_title":1.649,"VideoOut.Readiness":0.682,"VideoOut.Readiness.locks_validate":0.243,"Vulkan.Acquire":209.207,"Vulkan.Acquire.acquire_fence_wait":185.468,"Vulkan.Acquire.acquire_image":22.354,"Vulkan.Acquire.fence_reset":0.725,"Vulkan.Acquire.retired_swapchains":0.533,"Vulkan.Dispatch":1255.362,"Vulkan.Dispatch.command_record":417.635,"Vulkan.Dispatch.shader_resources":820.316,"Vulkan.DispatchRecipe":35.040,"Vulkan.DispatchRecipe.command_record":34.489,"Vulkan.Present":19.119,"Vulkan.Present.command_record_scale":8.951,"Vulkan.Present.pixel_upload":5.548,"Vulkan.Present.queue_submit":4.408,"Vulkan.QueuePresent":36.135,"Vulkan.QueuePresent.queue_present":35.676,"Vulkan.Retire":610.378,"Vulkan.Retire.wait":603.393},"top_phases_ms_per_frame":{"Driver.Packet":186.916,"Driver.Packet.memory_wait":94.593,"Graphics.Draw":72.863,"Graphics.Draw.draw_and_resource_release":60.168,"Driver.DrawFinish":43.458,"Driver.Packet.draw":38.084,"Driver.Draw":37.568,"Driver.DrawFinish.shader_compile_and_link":27.768},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":18381,"Graphics.Barrier.dcc-clear":7004,"Graphics.Barrier.dcc-keys":4198,"Graphics.Barrier.dispatch-lead":30744,"Graphics.Barrier.dispatch-trail":45976,"Graphics.Barrier.draw":208033,"Graphics.Barrier.fill":6703,"Graphics.Barrier.fill-clear":1680,"Graphics.Barrier.indirect-args":1120,"Graphics.Barrier.input-mirror":23,"Graphics.Barrier.label-run":301955,"Graphics.Barrier.present-blit":560,"Graphics.Barrier.shadow-publish":854,"Graphics.Barrier.staging-in":44354,"Graphics.Barrier.staging-out":21454,"Graphics.Barrier.storage-upload":242,"Graphics.Barrier.storage-writeback":10395,"Graphics.BarrierMerged.copy":156,"Graphics.BarrierMerged.dispatch-lead":17472,"Graphics.BarrierMerged.fill":2537,"Graphics.BarrierMerged.label-run":1626,"Graphics.BarrierMerged.shadow-publish":854,"Graphics.BarrierMerged.staging-in":20007,"Graphics.BarrierMerged.staging-out":21454,"Graphics.BarrierMerged.storage-writeback":2252,"Graphics.Copy":66171,"Graphics.Copy.bytes":19454104218,"Graphics.RenderPass":124853,"Graphics.RenderPass.Close.command":8854,"Graphics.RenderPass.Close.image":50233,"Graphics.RenderPass.Close.key":14274,"Graphics.RenderPass.Close.label":1626,"Graphics.RenderPass.Close.new-batch":49866,"Graphics.RenderPass.Continued":393021},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":17.009,"events_lost":200793,"totals_full":false},"draw committer":{"events_full_after_s":12.140,"events_lost":390508,"totals_full":false},"draw finisher":{"events_full_after_s":17.621,"events_lost":185097,"totals_full":false}},"trace":"aps5-trace-2f6c010189b9-35796.json.gz"}

Series context & interleaved ablation

This PR is part of a general AGC/libc performance series measured on Lies of P (PPSA10621, v01.012.000, 3200x1800, UE4) covering #27249, #27250, #27251, #27252, #27253, #27254, #27268, #27269, #27270, #27271, and #27273 (tested together with #20130, #18757, #26778, #27117, and now-merged #26581 and #26681). Combined on base 61250ca018 (plus remaining unsplit stack changes), steady-state performance rose from 7.25 FPS (p50 135.6 ms, gpu 92.7 ms/f, default settings) to 12.15 FPS average (12.00 / 12.30 FPS, peak 12.33 FPS, p50 81.5 ms, gpu 57.12 ms/f, +67.6% to +70.1%).

Because five of the smaller PRs (#27253, #27254, #27270, #27271, and #27273) looked like they slightly lost average FPS (-0.03 to -0.31 FPS) in single isolated runs on c032ba7c52, we ran an interleaved 4-run ablation (A1 -> B1 -> A2 -> B2, APS5_TRACE_SECONDS=120:30, identical warm shader cache and flags) on the full stack to test whether removing those 5 PRs helped or hurt:

Run Build FPS p50 (ms) p90 (ms) max (ms) GPU busy (ms/f) DrawWithRecipe (ms/f) DrawFinish (ms/f)
A1 Arm A (base 61250ca018, WITH all 11 PRs incl. #27253, #27254, #27270, #27271, #27273) 12.00 81.9 90.5 117.9 58.58 46.22 42.16
B1 Arm B (base 61250ca018, MINUS #27253, #27254, #27270, #27271, #27273) 11.86 82.4 92.9 122.9 58.96 46.65 42.71
A2 Arm A (base 61250ca018, WITH all 11 PRs incl. #27253, #27254, #27270, #27271, #27273) 12.30 81.0 87.3 108.8 55.66 45.71 42.24
B2 Arm B (base 61250ca018, MINUS #27253, #27254, #27270, #27271, #27273) 11.65 84.7 94.1 124.8 61.69 47.32 43.45
Arm A avg Full stack (WITH all 11 PRs) 12.15 81.5 88.9 113.4 57.12 45.96 42.20
Arm B avg Minus #27253, #27254, #27270, #27271, #27273 11.76 83.5 93.5 123.9 60.33 46.98 43.08
Effect of the 5 PRs (A vs B) — +0.39 FPS (+3.3%) -2.1 ms -4.6 ms -10.5 ms -3.21 ms/f -1.02 ms/f -0.88 ms/f

Removing those 5 PRs hurt every run (A1 > B1 and A2 > B2 across all metrics), showing that their single-run isolated dips on c032ba7c52 were within ±0.25 FPS scene variance while larger bottlenecks (#27268, #27249, #27252, #20130, #18757) still dominated. Individual PR captures above remain isolated against c032ba7c52.

Not tested: Linux (file is Windows-only), fresh Lies of P capture on follow-up bc6c3abd98 (captures above are from 2f6c010189).

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (libc Windows memory mapping path)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5494541348 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27250). Originally posted by [birdmarty](https://github.com/birdmarty) on 2026-11-25T15:44:57Z. --- ### What On Windows, `WindowsMappings::collect` and `WindowsMappings::collectable` walked the per-64 KiB `views` map entry by entry even across multi-megabyte resident runs tracked in `residentRuns`. On large surfaces (render targets, buffers, and textures), each write-watch query did redundant `views.lower_bound` / map iteration and per-page clamping even when the entire range lay inside a single resident run with no `PAGE_NOACCESS` pages. #### Changes - `core/libs/prx/libc/include/WindowsMappings.hpp`: - Track `hasNoAccess` on each resident `Run` via `updateResidentNoAccess(start, end, protection)` on both `Commit` and `SetProtection` (follow-up bc6c3abd98): sets `hasNoAccess` on `PAGE_NOACCESS`, clears it in O(1) when an entire run is restored, and rescans the run's views on partial restoration so the fast path resumes once no `PAGE_NOACCESS` pages remain. - In `collectable` and `collect` (including `Collection::Fresh`), advance directly across resident runs from `residentRuns` before touching `views`, initializing the `views` iterator lazily only when a non-resident range is reached. - Skip `ownedWords.erase` in `disown` when `ownedWords` is empty, and skip the per-page clamp loop in `collectResident` when `from` is already 4 KiB aligned. - Under `#ifdef APS5_COUNT_MAPPING_QUERIES`, expose `ResidentRunHasNoAccess(address)` for write-watch tests. - `core/libs/tests/WindowsWriteWatch.cpp`: add `CheckResidentRunNoAccessTransitions()` covering full and partial `PAGE_NOACCESS` set and restore transitions via `Map`, `SetProtection`, and `Commit`, verifying both `Collect` outcomes and `hasNoAccess` flag restoration. ### Tested Windows 11 Pro (build 26300), i9-9900K, MinGW-w64 GCC 15.3.0, Release build. Unit tests on bc6c3abd98 (follow-up on 2f6c010189, base `origin/main` c032ba7c52): - `ctest -R "^(windows_write_watch|windows_mappings|agc_private_collect)"`: **9 / 9 passed** (`windows_write_watch`, `windows_write_watch_verify_direct`, `windows_mappings_release`, `windows_mappings_release_mismatch_{0,1,2}`, `windows_mappings_lock`, `windows_mappings_lock_pthread`, `agc_private_collect`). - `ctest -R "^public_headers"`: **65 / 65 passed**. - Negative control (disabling `hasNoAccess` clearing to match 2f6c010189): `windows_write_watch` fails with `restoring a full resident run via SetProtection did not clear hasNoAccess`; passes on bc6c3abd98. - `tools/check_conventions.py --base origin/main`: passed. - `tools/debt_fold.py --check`: passed. Lies of P (`PPSA10621`, `v01.012.000`, `3200x1800`, Krat Central Station Plaza, AMD Radeon RX 6800, driver `26.10.1`): - Measured as part of the Wave 1 stack (local test stack on 61250ca018 (together with #26581, #26681, and #26778)): `9.94 → 10.83 FPS` (`p50 99.9 → 91.0 ms`, `p90 108.9 → 99.2 ms`, `Graphics.Draw 65.7 → 62.1 ms/f`), clean exit with 0 write-back errors. #### Performance captures (`APS5_TRACE_SECONDS=120:30`, clean warm shader cache, no extra `APS5_TRACE_*` or `APS5_PROFILE_*` switches) Same machine, title (`PPSA10621`, `v01.012.000`, `3200x1800`, Krat Central Station Plaza), and flags (`APS5_DRAW_PIPELINE=1 APS5_NO_DRAW_STAGING=1 APS5_PIPELINE_DISPATCH=1 APS5_PIPELINE_DISPATCH_MISSES=1 APS5_FAST_F32=1`): - Baseline (`main`, c032ba7c5273): `9.00 FPS`, `p50 110.5 ms`, `p90 117.7 ms`, `max 151.1 ms`, `gpu 70.31 ms/f`, `Graphics.Draw 72.33 ms/f` (`aps5-trace-c032ba7c5273-23148.json.gz`). - This PR (2f6c010189b9): `9.31 FPS` (`+0.31`), `p50 106.1 ms` (`-4.4 ms`), `p90 114.7 ms` (`-3.0 ms`), `max 149.1 ms`, `gpu 68.70 ms/f` (`-1.61 ms/f`), `Graphics.Draw 72.86 ms/f` (`+0.53 ms/f`) (`aps5-trace-2f6c010189b9-35796.json.gz`). Baseline `aps5-summary.jsonl` (c032ba7c5273): ```json {"commit":"c032ba7c5273","dirty":false,"env":{"APS5_DRAW_PIPELINE":"1","APS5_FAST_F32":"1","APS5_NO_DRAW_STAGING":"1","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DISPATCH_MISSES":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:30"},"gpu":"AMD Radeon RX 6800","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32705,"title_id":"PPSA10621","title":"Lies of P","content_version":"01.012.000","resolution":"3200x1800","window":{"spec":"seconds 120:30","first_present":1868,"ms":30000.335},"presents":270,"frame_ms":{"p50":110.451,"p90":117.685,"p99":136.262,"max":151.058},"gpu_busy_ms_per_present":70.305,"worker_busy_pct":{"queue worker 0x0":76.542,"queue worker 0x20":99.732},"phase_totals_ms":{"Driver.Completion":6.857,"Driver.Dispatch":2576.211,"Driver.Dispatch.capture_resources":776.998,"Driver.Dispatch.decode_key_device_setup":90.334,"Driver.Dispatch.lookup_cache":24.295,"Driver.Dispatch.materialize":107.798,"Driver.Dispatch.prepared_invocation":85.609,"Driver.Draw":11311.458,"Driver.Draw.device_setup":2083.563,"Driver.Draw.draw_enqueued":74.404,"Driver.Draw.draw_handed_off":2299.969,"Driver.Draw.post_compile_prepare":4.101,"Driver.Draw.prepare":6471.236,"Driver.Draw.shader_compile_and_link":335.428,"Driver.DrawFinish":13623.764,"Driver.DrawFinish.draw_enqueued":6140.677,"Driver.DrawFinish.post_compile_prepare":173.565,"Driver.DrawFinish.shader_compile_and_link":7239.851,"Driver.EndSubmission":360.907,"Driver.Packet":52514.955,"Driver.Packet.device_lock":253.798,"Driver.Packet.dispatch":3719.685,"Driver.Packet.draw":11447.079,"Driver.Packet.execute":2730.492,"Driver.Packet.flip_flush":6.178,"Driver.Packet.flush_between_packets":606.336,"Driver.Packet.memory_wait":26653.660,"Driver.Packet.pipeline_drain":3757.506,"Driver.Packet.pipeline_prepare":355.259,"Driver.Packet.prepare_memory":1068.661,"Driver.Packet.rendering_wait":0.887,"Driver.Present":1078.304,"Driver.Present.acquire_image":254.049,"Driver.Present.device_setup":0.153,"Driver.Present.gpu_mutex_wait":63.352,"Driver.Present.inflight_wait":0.586,"Driver.Present.present_display_buffer":36.162,"Driver.Present.queue_present":32.722,"Driver.Present.release_and_callback":0.469,"Driver.Present.render_fence_wait":690.093,"Driver.Present.resize":0.449,"Driver.Present.validate":0.114,"Driver.Suspend":0.074,"GpuMutex.wait.copy":0.000,"GpuMutex.wait.dispatch":413.521,"GpuMutex.wait.draw":184.806,"GpuMutex.wait.end":177.694,"GpuMutex.wait.fill":480.794,"GpuMutex.wait.flush":136.035,"GpuMutex.wait.hook":463.906,"GpuMutex.wait.indirect":0.179,"GpuMutex.wait.label":552.065,"GpuMutex.wait.other":282.692,"GpuMutex.wait.present":62.604,"Graphics.Draw":19528.738,"Graphics.Draw.draw_and_resource_release":16102.692,"Graphics.Draw.index_upload":1387.602,"Graphics.Draw.validate":733.456,"Graphics.Draw.vertex_upload":1141.137,"Recorder.Reap":861.632,"Recorder.Submit":1319.579,"Recorder.Sync":1178.759,"Resources.Complete":753.864,"Resources.Prepare":728.019,"Shader.DrawStage":6992.760,"Shader.DrawStage.capture_resources":3601.401,"Shader.DrawStage.materialize":2383.009,"Shader.DrawStage.prepared_invocation":927.267,"VideoOut.Flip":1083.682,"VideoOut.Flip.completion_mutex_wait":0.258,"VideoOut.Flip.config_mutex_wait":0.032,"VideoOut.Flip.frame_limit":0.133,"VideoOut.Flip.notify_game":4.699,"VideoOut.Flip.present":1075.826,"VideoOut.Flip.validate":0.307,"VideoOut.Flip.vblank_wait":0.170,"VideoOut.Flip.window_prepare":0.356,"VideoOut.Flip.window_title":1.683,"VideoOut.Readiness":0.685,"VideoOut.Readiness.locks_validate":0.254,"Vulkan.Acquire":253.762,"Vulkan.Acquire.acquire_fence_wait":232.181,"Vulkan.Acquire.acquire_image":20.320,"Vulkan.Acquire.fence_reset":0.655,"Vulkan.Acquire.retired_swapchains":0.489,"Vulkan.Dispatch":1208.475,"Vulkan.Dispatch.command_record":368.902,"Vulkan.Dispatch.shader_resources":822.450,"Vulkan.DispatchRecipe":32.147,"Vulkan.DispatchRecipe.command_record":31.604,"Vulkan.Present":17.962,"Vulkan.Present.command_record_scale":8.194,"Vulkan.Present.pixel_upload":5.610,"Vulkan.Present.queue_submit":3.959,"Vulkan.QueuePresent":32.203,"Vulkan.QueuePresent.queue_present":31.778,"Vulkan.Retire":1036.495,"Vulkan.Retire.wait":683.040},"top_phases_ms_per_frame":{"Driver.Packet":194.500,"Driver.Packet.memory_wait":98.717,"Graphics.Draw":72.329,"Graphics.Draw.draw_and_resource_release":59.640,"Driver.DrawFinish":50.458,"Driver.Packet.draw":42.397,"Driver.Draw":41.894,"Driver.DrawFinish.shader_compile_and_link":26.814},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":18469,"Graphics.Barrier.dcc-clear":6752,"Graphics.Barrier.dcc-keys":4044,"Graphics.Barrier.dispatch-lead":29397,"Graphics.Barrier.dispatch-trail":44403,"Graphics.Barrier.draw":200066,"Graphics.Barrier.fill":5996,"Graphics.Barrier.fill-clear":1620,"Graphics.Barrier.indirect-args":1080,"Graphics.Barrier.input-mirror":31,"Graphics.Barrier.label-run":285608,"Graphics.Barrier.present-blit":540,"Graphics.Barrier.shadow-publish":927,"Graphics.Barrier.staging-in":43119,"Graphics.Barrier.staging-out":20753,"Graphics.Barrier.storage-upload":292,"Graphics.Barrier.storage-writeback":10235,"Graphics.BarrierMerged.copy":201,"Graphics.BarrierMerged.dispatch-lead":17166,"Graphics.BarrierMerged.fill":2374,"Graphics.BarrierMerged.label-run":1753,"Graphics.BarrierMerged.shadow-publish":927,"Graphics.BarrierMerged.staging-in":19140,"Graphics.BarrierMerged.staging-out":20753,"Graphics.BarrierMerged.storage-writeback":2277,"Graphics.Copy":63947,"Graphics.Copy.bytes":18255207206,"Graphics.RenderPass":119930,"Graphics.RenderPass.Close.command":8707,"Graphics.RenderPass.Close.image":48617,"Graphics.RenderPass.Close.key":14146,"Graphics.RenderPass.Close.label":1753,"Graphics.RenderPass.Close.new-batch":46707,"Graphics.RenderPass.Continued":378527},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":19.158,"events_lost":147525,"totals_full":false},"draw committer":{"events_full_after_s":12.580,"events_lost":360672,"totals_full":false},"draw finisher":{"events_full_after_s":19.018,"events_lost":151019,"totals_full":false}},"trace":"aps5-trace-c032ba7c5273-23148.json.gz"} ``` Candidate `aps5-summary.jsonl` (2f6c010189b9): ```json {"commit":"2f6c010189b9","dirty":false,"env":{"APS5_DRAW_PIPELINE":"1","APS5_FAST_F32":"1","APS5_NO_DRAW_STAGING":"1","APS5_PIPELINE_DISPATCH":"1","APS5_PIPELINE_DISPATCH_MISSES":"1","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"120:30"},"gpu":"AMD Radeon RX 6800","driver":"AMD proprietary driver 26.10.1 (AMD proprietary shader compiler)","os":"Windows 10.0.26300","cpu":"Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz","cpu_threads":16,"memory_mib":32705,"title_id":"PPSA10621","title":"Lies of P","content_version":"01.012.000","resolution":"3200x1800","window":{"spec":"seconds 120:30","first_present":1975,"ms":30088.239},"presents":280,"frame_ms":{"p50":106.056,"p90":114.705,"p99":145.854,"max":149.091},"gpu_busy_ms_per_present":68.696,"worker_busy_pct":{"queue worker 0x0":75.474,"queue worker 0x20":99.734},"phase_totals_ms":{"Driver.Completion":7.540,"Driver.Dispatch":2949.785,"Driver.Dispatch.capture_resources":837.235,"Driver.Dispatch.decode_key_device_setup":100.518,"Driver.Dispatch.lookup_cache":26.040,"Driver.Dispatch.materialize":118.669,"Driver.Dispatch.prepared_invocation":91.901,"Driver.Draw":10519.151,"Driver.Draw.device_setup":2496.281,"Driver.Draw.draw_enqueued":88.677,"Driver.Draw.draw_handed_off":2548.037,"Driver.Draw.post_compile_prepare":4.353,"Driver.Draw.prepare":4975.941,"Driver.Draw.shader_compile_and_link":359.968,"Driver.DrawFinish":12168.356,"Driver.DrawFinish.draw_enqueued":4120.460,"Driver.DrawFinish.post_compile_prepare":190.457,"Driver.DrawFinish.shader_compile_and_link":7775.130,"Driver.EndSubmission":372.979,"Driver.Packet":52336.613,"Driver.Packet.device_lock":265.312,"Driver.Packet.dispatch":3998.503,"Driver.Packet.draw":10663.636,"Driver.Packet.execute":2491.091,"Driver.Packet.flip_flush":6.487,"Driver.Packet.flush_between_packets":667.598,"Driver.Packet.memory_wait":26485.923,"Driver.Packet.pipeline_drain":3692.309,"Driver.Packet.pipeline_prepare":376.981,"Driver.Packet.prepare_memory":1267.905,"Driver.Packet.rendering_wait":0.973,"Driver.Present":902.945,"Driver.Present.acquire_image":209.502,"Driver.Present.device_setup":0.181,"Driver.Present.gpu_mutex_wait":7.256,"Driver.Present.inflight_wait":0.673,"Driver.Present.present_display_buffer":36.915,"Driver.Present.queue_present":36.734,"Driver.Present.release_and_callback":0.577,"Driver.Present.render_fence_wait":610.392,"Driver.Present.resize":0.479,"Driver.Present.validate":0.059,"Driver.Suspend":0.079,"GpuMutex.wait.dispatch":516.912,"GpuMutex.wait.draw":210.676,"GpuMutex.wait.end":177.440,"GpuMutex.wait.fill":607.958,"GpuMutex.wait.flush":109.836,"GpuMutex.wait.hook":411.366,"GpuMutex.wait.indirect":0.168,"GpuMutex.wait.label":627.068,"GpuMutex.wait.other":409.623,"GpuMutex.wait.present":6.411,"Graphics.Draw":20401.695,"Graphics.Draw.draw_and_resource_release":16847.117,"Graphics.Draw.index_upload":1410.405,"Graphics.Draw.validate":785.981,"Graphics.Draw.vertex_upload":1179.492,"Recorder.Reap":961.220,"Recorder.Submit":1358.832,"Recorder.Sync":128.516,"Resources.Complete":782.407,"Resources.Prepare":747.037,"Shader.DrawStage":7516.980,"Shader.DrawStage.capture_resources":3859.974,"Shader.DrawStage.materialize":2592.194,"Shader.DrawStage.prepared_invocation":978.350,"VideoOut.Flip":908.717,"VideoOut.Flip.completion_mutex_wait":0.287,"VideoOut.Flip.config_mutex_wait":0.036,"VideoOut.Flip.frame_limit":0.146,"VideoOut.Flip.notify_game":4.928,"VideoOut.Flip.present":900.415,"VideoOut.Flip.validate":0.330,"VideoOut.Flip.vblank_wait":0.224,"VideoOut.Flip.window_prepare":0.407,"VideoOut.Flip.window_title":1.649,"VideoOut.Readiness":0.682,"VideoOut.Readiness.locks_validate":0.243,"Vulkan.Acquire":209.207,"Vulkan.Acquire.acquire_fence_wait":185.468,"Vulkan.Acquire.acquire_image":22.354,"Vulkan.Acquire.fence_reset":0.725,"Vulkan.Acquire.retired_swapchains":0.533,"Vulkan.Dispatch":1255.362,"Vulkan.Dispatch.command_record":417.635,"Vulkan.Dispatch.shader_resources":820.316,"Vulkan.DispatchRecipe":35.040,"Vulkan.DispatchRecipe.command_record":34.489,"Vulkan.Present":19.119,"Vulkan.Present.command_record_scale":8.951,"Vulkan.Present.pixel_upload":5.548,"Vulkan.Present.queue_submit":4.408,"Vulkan.QueuePresent":36.135,"Vulkan.QueuePresent.queue_present":35.676,"Vulkan.Retire":610.378,"Vulkan.Retire.wait":603.393},"top_phases_ms_per_frame":{"Driver.Packet":186.916,"Driver.Packet.memory_wait":94.593,"Graphics.Draw":72.863,"Graphics.Draw.draw_and_resource_release":60.168,"Driver.DrawFinish":43.458,"Driver.Packet.draw":38.084,"Driver.Draw":37.568,"Driver.DrawFinish.shader_compile_and_link":27.768},"owned_draw_counts":{},"graphics_track":{"Graphics.Barrier.copy":18381,"Graphics.Barrier.dcc-clear":7004,"Graphics.Barrier.dcc-keys":4198,"Graphics.Barrier.dispatch-lead":30744,"Graphics.Barrier.dispatch-trail":45976,"Graphics.Barrier.draw":208033,"Graphics.Barrier.fill":6703,"Graphics.Barrier.fill-clear":1680,"Graphics.Barrier.indirect-args":1120,"Graphics.Barrier.input-mirror":23,"Graphics.Barrier.label-run":301955,"Graphics.Barrier.present-blit":560,"Graphics.Barrier.shadow-publish":854,"Graphics.Barrier.staging-in":44354,"Graphics.Barrier.staging-out":21454,"Graphics.Barrier.storage-upload":242,"Graphics.Barrier.storage-writeback":10395,"Graphics.BarrierMerged.copy":156,"Graphics.BarrierMerged.dispatch-lead":17472,"Graphics.BarrierMerged.fill":2537,"Graphics.BarrierMerged.label-run":1626,"Graphics.BarrierMerged.shadow-publish":854,"Graphics.BarrierMerged.staging-in":20007,"Graphics.BarrierMerged.staging-out":21454,"Graphics.BarrierMerged.storage-writeback":2252,"Graphics.Copy":66171,"Graphics.Copy.bytes":19454104218,"Graphics.RenderPass":124853,"Graphics.RenderPass.Close.command":8854,"Graphics.RenderPass.Close.image":50233,"Graphics.RenderPass.Close.key":14274,"Graphics.RenderPass.Close.label":1626,"Graphics.RenderPass.Close.new-batch":49866,"Graphics.RenderPass.Continued":393021},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":17.009,"events_lost":200793,"totals_full":false},"draw committer":{"events_full_after_s":12.140,"events_lost":390508,"totals_full":false},"draw finisher":{"events_full_after_s":17.621,"events_lost":185097,"totals_full":false}},"trace":"aps5-trace-2f6c010189b9-35796.json.gz"} ``` #### Series context & interleaved ablation This PR is part of a general AGC/libc performance series measured on Lies of P (`PPSA10621`, `v01.012.000`, `3200x1800`, UE4) covering #27249, #27250, #27251, #27252, #27253, #27254, #27268, #27269, #27270, #27271, and #27273 (tested together with #20130, #18757, #26778, #27117, and now-merged #26581 and #26681). Combined on base 61250ca018 (plus remaining unsplit stack changes), steady-state performance rose from `7.25 FPS` (`p50 135.6 ms`, `gpu 92.7 ms/f`, default settings) to `12.15 FPS` average (`12.00` / `12.30 FPS`, peak `12.33 FPS`, `p50 81.5 ms`, `gpu 57.12 ms/f`, `+67.6%` to `+70.1%`). Because five of the smaller PRs (#27253, #27254, #27270, #27271, and #27273) looked like they slightly lost average FPS (`-0.03` to `-0.31 FPS`) in single isolated runs on c032ba7c52, we ran an interleaved 4-run ablation (`A1 -> B1 -> A2 -> B2`, `APS5_TRACE_SECONDS=120:30`, identical warm shader cache and flags) on the full stack to test whether removing those 5 PRs helped or hurt: - **Arm A — Full stack on base 61250ca018 (WITH all 11 PRs):** #27249, #27250, #27251, #27252, #27253, #27254, #27268, #27269, #27270, #27271, #27273 + #20130, #18757, #26778, #27117, #26581, #26681 + remaining unsplit stack changes (per-64 KiB proof/pending tracking and ShapeRecipe). - **Arm B — Same stack on base 61250ca018 MINUS the 5 PRs (#27253, #27254, #27270, #27271, #27273):** keeps #27249, #27250, #27251, #27252, #27268, #27269 + #20130, #18757, #26778, #27117, #26581, #26681 + remaining unsplit stack changes. | Run | Build | FPS | p50 (ms) | p90 (ms) | max (ms) | GPU busy (ms/f) | `DrawWithRecipe` (ms/f) | `DrawFinish` (ms/f) | |---|---|---:|---:|---:|---:|---:|---:|---:| | **A1** | Arm A (base 61250ca018, WITH all 11 PRs incl. #27253, #27254, #27270, #27271, #27273) | **12.00** | **81.9** | **90.5** | **117.9** | **58.58** | **46.22** | **42.16** | | **B1** | Arm B (base 61250ca018, MINUS #27253, #27254, #27270, #27271, #27273) | 11.86 | 82.4 | 92.9 | 122.9 | 58.96 | 46.65 | 42.71 | | **A2** | Arm A (base 61250ca018, WITH all 11 PRs incl. #27253, #27254, #27270, #27271, #27273) | **12.30** | **81.0** | **87.3** | **108.8** | **55.66** | **45.71** | **42.24** | | **B2** | Arm B (base 61250ca018, MINUS #27253, #27254, #27270, #27271, #27273) | 11.65 | 84.7 | 94.1 | 124.8 | 61.69 | 47.32 | 43.45 | | **Arm A avg** | **Full stack (WITH all 11 PRs)** | **12.15** | **81.5** | **88.9** | **113.4** | **57.12** | **45.96** | **42.20** | | **Arm B avg** | **Minus #27253, #27254, #27270, #27271, #27273** | **11.76** | **83.5** | **93.5** | **123.9** | **60.33** | **46.98** | **43.08** | | **Effect of the 5 PRs (A vs B)** | — | **`+0.39 FPS` (`+3.3%`)** | **`-2.1 ms`** | **`-4.6 ms`** | **`-10.5 ms`** | **`-3.21 ms/f`** | **`-1.02 ms/f`** | **`-0.88 ms/f`** | Removing those 5 PRs hurt every run (`A1 > B1` and `A2 > B2` across all metrics), showing that their single-run isolated dips on c032ba7c52 were within `±0.25 FPS` scene variance while larger bottlenecks (#27268, #27249, #27252, #20130, #18757) still dominated. Individual PR captures above remain isolated against c032ba7c52. Not tested: Linux (file is Windows-only), fresh Lies of P capture on follow-up bc6c3abd98 (captures above are from 2f6c010189). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (libc Windows memory mapping path) - [x] AI-assisted: yes
MarcZX10 commented 2026-11-25 15:52:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T15:52:20Z.

Review: COMMENTED


Reviewed — comments

Material uncertainty remains because I could not run the reported Windows checks or inspect the code’s callers and tests.

What I ran

Reviewed head 2f6c010189b9301ef5605452cc198485ab201e79 using the prepared diff and repo_read.py.

Results

Check Result Note
Diff and changed file passed One changed header read
Windows tests and build not run Author reports Windows results

Findings

Blocking

None verified.

Non-blocking

  • SetProtection and the Protect path only set Run::hasNoAccess when protection becomes PAGE_NOACCESS; they do not clear it when protection is restored. collectable may then fall back to per-view checks for an entire resident run even after access is restored. Consider updating the flag on every protection change, accounting for partial-run ranges. Evidence: core/libs/prx/libc/include/WindowsMappings.hpp:250, core/libs/prx/libc/include/WindowsMappings.hpp:1094.

Not verified

  • Did not run tests, build, or conventions/debt checks; the Windows results in the PR description are author-reported.
  • Did not inspect callers or tests for collect, collectable, or protection transitions.
  • Read review/description.md, review/commits.md, review/manifest.json, review/diff.patch, and the changed WindowsMappings.hpp ranges 70–270, 650–755, 1070–1125, and 1215–1315. review/files.json was not available through the reader; the file listing showed one changed file and no excluded changed-file content.

To get this to a good state

Nothing is required. Optional: update the resident-run no-access tracking on protection restoration, and cover partial and full-run protection transitions in tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6060803697 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27250#pullrequestreview-6060803697). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T15:52:20Z. **Review:** COMMENTED --- # Reviewed — comments Material uncertainty remains because I could not run the reported Windows checks or inspect the code’s callers and tests. ## What I ran Reviewed head `2f6c010189b9301ef5605452cc198485ab201e79` using the prepared diff and `repo_read.py`. ## Results | Check | Result | Note | |---|---|---| | Diff and changed file | passed | One changed header read | | Windows tests and build | not run | Author reports Windows results | ## Findings ### Blocking None verified. ### Non-blocking - `SetProtection` and the `Protect` path only set `Run::hasNoAccess` when protection becomes `PAGE_NOACCESS`; they do not clear it when protection is restored. `collectable` may then fall back to per-view checks for an entire resident run even after access is restored. Consider updating the flag on every protection change, accounting for partial-run ranges. Evidence: `core/libs/prx/libc/include/WindowsMappings.hpp:250`, `core/libs/prx/libc/include/WindowsMappings.hpp:1094`. ## Not verified - Did not run tests, build, or conventions/debt checks; the Windows results in the PR description are author-reported. - Did not inspect callers or tests for `collect`, `collectable`, or protection transitions. - Read `review/description.md`, `review/commits.md`, `review/manifest.json`, `review/diff.patch`, and the changed `WindowsMappings.hpp` ranges 70–270, 650–755, 1070–1125, and 1215–1315. `review/files.json` was not available through the reader; the file listing showed one changed file and no excluded changed-file content. ## To get this to a good state Nothing is required. Optional: update the resident-run no-access tracking on protection restoration, and cover partial and full-run protection transitions in tests.
MarcZX10 commented 2026-11-26 10:58:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T10:58:22Z.

Review: APPROVED


Reviewed — looks good

The change was reviewed at bc6c3abd9853cbc8ae386ee24c540711f1d0ee1a; the inspected resident-run fast paths and protection tracking are consistent with the described behavior, while builds and tests were not run here.

What I ran

  • Read the prepared diff, description, commit list, manifest, and the full text of both changed files through repo_read.py.
  • No build, test, or negative control was run in this review. Test results in the description are author-reported.

Results

Check Result Note
Changed code review passed Both changed files read
Build and tests not run Author-reported results only
Negative control not run Not independently checked

Findings

Blocking

None.

Non-blocking

None.

Not verified

No runtime or build checks were performed. The reported Windows tests and performance captures were not independently verified. Both files marked reviewed in the manifest were read; no files were excluded.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6072923524 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27250#pullrequestreview-6072923524). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-26T10:58:22Z. **Review:** APPROVED --- # Reviewed — looks good The change was reviewed at `bc6c3abd9853cbc8ae386ee24c540711f1d0ee1a`; the inspected resident-run fast paths and protection tracking are consistent with the described behavior, while builds and tests were not run here. ## What I ran - Read the prepared diff, description, commit list, manifest, and the full text of both changed files through `repo_read.py`. - No build, test, or negative control was run in this review. Test results in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | Both changed files read | | Build and tests | not run | Author-reported results only | | Negative control | not run | Not independently checked | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified No runtime or build checks were performed. The reported Windows tests and performance captures were not independently verified. Both files marked `reviewed` in the manifest were read; no files were excluded. ## To get this to a good state Nothing is required.
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!27250
No description provided.