feat(agc): let APS5_WRITE_WATCH_IMPORTS=watch keep Windows host imports watched #1994

Closed
lubaxe wants to merge 1 commit from upstream-pr/1994 into main
lubaxe commented 2026-10-09 04:14:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by lubaxe on 2026-10-09T04:14:19Z.


What

Since #1441, Windows host-pointer imports are always compared instead of write-watched. On Windows APS5_WRITE_WATCH_IMPORTS was ignored; on Linux it already chooses probe, watch or unwatch.

When a title renders into large imported targets, a comparison cannot prove a target unchanged. Each lookup then stores the image and uploads it again. In PPSA12544 (Hollow Knight: Silksong) on an RTX 5090, gameplay in tut_01 measured:

main (compared) APS5_WRITE_WATCH_IMPORTS=watch
presents per 10 s 50-61 600
GPU busy per present 89-116 ms 2.8-3.0 ms
storage uploads per 10 s (reason) about 14,000 (untracked) fewer than 2,000 (keys, cpu)
storage-upload / write-back GPU time per present (APS5_PROFILE_GPU) 36 ms / 57 ms (about 2.1 GiB)
  • importWatchRequest is now shared by both platforms.
  • On Windows, watch keeps imports watched. probe, unwatch and an unset variable keep #1441's comparison, since there is no Windows probe. Other values throw, as on Linux.
  • The default does not change. With watch, a late driver mark is taken for a CPU store again (#1434). USAGE.md and TechnicalDebt.md say so.
  • Use it together with #1995 (APS5_STORE_AT_FLIP=1). In PPSA12544, watch alone crashed while tut_01 loaded (vertex fetch exceeds descriptor record count) after reading stale memory. See the four-way result in #1995.

Tested

  • Windows 11 Pro, Ryzen 7 9800X3D, RTX 5090 (driver 617.42), WinLibs GCC 15.2.0 r7, Release.
  • importWatchTests in agc_driver_recorder_tests, run directly:
    • Unset: compares, as before.
    • APS5_WRITE_WATCH_IMPORTS=watch: watched. Without the change, this case fails with Windows host imports were compared with APS5_WRITE_WATCH_IMPORTS=watch.
  • ctest: 487 of 488 passed. The failure is agc_driver_pixel_lds, which also fails on unmodified main on this GPU (vkWaitForFences graphics: Vulkan result -4).
  • PPSA12544 with #846, #425, #1918, #1968, #1969 and #1995: 60 fps in gameplay, as in the table. The table compares with and without this switch; with #1995 also set, the title renders correctly.
  • tools/check_conventions.py --base origin/main passes.

Conflicts with #1995 only in docs/user/USAGE.md, where both add a section at the same place. I'll rebase whichever merges second.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4795886914 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1994). Originally posted by [lubaxe](https://github.com/lubaxe) on 2026-10-09T04:14:19Z. --- ### What Since #1441, Windows host-pointer imports are always compared instead of write-watched. On Windows `APS5_WRITE_WATCH_IMPORTS` was ignored; on Linux it already chooses `probe`, `watch` or `unwatch`. When a title renders into large imported targets, a comparison cannot prove a target unchanged. Each lookup then stores the image and uploads it again. In PPSA12544 (Hollow Knight: Silksong) on an RTX 5090, gameplay in `tut_01` measured: | | `main` (compared) | `APS5_WRITE_WATCH_IMPORTS=watch` | |---|---|---| | presents per 10 s | 50-61 | 600 | | GPU busy per present | 89-116 ms | 2.8-3.0 ms | | storage uploads per 10 s (reason) | about 14,000 (`untracked`) | fewer than 2,000 (`keys`, `cpu`) | | storage-upload / write-back GPU time per present (`APS5_PROFILE_GPU`) | 36 ms / 57 ms (about 2.1 GiB) | | - `importWatchRequest` is now shared by both platforms. - On Windows, `watch` keeps imports watched. `probe`, `unwatch` and an unset variable keep #1441's comparison, since there is no Windows probe. Other values throw, as on Linux. - The default does not change. With `watch`, a late driver mark is taken for a CPU store again (#1434). USAGE.md and TechnicalDebt.md say so. - Use it together with #1995 (`APS5_STORE_AT_FLIP=1`). In PPSA12544, `watch` alone crashed while `tut_01` loaded (`vertex fetch exceeds descriptor record count`) after reading stale memory. See the four-way result in #1995. ### Tested - Windows 11 Pro, Ryzen 7 9800X3D, RTX 5090 (driver 617.42), WinLibs GCC 15.2.0 r7, Release. - `importWatchTests` in `agc_driver_recorder_tests`, run directly: - Unset: compares, as before. - `APS5_WRITE_WATCH_IMPORTS=watch`: watched. Without the change, this case fails with `Windows host imports were compared with APS5_WRITE_WATCH_IMPORTS=watch`. - `ctest`: 487 of 488 passed. The failure is `agc_driver_pixel_lds`, which also fails on unmodified `main` on this GPU (`vkWaitForFences graphics: Vulkan result -4`). - PPSA12544 with #846, #425, #1918, #1968, #1969 and #1995: 60 fps in gameplay, as in the table. The table compares with and without this switch; with #1995 also set, the title renders correctly. - `tools/check_conventions.py --base origin/main` passes. Conflicts with #1995 only in `docs/user/USAGE.md`, where both add a section at the same place. I'll rebase whichever merges second. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Rohan03x commented 2026-10-09 11:38:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Rohan03x on 2026-10-09T11:38:10Z.


Tested this alongside #1847 on Windows 11, Ryzen 7 5700X, RTX 3070 with Dreaming Sarah (PPSA02929), merged onto main f1451396 (ctest 488/488): 17.1 FPS on main, 59.97 FPS with APS5_WRITE_WATCH_IMPORTS=watch, 0 of 1190 presents refreshed first. No crash, but the run was under a minute and stayed on the title screen and main menu. Full numbers: https://github.com/boykopovar/AnyPS5/pull/1847#issuecomment-6080097305

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6080098224 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1994#issuecomment-6080098224). Originally posted by [Rohan03x](https://github.com/Rohan03x) on 2026-10-09T11:38:10Z. --- Tested this alongside #1847 on Windows 11, Ryzen 7 5700X, RTX 3070 with Dreaming Sarah (PPSA02929), merged onto main `f1451396` (ctest 488/488): 17.1 FPS on main, 59.97 FPS with `APS5_WRITE_WATCH_IMPORTS=watch`, 0 of 1190 presents refreshed first. No crash, but the run was under a minute and stayed on the title screen and main menu. Full numbers: https://github.com/boykopovar/AnyPS5/pull/1847#issuecomment-6080097305 AI-assisted: yes.
lubaxe commented 2026-10-09 13:10:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by lubaxe on 2026-10-09T13:10:46Z.


Closing: #2096 fixes the same regression from 838d02a8 by keeping write tracking for separate shared aliases. On main d70b8998 with #846, #425, #1836, #1599, #1968, #1969 and #1995, PPSA12544 runs gameplay (tut_01, tut_02) at 600 presents / 10 s with only APS5_STORE_AT_FLIP=1, without APS5_WRITE_WATCH_IMPORTS=watch (Windows 11, RTX 5090; three runs of 180 s). Thanks @Rohan03x for the Dreaming Sarah numbers.

(AI-assisted: Claude Code.)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081556048 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1994#issuecomment-6081556048). Originally posted by [lubaxe](https://github.com/lubaxe) on 2026-10-09T13:10:46Z. --- Closing: #2096 fixes the same regression from 838d02a8 by keeping write tracking for separate shared aliases. On `main` d70b8998 with #846, #425, #1836, #1599, #1968, #1969 and #1995, PPSA12544 runs gameplay (`tut_01`, `tut_02`) at 600 presents / 10 s with only `APS5_STORE_AT_FLIP=1`, without `APS5_WRITE_WATCH_IMPORTS=watch` (Windows 11, RTX 5090; three runs of 180 s). Thanks @Rohan03x for the Dreaming Sarah numbers. (AI-assisted: Claude Code.)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1994
No description provided.