perf(agc): widen small epoch collects to their 64 KiB block on Windows #6273

Merged
SoRadGaming merged 2 commits from upstream-pr/6273 into main 2026-11-03 16:42:56 +00:00
SoRadGaming commented 2026-10-15 08:41:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-15T08:41:09Z.


What

Within a collect epoch, #1310 widens a collect of at most one 64 KiB block to the whole block, so the epoch's collect memo serves the block's other ranges. It left Windows on the requested range because it was not tested there. Windows now widens too.

  • Why it matters more on Windows now. Since #5596, singly mapped direct memory is private MEM_WRITE_WATCH memory, and a walk over it is a GetWriteWatch call for each resident run it touches. With #6060, its host imports stay watched as well.
  • Measured. In ASTRO BOT's hub on main + #6060, queue worker 0 spends 12.4 % of its samples in GuestArenaCollectWrites → WindowsMappings::collectResident, mostly from ShaderResources::fastRevalidate on every draw. A local counter showed about 50k walks of at most 64 KiB per 10 s.
  • Uncommitted or inaccessible pages. Windows coverage (WriteWatchCoverage) does not know which pages of a block are committed or inaccessible. WindowsMappings::Collect refuses such a range before it collects anything (collectable). So a widened walk that fails is retried over the requested pages.
    • Without the retry, a collect beside uncommitted pages of its block fails, and callers take that as a failed collect. The new test checks this.
    • The retry is listed in the debt file.
  • Test expectation. This PR used to change agc_driver_image_table_reuse's Windows expectation (CpuWriteResolutions) to Linux's count. Main made the same change in e3dd06fea (since #6346 the unchanged proof is answered per page on Windows too), so the PR no longer touches that test.

Linux is unchanged: the widening block is the same, and the retry is Windows-only.

Tested

Windows 11 Pro 26200, Ryzen 7 5800X3D, Radeon RX 9070 XT (driver 32.0.23033.1002), WinLibs GCC 15.2.0 r7, Release.

  • New CheckWidenedCollectBesideUncommittedPages (agc_write_tracking, Windows):
    • The last 16 KiB of a 64 KiB block stays an uncommitted placeholder, which the test checks.
    • A 64-byte collect in the block must succeed and see a CPU write in the next epoch.
    • With the widening but without the retry, it fails with a collect beside uncommitted pages of its block failed.
  • agc_driver_image_table_reuse passes.
  • ctest, the whole suite on this commit (rebased onto main c0be1f69b): 1,250 of 1,254 pass.
    • agc_driver_quad_pixel_mask (implicit-LOD sample with quad pixel mask 2: pixel (0, 0) channel 2 is 2, expected 0) fails the same on this GPU with main's GuestMemory.cpp. It is from #6015's sample masks, not this change.
    • agc_driver_layered_volume_vertex_no_gpl also fails on this GPU without this change: on main e34c47921, and on #6060's head with and without its switch.
    • guest_gameupdate and guest_vr_setup_dialog don't start on this machine ("Process not started").
    • The video-out tests skip here (no SDL display).
  • tools/check_conventions.py --base origin/main passes.
  • Linux: not built here.

The frame-rate runs below were on main ab9a47684, before the rebase; the tests above ran on the rebased commit.

ASTRO BOT (PPSA21564 01.007.000), -lvl hub_crashsite (the full Crash Site hub), no input, warm shader cache (1,904 hits, 0 misses), APS5_NO_SNAPSHOT_CHECK=1 APS5_RESOURCE_CACHE_ENTRIES=4096.

  • The walks are cheap where imports are compared, so the measurement uses #6060. A is main ab9a47684 + #6060, and B is A + this PR.
  • Both use one relinked executable and the same libraries; only libSceAgcDriver.prx differs. Runs alternate.
  • FPS is the window's present counter over 120 s, after a 120 s settle.
A B (this PR)
hub FPS 3.09 / 3.11 / 3.10 / 3.08 3.20 / 3.20 (+3.4 %)

Trace summary lines, APS5_TRACE_SECONDS=300:30 in the same scene, no other APS5_TRACE_*/APS5_PROFILE_* switch, log not redirected. In every capture, queue worker 0's event buffer filled about 5.6 s into the window (trace_dropped). The four traces are available on request.

capture commit presents in 30 s frame ms p50 frame ms p90 gpu_busy ms/present queue worker 0x0 busy Driver.Packet ms/frame
A1 0e4cea2533e7 91 329.2 341.8 152.2 99.3 % 995
B1 76e7495c50a1 94 320.2 328.2 150.7 99.3 % 962
A2 0e4cea2533e7 91 333.4 341.6 151.0 99.3 % 1003
B2 76e7495c50a1 96 312.5 324.5 151.2 99.3 % 944

0e4cea2533e7 is A (main ab9a47684 + #6060) and 76e7495c50a1 is B (A + this PR's commit, cherry-picked). A's two captures and B's two were taken in separate sessions on the same day; the FPS rows above alternate.

Summary lines (A1, B1, A2, B2)
{"commit":"0e4cea2533e7","dirty":false,"env":{"APS5_NO_SNAPSHOT_CHECK":"1","APS5_RESOURCE_CACHE_ENTRIES":"4096","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:30"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.3.1 (LLPC)","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 300:30","first_present":7589,"ms":30088.041},"presents":91,"frame_ms":{"p50":329.230,"p90":341.761,"p99":358.002,"max":358.002},"gpu_busy_ms_per_present":152.221,"worker_busy_pct":{"queue worker 0x0":99.317,"queue worker 0x40":99.198,"queue worker 0x48":97.882,"queue worker 0x46":4.639},"top_phases_ms_per_frame":{"Driver.Packet":994.826,"Driver.Packet.memory_wait":623.748,"Driver.Packet.draw":274.862,"Driver.Draw":273.691,"Driver.Draw.draw_and_resource_release":150.867,"Graphics.Draw":149.011,"Graphics.Draw.draw_and_resource_release":127.293,"Driver.Draw.shader_compile_and_link":96.645},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.671,"events_lost":1126861,"totals_full":false}},"trace":"aps5-trace-0e4cea2533e7-38328.json.gz"}
{"commit":"76e7495c50a1","dirty":false,"env":{"APS5_NO_SNAPSHOT_CHECK":"1","APS5_RESOURCE_CACHE_ENTRIES":"4096","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:30"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.3.1 (LLPC)","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 300:30","first_present":7485,"ms":30012.035},"presents":94,"frame_ms":{"p50":320.238,"p90":328.198,"p99":334.560,"max":334.560},"gpu_busy_ms_per_present":150.677,"worker_busy_pct":{"queue worker 0x0":99.300,"queue worker 0x40":99.198,"queue worker 0x48":98.077,"queue worker 0x46":4.813},"top_phases_ms_per_frame":{"Driver.Packet":961.729,"Driver.Packet.memory_wait":603.154,"Driver.Packet.draw":262.151,"Driver.Draw":261.033,"Driver.Draw.draw_and_resource_release":140.028,"Graphics.Draw":138.340,"Graphics.Draw.draw_and_resource_release":117.132,"Driver.Draw.shader_compile_and_link":95.201},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.626,"events_lost":1150218,"totals_full":false}},"trace":"aps5-trace-76e7495c50a1-24348.json.gz"}
{"commit":"0e4cea2533e7","dirty":false,"env":{"APS5_NO_SNAPSHOT_CHECK":"1","APS5_RESOURCE_CACHE_ENTRIES":"4096","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:30"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.3.1 (LLPC)","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 300:30","first_present":5939,"ms":30305.004},"presents":91,"frame_ms":{"p50":333.391,"p90":341.607,"p99":357.428,"max":357.428},"gpu_busy_ms_per_present":150.968,"worker_busy_pct":{"queue worker 0x0":99.321,"queue worker 0x40":99.211,"queue worker 0x48":98.099,"queue worker 0x46":4.703},"top_phases_ms_per_frame":{"Driver.Packet":1002.867,"Driver.Packet.memory_wait":629.182,"Driver.Packet.draw":276.746,"Driver.Draw":275.514,"Driver.Draw.draw_and_resource_release":151.510,"Graphics.Draw":149.656,"Graphics.Draw.draw_and_resource_release":127.574,"Driver.Draw.shader_compile_and_link":97.106},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.664,"events_lost":1141939,"totals_full":false}},"trace":"aps5-trace-0e4cea2533e7-25884.json.gz"}
{"commit":"76e7495c50a1","dirty":false,"env":{"APS5_NO_SNAPSHOT_CHECK":"1","APS5_RESOURCE_CACHE_ENTRIES":"4096","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:30"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.3.1 (LLPC)","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 300:30","first_present":5828,"ms":30034.340},"presents":96,"frame_ms":{"p50":312.495,"p90":324.478,"p99":345.084,"max":345.084},"gpu_busy_ms_per_present":151.188,"worker_busy_pct":{"queue worker 0x0":99.292,"queue worker 0x40":99.210,"queue worker 0x48":97.981,"queue worker 0x46":5.269},"top_phases_ms_per_frame":{"Driver.Packet":943.545,"Driver.Packet.memory_wait":589.044,"Driver.Packet.draw":256.496,"Driver.Draw":255.348,"Driver.Draw.draw_and_resource_release":137.372,"Graphics.Draw":135.660,"Graphics.Draw.draw_and_resource_release":114.983,"Driver.Draw.shader_compile_and_link":92.531},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.541,"events_lost":1170046,"totals_full":false}},"trace":"aps5-trace-76e7495c50a1-20508.json.gz"}

Related: #1201's pipelining commit keeps a thread's collected ranges for the whole epoch (EpochCollectMap). That covers a separate repeat: the 64-entry memo ring is smaller than a queue-0 epoch here. The two changes add up. With an epoch-long memo, the widening cut the hub's walks on queue worker 0 from 81k to 57k and their time from 686 to 578 ms per 10 s (local counter). This tree plus #1201 (with @Raghav314's and @eliyarson's ordering fixes), APS5_PIPELINED_DRAWS=1, runs the hub at 5.33 / 5.36 FPS.

Update (2026-10-29)

Rebased onto main edf6804cf5 as a6aae7323. GuestMemory.cpp conflicted where main now reads the collect epoch through HostThreadSlot. It is resolved as in @B-Howell's qualification copy (984029f3ef):

  • main's HostThreadSlot<std::uint64_t, CollectEpochSlot>::Get() and every other main change stay;
  • the widening, the requested-range retry and CheckWidenedCollectBesideUncommittedPages are unchanged;
  • the retry's two-line code comment is gone (CONVENTIONS: code comments mark technical debt and are written by a human; the debt entry describes the retry);
  • the debt file keeps every other entry;
  • the commit message no longer mentions the agc_driver_image_table_reuse expectation, which main has had since e3dd06fea.

Validation layer, the same 15 focused tests as on 2026-10-23, on main edf6804cf5 and on a6aae7323, in one build tree (main = the same tree checked out at edf6804cf5 and rebuilt).

  • Environment: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V -j1 --timeout 600.
  • Machine: Vulkan SDK 1.3.296.0 validation layer, Windows 11 Pro 26200, RX 9070 XT, Adrenalin 26.8.1 (driver 32.0.31041.1004), WinLibs GCC 15.2.0 r7, Release.
  • Result: 15 of 15 pass on both.
  • Neither log reports was not found but was requested by env var VK_INSTANCE_LAYERS. A second pass with VK_LOADER_DEBUG=layer shows 8 insertions of VK_LAYER_KHRONOS_validation on each, one per Vulkan test; it passes 15 of 15 too.
  • Both logs report one VUID, and only that one: VUID-VkDeviceCreateInfo-pNext-pNext from vkCreateDevice, 24 times each, as before. This change adds no new VUID.
  • tools/check_conventions.py --base origin/main passes.

Main's newer write tracking (raised by @tibzejoker):

  • #9181 removed armResident, so a widened collect inside a resident run write-protects nothing; it stays one GetWriteWatch call over the block.
  • WindowsMappings::Collect still arms the settled subpages of a shared view's aliases. A widened collect settles every subpage of its block, so it can arm up to 16 subpages where the requested range armed one. Resumed write faults per 10 s on main and on this PR are being measured.
  • A widened walk that is refused (uncommitted pages, or a compared shared page anywhere in the block) goes through noteRefusedWalk before the retry: the block's unreported pages are stamped, and blocks with compared shared pages are marked refused. Callers holding an older generation for that block then compare bytes. The retry's own generation is newer than the mark.

Update (2026-10-23)

Rebased onto main 3bd7173b7 (a78974c84). Only the debt file conflicted, where two new entries sat next to this one.

Validation layer, as CONTRIBUTING asks for AGC driver changes.

  • Same 15 focused tests on main 3bd7173b7 (the PR's base then: its GuestMemory.cpp and WriteTracking.cpp in the same tree) and on a78974c84.
  • Environment: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V.
  • Machine: Vulkan SDK 1.3.296.0 validation layer, Windows 11 Pro 26200, RX 9070 XT, Adrenalin 26.8.1 (driver 32.0.31041.1004).
  • Tests:
    • agc_write_tracking, agc_write_tracking_metadata_commit, agc_write_watch_coverage;
    • agc_driver_image_table_reuse;
    • agc_shared_write_partial_collect and _two_pass;
    • agc_driver_guest_memory_lifetime and its _copy, _direct, _locked, _heap, _heap_uncached variants;
    • agc_driver_depth_bits_guest_memory, windows_write_watch, guest_memory.
  • Result: 15 of 15 pass on both.
  • Neither log reports was not found but was requested by env var VK_INSTANCE_LAYERS.
  • Both logs report one VUID, and only that one: VUID-VkDeviceCreateInfo-pNext-pNext from vkCreateDevice, 24 times each. The 1.3.296 layer does not know a structure in the device's pNext chain. This change adds no new VUID.

Update (2026-10-19)

Rebased onto main 3ddbc4acc (246b029b6). Only the debt file conflicted: #4650's depth-range entry and this one now sit side by side. The image-table test change dropped out of the diff because main has it (e3dd06fea), so the PR is the collect widening with its retry, the new write-tracking test and the debt entry.

On the rebased commit, Windows 11 Pro 26200, Ryzen 7 5800X3D, RX 9070 XT (Adrenalin 26.8.1):

  • agc_write_tracking and agc_driver_image_table_reuse pass 3 of 3 (ctest --repeat until-fail:3).
  • CheckWidenedCollectBesideUncommittedPages resets its range before releasing it, as CheckStoredAllSince does. CheckVersionRanges and CheckCollectBoundaries on main release theirs without a reset. Release alone leaves the committed host allocation in place, so a test added after them that resets its own block hits "cannot release part of a host allocation" (a local experiment of ours did). Nothing on main runs into it, so this PR leaves them alone.
  • The frame-rate numbers above are from the original base (ab9a47684); they have not been re-measured on this one.

Update (2026-10-16)

#6060 has merged since this was opened, and so has #1201 (pipelined draws, with its per-epoch collect map). This branch still merges cleanly. I retested it merged onto main 5d9dcc42d:

  • agc_write_tracking and agc_driver_image_table_reuse pass 3 of 3.
  • ctest -R "agc_|guest_memory|write_watch": 602 of 605.
    • agc_driver_quad_pixel_mask and agc_driver_layered_volume_vertex_no_gpl fail on this GPU without this change, as noted above.
    • agc_driver_gpu_indirect_arguments_misaligned_writer_ahead does not build under MinGW on main itself: alignas(65536) exceeds the object file maximum of 8192. #6452 fixes that.

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 (the gain shows with #6060, which keeps resident imports watched)
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 9070 XT, Adrenalin 26.8.1 (driver 32.0.31041.1004), Windows 11 Pro 26200 (the original frame-rate runs and whole-suite run: Adrenalin 26.3.1, driver 32.0.23033.1002)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4870563870 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6273). Originally posted by [SoRadGaming](https://github.com/SoRadGaming) on 2026-10-15T08:41:09Z. --- ### What Within a collect epoch, #1310 widens a collect of at most one 64 KiB block to the whole block, so the epoch's collect memo serves the block's other ranges. It left Windows on the requested range because it was not tested there. Windows now widens too. - **Why it matters more on Windows now.** Since #5596, singly mapped direct memory is private `MEM_WRITE_WATCH` memory, and a walk over it is a `GetWriteWatch` call for each resident run it touches. With #6060, its host imports stay watched as well. - **Measured.** In ASTRO BOT's hub on `main` + #6060, queue worker 0 spends 12.4 % of its samples in `GuestArenaCollectWrites` → `WindowsMappings::collectResident`, mostly from `ShaderResources::fastRevalidate` on every draw. A local counter showed about 50k walks of at most 64 KiB per 10 s. - **Uncommitted or inaccessible pages.** Windows coverage (`WriteWatchCoverage`) does not know which pages of a block are committed or inaccessible. `WindowsMappings::Collect` refuses such a range before it collects anything (`collectable`). So a widened walk that fails is retried over the requested pages. - Without the retry, a collect beside uncommitted pages of its block fails, and callers take that as a failed collect. The new test checks this. - The retry is listed in the debt file. - **Test expectation.** This PR used to change `agc_driver_image_table_reuse`'s Windows expectation (`CpuWriteResolutions`) to Linux's count. Main made the same change in e3dd06fea (since #6346 the unchanged proof is answered per page on Windows too), so the PR no longer touches that test. Linux is unchanged: the widening block is the same, and the retry is Windows-only. ### Tested Windows 11 Pro 26200, Ryzen 7 5800X3D, Radeon RX 9070 XT (driver 32.0.23033.1002), WinLibs GCC 15.2.0 r7, Release. - **New `CheckWidenedCollectBesideUncommittedPages`** (`agc_write_tracking`, Windows): - The last 16 KiB of a 64 KiB block stays an uncommitted placeholder, which the test checks. - A 64-byte collect in the block must succeed and see a CPU write in the next epoch. - With the widening but without the retry, it fails with `a collect beside uncommitted pages of its block failed`. - **`agc_driver_image_table_reuse`** passes. - **`ctest`, the whole suite on this commit** (rebased onto `main` c0be1f69b): 1,250 of 1,254 pass. - `agc_driver_quad_pixel_mask` (`implicit-LOD sample with quad pixel mask 2: pixel (0, 0) channel 2 is 2, expected 0`) fails the same on this GPU with `main`'s `GuestMemory.cpp`. It is from #6015's sample masks, not this change. - `agc_driver_layered_volume_vertex_no_gpl` also fails on this GPU without this change: on `main` e34c47921, and on #6060's head with and without its switch. - `guest_gameupdate` and `guest_vr_setup_dialog` don't start on this machine ("Process not started"). - The video-out tests skip here (no SDL display). - `tools/check_conventions.py --base origin/main` passes. - Linux: not built here. The frame-rate runs below were on `main` ab9a47684, before the rebase; the tests above ran on the rebased commit. **ASTRO BOT (PPSA21564 01.007.000)**, `-lvl hub_crashsite` (the full Crash Site hub), no input, warm shader cache (1,904 hits, 0 misses), `APS5_NO_SNAPSHOT_CHECK=1 APS5_RESOURCE_CACHE_ENTRIES=4096`. - The walks are cheap where imports are compared, so the measurement uses #6060. A is `main` ab9a47684 + #6060, and B is A + this PR. - Both use one relinked executable and the same libraries; only `libSceAgcDriver.prx` differs. Runs alternate. - FPS is the window's present counter over 120 s, after a 120 s settle. | | A | B (this PR) | |---|---|---| | hub FPS | 3.09 / 3.11 / 3.10 / 3.08 | **3.20 / 3.20** (+3.4 %) | Trace summary lines, `APS5_TRACE_SECONDS=300:30` in the same scene, no other `APS5_TRACE_*`/`APS5_PROFILE_*` switch, log not redirected. In every capture, queue worker 0's event buffer filled about 5.6 s into the window (`trace_dropped`). The four traces are available on request. | capture | commit | presents in 30 s | frame ms p50 | frame ms p90 | gpu_busy ms/present | queue worker 0x0 busy | `Driver.Packet` ms/frame | |---|---|---|---|---|---|---|---| | A1 | `0e4cea2533e7` | 91 | 329.2 | 341.8 | 152.2 | 99.3 % | 995 | | B1 | `76e7495c50a1` | 94 | 320.2 | 328.2 | 150.7 | 99.3 % | 962 | | A2 | `0e4cea2533e7` | 91 | 333.4 | 341.6 | 151.0 | 99.3 % | 1003 | | B2 | `76e7495c50a1` | 96 | 312.5 | 324.5 | 151.2 | 99.3 % | 944 | `0e4cea2533e7` is A (`main` ab9a47684 + #6060) and `76e7495c50a1` is B (A + this PR's commit, cherry-picked). A's two captures and B's two were taken in separate sessions on the same day; the FPS rows above alternate. <details><summary>Summary lines (A1, B1, A2, B2)</summary> ``` {"commit":"0e4cea2533e7","dirty":false,"env":{"APS5_NO_SNAPSHOT_CHECK":"1","APS5_RESOURCE_CACHE_ENTRIES":"4096","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:30"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.3.1 (LLPC)","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 300:30","first_present":7589,"ms":30088.041},"presents":91,"frame_ms":{"p50":329.230,"p90":341.761,"p99":358.002,"max":358.002},"gpu_busy_ms_per_present":152.221,"worker_busy_pct":{"queue worker 0x0":99.317,"queue worker 0x40":99.198,"queue worker 0x48":97.882,"queue worker 0x46":4.639},"top_phases_ms_per_frame":{"Driver.Packet":994.826,"Driver.Packet.memory_wait":623.748,"Driver.Packet.draw":274.862,"Driver.Draw":273.691,"Driver.Draw.draw_and_resource_release":150.867,"Graphics.Draw":149.011,"Graphics.Draw.draw_and_resource_release":127.293,"Driver.Draw.shader_compile_and_link":96.645},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.671,"events_lost":1126861,"totals_full":false}},"trace":"aps5-trace-0e4cea2533e7-38328.json.gz"} {"commit":"76e7495c50a1","dirty":false,"env":{"APS5_NO_SNAPSHOT_CHECK":"1","APS5_RESOURCE_CACHE_ENTRIES":"4096","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:30"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.3.1 (LLPC)","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 300:30","first_present":7485,"ms":30012.035},"presents":94,"frame_ms":{"p50":320.238,"p90":328.198,"p99":334.560,"max":334.560},"gpu_busy_ms_per_present":150.677,"worker_busy_pct":{"queue worker 0x0":99.300,"queue worker 0x40":99.198,"queue worker 0x48":98.077,"queue worker 0x46":4.813},"top_phases_ms_per_frame":{"Driver.Packet":961.729,"Driver.Packet.memory_wait":603.154,"Driver.Packet.draw":262.151,"Driver.Draw":261.033,"Driver.Draw.draw_and_resource_release":140.028,"Graphics.Draw":138.340,"Graphics.Draw.draw_and_resource_release":117.132,"Driver.Draw.shader_compile_and_link":95.201},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.626,"events_lost":1150218,"totals_full":false}},"trace":"aps5-trace-76e7495c50a1-24348.json.gz"} {"commit":"0e4cea2533e7","dirty":false,"env":{"APS5_NO_SNAPSHOT_CHECK":"1","APS5_RESOURCE_CACHE_ENTRIES":"4096","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:30"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.3.1 (LLPC)","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 300:30","first_present":5939,"ms":30305.004},"presents":91,"frame_ms":{"p50":333.391,"p90":341.607,"p99":357.428,"max":357.428},"gpu_busy_ms_per_present":150.968,"worker_busy_pct":{"queue worker 0x0":99.321,"queue worker 0x40":99.211,"queue worker 0x48":98.099,"queue worker 0x46":4.703},"top_phases_ms_per_frame":{"Driver.Packet":1002.867,"Driver.Packet.memory_wait":629.182,"Driver.Packet.draw":276.746,"Driver.Draw":275.514,"Driver.Draw.draw_and_resource_release":151.510,"Graphics.Draw":149.656,"Graphics.Draw.draw_and_resource_release":127.574,"Driver.Draw.shader_compile_and_link":97.106},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.664,"events_lost":1141939,"totals_full":false}},"trace":"aps5-trace-0e4cea2533e7-25884.json.gz"} {"commit":"76e7495c50a1","dirty":false,"env":{"APS5_NO_SNAPSHOT_CHECK":"1","APS5_RESOURCE_CACHE_ENTRIES":"4096","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"300:30"},"gpu":"AMD Radeon RX 9070 XT","driver":"AMD proprietary driver 26.3.1 (LLPC)","os":"Windows 10.0.26200","resolution":"3840x2160","window":{"spec":"seconds 300:30","first_present":5828,"ms":30034.340},"presents":96,"frame_ms":{"p50":312.495,"p90":324.478,"p99":345.084,"max":345.084},"gpu_busy_ms_per_present":151.188,"worker_busy_pct":{"queue worker 0x0":99.292,"queue worker 0x40":99.210,"queue worker 0x48":97.981,"queue worker 0x46":5.269},"top_phases_ms_per_frame":{"Driver.Packet":943.545,"Driver.Packet.memory_wait":589.044,"Driver.Packet.draw":256.496,"Driver.Draw":255.348,"Driver.Draw.draw_and_resource_release":137.372,"Graphics.Draw":135.660,"Graphics.Draw.draw_and_resource_release":114.983,"Driver.Draw.shader_compile_and_link":92.531},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":5.541,"events_lost":1170046,"totals_full":false}},"trace":"aps5-trace-76e7495c50a1-20508.json.gz"} ``` </details> Related: #1201's pipelining commit keeps a thread's collected ranges for the whole epoch (`EpochCollectMap`). That covers a separate repeat: the 64-entry memo ring is smaller than a queue-0 epoch here. The two changes add up. With an epoch-long memo, the widening cut the hub's walks on queue worker 0 from 81k to 57k and their time from 686 to 578 ms per 10 s (local counter). This tree plus #1201 (with @Raghav314's and @eliyarson's ordering fixes), `APS5_PIPELINED_DRAWS=1`, runs the hub at 5.33 / 5.36 FPS. ### Update (2026-10-29) Rebased onto `main` edf6804cf5 as a6aae7323. `GuestMemory.cpp` conflicted where main now reads the collect epoch through `HostThreadSlot`. It is resolved as in @B-Howell's qualification copy (984029f3ef): - main's `HostThreadSlot<std::uint64_t, CollectEpochSlot>::Get()` and every other main change stay; - the widening, the requested-range retry and `CheckWidenedCollectBesideUncommittedPages` are unchanged; - the retry's two-line code comment is gone (CONVENTIONS: code comments mark technical debt and are written by a human; the debt entry describes the retry); - the debt file keeps every other entry; - the commit message no longer mentions the `agc_driver_image_table_reuse` expectation, which main has had since e3dd06fea. **Validation layer**, the same 15 focused tests as on 2026-10-23, on `main` edf6804cf5 and on a6aae7323, in one build tree (main = the same tree checked out at edf6804cf5 and rebuilt). - Environment: `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V -j1 --timeout 600`. - Machine: Vulkan SDK 1.3.296.0 validation layer, Windows 11 Pro 26200, RX 9070 XT, Adrenalin 26.8.1 (driver 32.0.31041.1004), WinLibs GCC 15.2.0 r7, Release. - Result: 15 of 15 pass on both. - Neither log reports `was not found but was requested by env var VK_INSTANCE_LAYERS`. A second pass with `VK_LOADER_DEBUG=layer` shows 8 insertions of `VK_LAYER_KHRONOS_validation` on each, one per Vulkan test; it passes 15 of 15 too. - Both logs report one VUID, and only that one: `VUID-VkDeviceCreateInfo-pNext-pNext` from `vkCreateDevice`, 24 times each, as before. This change adds no new VUID. - `tools/check_conventions.py --base origin/main` passes. **Main's newer write tracking** (raised by @tibzejoker): - #9181 removed `armResident`, so a widened collect inside a resident run write-protects nothing; it stays one `GetWriteWatch` call over the block. - `WindowsMappings::Collect` still arms the settled subpages of a shared view's aliases. A widened collect settles every subpage of its block, so it can arm up to 16 subpages where the requested range armed one. Resumed write faults per 10 s on `main` and on this PR are being measured. - A widened walk that is refused (uncommitted pages, or a compared shared page anywhere in the block) goes through `noteRefusedWalk` before the retry: the block's unreported pages are stamped, and blocks with compared shared pages are marked refused. Callers holding an older generation for that block then compare bytes. The retry's own generation is newer than the mark. ### Update (2026-10-23) Rebased onto `main` 3bd7173b7 (a78974c84). Only the debt file conflicted, where two new entries sat next to this one. **Validation layer**, as CONTRIBUTING asks for AGC driver changes. - Same 15 focused tests on `main` 3bd7173b7 (the PR's base then: its `GuestMemory.cpp` and `WriteTracking.cpp` in the same tree) and on a78974c84. - Environment: `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`. - Machine: Vulkan SDK 1.3.296.0 validation layer, Windows 11 Pro 26200, RX 9070 XT, Adrenalin 26.8.1 (driver 32.0.31041.1004). - Tests: - `agc_write_tracking`, `agc_write_tracking_metadata_commit`, `agc_write_watch_coverage`; - `agc_driver_image_table_reuse`; - `agc_shared_write_partial_collect` and `_two_pass`; - `agc_driver_guest_memory_lifetime` and its `_copy`, `_direct`, `_locked`, `_heap`, `_heap_uncached` variants; - `agc_driver_depth_bits_guest_memory`, `windows_write_watch`, `guest_memory`. - Result: 15 of 15 pass on both. - Neither log reports `was not found but was requested by env var VK_INSTANCE_LAYERS`. - Both logs report one VUID, and only that one: `VUID-VkDeviceCreateInfo-pNext-pNext` from `vkCreateDevice`, 24 times each. The 1.3.296 layer does not know a structure in the device's `pNext` chain. This change adds no new VUID. ### Update (2026-10-19) Rebased onto `main` 3ddbc4acc (246b029b6). Only the debt file conflicted: #4650's depth-range entry and this one now sit side by side. The image-table test change dropped out of the diff because main has it (e3dd06fea), so the PR is the collect widening with its retry, the new write-tracking test and the debt entry. On the rebased commit, Windows 11 Pro 26200, Ryzen 7 5800X3D, RX 9070 XT (Adrenalin 26.8.1): - `agc_write_tracking` and `agc_driver_image_table_reuse` pass 3 of 3 (`ctest --repeat until-fail:3`). - `CheckWidenedCollectBesideUncommittedPages` resets its range before releasing it, as `CheckStoredAllSince` does. `CheckVersionRanges` and `CheckCollectBoundaries` on main release theirs without a reset. Release alone leaves the committed host allocation in place, so a test added after them that resets its own block hits "cannot release part of a host allocation" (a local experiment of ours did). Nothing on main runs into it, so this PR leaves them alone. - The frame-rate numbers above are from the original base (ab9a47684); they have not been re-measured on this one. ### Update (2026-10-16) #6060 has merged since this was opened, and so has #1201 (pipelined draws, with its per-epoch collect map). This branch still merges cleanly. I retested it merged onto `main` 5d9dcc42d: - `agc_write_tracking` and `agc_driver_image_table_reuse` pass 3 of 3. - `ctest -R "agc_|guest_memory|write_watch"`: 602 of 605. - `agc_driver_quad_pixel_mask` and `agc_driver_layered_volume_vertex_no_gpl` fail on this GPU without this change, as noted above. - `agc_driver_gpu_indirect_arguments_misaligned_writer_ahead` does not build under MinGW on `main` itself: `alignas(65536)` exceeds the object file maximum of 8192. #6452 fixes that. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (the gain shows with #6060, which keeps resident imports watched) - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 9070 XT, Adrenalin 26.8.1 (driver 32.0.31041.1004), Windows 11 Pro 26200 (the original frame-rate runs and whole-suite run: Adrenalin 26.3.1, driver 32.0.23033.1002) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Scramblrrrr commented 2026-10-16 18:03:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-16T18:03:16Z.


Windows/RTX5070Ti617.42 combined cross-test is ready at51b148e100509891c9b194da360e6dd80bdeb16b: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-watch-proof-current . Includes #6346 5532d51fb and #6273 fdcbb838d, on main93e54cedd plus our explicitly listed007/shared-table/level prerequisites. Both author commits applied cleanly; no replacement implementation.

30/30 selected native CPU/Vulkan checks PASS14.19s, no skips, including write_tracking's new cases, repeated-neighbour stores, image-table reuse/bounds, shared-table vouches, draw reuse/verify/inline, storage flush ordering, tessellation, serializer/cache and prebuild unset/0/1. Conventions clean. After final revision-string rebuild,5/5 related controlsPASS1.46s. Combined native evidence, not standalone each-PR evidence; no title FPS result yet.

Integration test adjustment: the a driver store over an entry case now counts2reuse/1resolution across its two dispatches, instead of1/1. With the finer range proof, clean siblings are reused even on the dispatch that rebuilds the changed entry. Both texel checks retained; no production proof weakened. #6273's CpuWriteResolutions=1 is retained. All other current #6340 expectations pass unchanged.

There is also an opt-in bounded copied-buffer ownership sampler in this test branch (maximum25small records per process, no game contents). Its initial asynchronous output triggered a native process-exit timeout; sampler-off control passed, and switching it to the existing direct trace sink made all3prebuild policies pass with sampling on. That defect was mine, not attributed to either PR. The full native result above has sampling enabled after the correction. Starting a guarded007 cross-test next. AI-assisted: Codex; raw title data local.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6221663908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6273#issuecomment-6221663908). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-16T18:03:16Z. --- Windows/RTX5070Ti617.42 combined cross-test is ready at51b148e100509891c9b194da360e6dd80bdeb16b: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-watch-proof-current . Includes #6346 5532d51fb and #6273 fdcbb838d, on main93e54cedd plus our explicitly listed007/shared-table/level prerequisites. Both author commits applied cleanly; no replacement implementation. 30/30 selected native CPU/Vulkan checks PASS14.19s, no skips, including write_tracking's new cases, repeated-neighbour stores, image-table reuse/bounds, shared-table vouches, draw reuse/verify/inline, storage flush ordering, tessellation, serializer/cache and prebuild unset/0/1. Conventions clean. After final revision-string rebuild,5/5 related controlsPASS1.46s. Combined native evidence, not standalone each-PR evidence; no title FPS result yet. Integration test adjustment: the `a driver store over an entry` case now counts2reuse/1resolution across its two dispatches, instead of1/1. With the finer range proof, clean siblings are reused even on the dispatch that rebuilds the changed entry. Both texel checks retained; no production proof weakened. #6273's CpuWriteResolutions=1 is retained. All other current #6340 expectations pass unchanged. There is also an opt-in bounded copied-buffer ownership sampler in this test branch (maximum25small records per process, no game contents). Its initial asynchronous output triggered a native process-exit timeout; sampler-off control passed, and switching it to the existing direct trace sink made all3prebuild policies pass with sampling on. That defect was mine, not attributed to either PR. The full native result above has sampling enabled after the correction. Starting a guarded007 cross-test next. AI-assisted: Codex; raw title data local.
Amoenus commented 2026-10-19 01:24:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-19T01:24:57Z.


Current-main Windows fixture check (2026-10-19)

Heads-up for the next refresh: the exact counter failure described above now also occurs without this PR's production change on unmodified main 0c25997a5a19dede15c8b0da5fb4bc3683bd14d3:

image table reuse: a CPU write collected in a new epoch, then two dispatches:
2 reused and 1 resolved tables, expected 1 and 2

Reproduced once on each actual GPU after a matching full Windows relinker/library + reuse-fixture build. Its preceding texel checks pass; it stops at this counter assertion.

I then applied only your four-line CpuWriteResolutions test correction from fdcbb838d69705002f14457881bac83388c93918, keeping all production code at that main pin. Credited test-only backport a868b033d4 retains Sorab's co-authorship. With it, the full agc_driver_image_table_reuse fixture passes 3/3 per GPU, including the later image-store cases. No validation error/warning, whole-test skip, internal no-write-watch bypass or timeout; Khronos insertion and device identities verified.

Windows 11 Enterprise 26200 / WinLibs GCC 15.2 r7; RTX 5080 driver 32.0.16.1062 (610.62), Radeon(TM) Graphics 32.0.21036.18; Khronos 1.4.363. ANYPS5_REQUIRE_VULKAN=1, project shader cache disabled, ctest -V -j1 --timeout 30 --repeat until-fail:3 -R '^agc_driver_image_table_reuse$'. Driver caches uncontrolled.

This validates the fixture expectation on that main pin, not the collect-widening/retry behavior or performance of #6273. In particular, the old Windows counter expectation no longer distinguishes the optimization from its base there. We will carry the credited fixture correction in our experimental composition; no duplicate PR for your change. Original build/test logs are retained. AI-assisted validation/report: Codex; author responsible.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6257677264 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6273#issuecomment-6257677264). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-19T01:24:57Z. --- ### Current-main Windows fixture check (2026-10-19) Heads-up for the next refresh: the exact counter failure described above now also occurs **without this PR's production change** on unmodified main `0c25997a5a19dede15c8b0da5fb4bc3683bd14d3`: ```text image table reuse: a CPU write collected in a new epoch, then two dispatches: 2 reused and 1 resolved tables, expected 1 and 2 ``` Reproduced once on each actual GPU after a matching full Windows relinker/library + reuse-fixture build. Its preceding texel checks pass; it stops at this counter assertion. I then applied **only your four-line `CpuWriteResolutions` test correction** from `fdcbb838d69705002f14457881bac83388c93918`, keeping all production code at that main pin. [Credited test-only backport `a868b033d4`](https://github.com/Amoenus/AnyPS5/commit/a868b033d452bc40b83f49f8e52e5a256d56a0f1) retains Sorab's co-authorship. With it, the full `agc_driver_image_table_reuse` fixture passes **3/3 per GPU**, including the later image-store cases. No validation error/warning, whole-test skip, internal no-write-watch bypass or timeout; Khronos insertion and device identities verified. Windows 11 Enterprise 26200 / WinLibs GCC 15.2 r7; RTX 5080 driver 32.0.16.1062 (610.62), Radeon(TM) Graphics 32.0.21036.18; Khronos 1.4.363. `ANYPS5_REQUIRE_VULKAN=1`, project shader cache disabled, `ctest -V -j1 --timeout 30 --repeat until-fail:3 -R '^agc_driver_image_table_reuse$'`. Driver caches uncontrolled. This validates the fixture expectation on that main pin, **not** the collect-widening/retry behavior or performance of #6273. In particular, the old Windows counter expectation no longer distinguishes the optimization from its base there. We will carry the credited fixture correction in our experimental composition; no duplicate PR for your change. Original build/test logs are retained. AI-assisted validation/report: Codex; author responsible.
SoRadGaming commented 2026-10-19 04:17:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-19T04:17:15Z.


Rebased onto main 3ddbc4acc as 246b029b6, and it merges cleanly again. Only the debt file conflicted (#4650's entry and this one now sit side by side).

@Amoenus thanks for the fixture check. Main took the same CpuWriteResolutions correction in e3dd06fea, so it dropped out of this diff. What's left is the Windows collect widening with its retry, CheckWidenedCollectBesideUncommittedPages and the debt entry.

On the rebased commit (Windows 11, RX 9070 XT, Adrenalin 26.8.1), agc_write_tracking and agc_driver_image_table_reuse pass 3 of 3. The description has a 2026-10-19 update with the details. That includes the note that the frame-rate numbers are still from the original base.

Written with AI assistance (Claude).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6259534184 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6273#issuecomment-6259534184). Originally posted by [SoRadGaming](https://github.com/SoRadGaming) on 2026-10-19T04:17:15Z. --- Rebased onto `main` 3ddbc4acc as 246b029b6, and it merges cleanly again. Only the debt file conflicted (#4650's entry and this one now sit side by side). @Amoenus thanks for the fixture check. Main took the same `CpuWriteResolutions` correction in e3dd06fea, so it dropped out of this diff. What's left is the Windows collect widening with its retry, `CheckWidenedCollectBesideUncommittedPages` and the debt entry. On the rebased commit (Windows 11, RX 9070 XT, Adrenalin 26.8.1), `agc_write_tracking` and `agc_driver_image_table_reuse` pass 3 of 3. The description has a 2026-10-19 update with the details. That includes the note that the frame-rate numbers are still from the original base. Written with AI assistance (Claude).
SoRadGaming commented 2026-10-21 06:58:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-21T06:58:48Z.


Rebased onto main 3bd7173b7 as a78974c84. It merges cleanly again; only the debt file conflicted, where two new entries sat next to this one.

  • python tools/check_conventions.py --base origin/main passes.
  • agc_write_tracking and agc_driver_image_table_reuse pass 3/3 (--repeat until-fail:3) on Windows 11 with an RX 9070 XT (Adrenalin 26.8.1), MinGW winlibs 15.2 Release.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310065821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6273#issuecomment-6310065821). Originally posted by [SoRadGaming](https://github.com/SoRadGaming) on 2026-10-21T06:58:48Z. --- Rebased onto `main` 3bd7173b7 as a78974c84. It merges cleanly again; only the debt file conflicted, where two new entries sat next to this one. - `python tools/check_conventions.py --base origin/main` passes. - `agc_write_tracking` and `agc_driver_image_table_reuse` pass 3/3 (`--repeat until-fail:3`) on Windows 11 with an RX 9070 XT (Adrenalin 26.8.1), MinGW winlibs 15.2 Release.
SoRadGaming commented 2026-10-22 14:52:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SoRadGaming on 2026-10-22T14:52:56Z.


This is ready for review whenever someone has time. It's a small change: one function in GuestMemory.cpp plus its test.

  • It merges cleanly with current main (rebased onto 3bd7173b7), and the conventions check passes.
  • agc_write_tracking and agc_driver_image_table_reuse pass on an RX 9070 XT.

I'm happy to rebase again, re-measure on current main, or run anything else a reviewer wants first, such as the validation-layer runs on main and on the change.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6343760235 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6273#issuecomment-6343760235). Originally posted by [SoRadGaming](https://github.com/SoRadGaming) on 2026-10-22T14:52:56Z. --- This is ready for review whenever someone has time. It's a small change: one function in `GuestMemory.cpp` plus its test. - It merges cleanly with current `main` (rebased onto 3bd7173b7), and the conventions check passes. - `agc_write_tracking` and `agc_driver_image_table_reuse` pass on an RX 9070 XT. I'm happy to rebase again, re-measure on current `main`, or run anything else a reviewer wants first, such as the validation-layer runs on `main` and on the change.
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!6273
No description provided.