fix(agc): renew a storage image's upload copy when its range leaves the watch #17788

Merged
Ducengarth merged 2 commits from upstream-pr/17788 into main 2026-11-15 20:06:22 +00:00
Ducengarth commented 2026-11-09 16:01:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ducengarth on 2026-11-09T16:01:20Z.


What

A storage image's generationBaseline is taken at upload only. A GPU store over write-watched memory advances the unit's generation and leaves that copy describing the bytes before the store. When the range then leaves the write watch and new results land with no refresh in between, baselineMiss reports UploadCopyDiffers and the store throws storing storage image results pending over memory outside the write watch ..., although only the image itself wrote the unit.

The unwatch hook now renews the copy of such units in images of up to 1 MiB, once the write watch proves that the CPU left them alone since their generation. A store still in flight renews it when its own batch completes (Recorder::OnWriteComplete), and results landing before that wait for it. A unit under a unit shadow is not renewed and still throws. The gap is in docs/dev/debt/libSceAgcDriver.md.

agc_driver_store_over_untracked gets the case for tiled and linear surfaces: stored, left the watch, new results; also with a CPU write while they are pending and with the store still in flight.

Tested

Windows 11, RTX 3090 Ti, on 84f4ad4f06.

Focused AGC tests, the same 53 on main and on this PR, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, using ctest --test-dir build -R '^(agc_driver_store_over_untracked|agc_driver_store_pending_identity|agc_driver_storage_.*|agc_storage_.*|agc_untracked_forget|agc_driver_untracked_snapshot_hint|agc_driver_recorder|agc_recorder_stored_bytes|agc_import_settle_storage_image|agc_driver_linear_target_.*)$' -V:

  • main with the new test: 52 of 53 pass. agc_driver_store_over_untracked fails with this error (unit 0 of 4: its bytes differ from the copy taken at its upload).
  • This PR: 53 of 53 pass.
  • Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS or any VUID-.

PPSA02681 (Dark Alliance) with APS5_PLAYGO_UNLISTED_CHUNKS=0,1, a black loading screen then this abort at about 50-60 s on main:

  • Two runs on this base reached the 180 s limit without the abort.
  • Six runs on an older base: five reached the 200-210 s limit without it, one died with 0xc0000005 on thread FAPREventQueueListener, which also happened on main before this change.
  • What the title renders past that point was not checked.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 3090 Ti, driver 621.14, Windows 11
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5226895740 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17788). Originally posted by [Ducengarth](https://github.com/Ducengarth) on 2026-11-09T16:01:20Z. --- ### What A storage image's `generationBaseline` is taken at upload only. A GPU store over write-watched memory advances the unit's generation and leaves that copy describing the bytes before the store. When the range then leaves the write watch and new results land with no refresh in between, `baselineMiss` reports `UploadCopyDiffers` and the store throws `storing storage image results pending over memory outside the write watch ...`, although only the image itself wrote the unit. The unwatch hook now renews the copy of such units in images of up to 1 MiB, once the write watch proves that the CPU left them alone since their generation. A store still in flight renews it when its own batch completes (`Recorder::OnWriteComplete`), and results landing before that wait for it. A unit under a unit shadow is not renewed and still throws. The gap is in `docs/dev/debt/libSceAgcDriver.md`. `agc_driver_store_over_untracked` gets the case for tiled and linear surfaces: stored, left the watch, new results; also with a CPU write while they are pending and with the store still in flight. ### Tested Windows 11, RTX 3090 Ti, on `84f4ad4f06`. Focused AGC tests, the same 53 on `main` and on this PR, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, using `ctest --test-dir build -R '^(agc_driver_store_over_untracked|agc_driver_store_pending_identity|agc_driver_storage_.*|agc_storage_.*|agc_untracked_forget|agc_driver_untracked_snapshot_hint|agc_driver_recorder|agc_recorder_stored_bytes|agc_import_settle_storage_image|agc_driver_linear_target_.*)$' -V`: - `main` with the new test: 52 of 53 pass. `agc_driver_store_over_untracked` fails with this error (`unit 0 of 4: its bytes differ from the copy taken at its upload`). - This PR: 53 of 53 pass. - Neither log contains `was not found but was requested by env var VK_INSTANCE_LAYERS` or any `VUID-`. PPSA02681 (Dark Alliance) with `APS5_PLAYGO_UNLISTED_CHUNKS=0,1`, a black loading screen then this abort at about 50-60 s on `main`: - Two runs on this base reached the 180 s limit without the abort. - Six runs on an older base: five reached the 200-210 s limit without it, one died with `0xc0000005` on thread `FAPREventQueueListener`, which also happened on `main` before this change. - What the title renders past that point was not checked. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3090 Ti, driver 621.14, Windows 11 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!17788
No description provided.