perf(agc): keep a surface's storage image when another descriptor names uncompressed DCC keys #466

Merged
oneandonlydean merged 1 commit from upstream-pr/466 into main 2026-10-03 22:34:42 +00:00
oneandonlydean commented 2026-10-03 14:33:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-03T14:33:02Z.


What

The storage cache keeps one image per surface, and the image follows the DCC key range of the descriptor that made it. When a descriptor names other keys, MetadataMoved remakes the image: its pending results are stored, and it is destroyed, created and uploaded again under the new keys.

PPSA21564's galaxy map renders a 1920x1080 surface as a color target whose CB names DCC keys at one address, then writes the same surface from a compute shader whose T# names keys at another. Both key ranges read uncompressed every frame, yet the image was remade twice a frame (1231 constructions in a 56 s scene), and the views and draw recipes built on it were thrown away each time.

A descriptor naming other keys now keeps the image when the move cannot be observed:

  • the image's own keys and the named keys both read uncompressed, and
  • the image's content was neither uploaded nor filled under a clear code.

That is exactly the content an image made under the named keys would hold once this one's pending results were stored. Every other case (a fast clear of either key range, a register clear, an image holding a clear) still remakes the image as before, so clears of the new keys reach it and pending results are stored first.

  • KeysServeSurface (DccMetadata.hpp) is the rule; StorageTexture::ServesKeysAt applies it with the image's key proofs, and keeps a few proofs for named key ranges so a repeated check does not rescan keys while the key bytes are unchanged.
  • Every shortcut that stands in for a lookup checks the same rule: the sampled view hit, the fast revalidation of views and storage elements (storage elements now record their descriptor's keys), the own-object refresh, and the draw recipe's resident targets.

Tested

  • Linux (CachyOS, x86-64, NVIDIA RTX 4090): full build with BUILD_TESTING=ON and ctest pass (128/128); agc_driver_recorder_tests (GPU, run by hand) passes.
  • New agc_dcc_key_sharing (ctest, CPU only) drives KeysServeSurface through a model of the storage cache: the galaxy map's frame pattern (a color target and two compute descriptors naming two uncompressed key ranges) makes the image once in 100 frames, where the previous rule remakes it 199 times; a fast clear of the named keys, a clear of the followed keys, and a filled or cleared upload each still remake it; descriptors without metadata or naming the image's own keys never scan keys. KeysServeSurface is new, so the test does not build without this change.
  • PPSA21564: on the galaxy map the surface's image constructions dropped from over 1200 per run to 7, and the change has been on my integration branch through repeated passes of my visual regression check (checkpoint frames, flicker, shimmer, video tearing, FPS).

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4727301542 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/466). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-03T14:33:02Z. --- ### What The storage cache keeps one image per surface, and the image follows the DCC key range of the descriptor that made it. When a descriptor names other keys, `MetadataMoved` remakes the image: its pending results are stored, and it is destroyed, created and uploaded again under the new keys. PPSA21564's galaxy map renders a 1920x1080 surface as a color target whose CB names DCC keys at one address, then writes the same surface from a compute shader whose T# names keys at another. Both key ranges read uncompressed every frame, yet the image was remade twice a frame (1231 constructions in a 56 s scene), and the views and draw recipes built on it were thrown away each time. A descriptor naming other keys now keeps the image when the move cannot be observed: - the image's own keys and the named keys both read uncompressed, and - the image's content was neither uploaded nor filled under a clear code. That is exactly the content an image made under the named keys would hold once this one's pending results were stored. Every other case (a fast clear of either key range, a register clear, an image holding a clear) still remakes the image as before, so clears of the new keys reach it and pending results are stored first. - `KeysServeSurface` (DccMetadata.hpp) is the rule; `StorageTexture::ServesKeysAt` applies it with the image's key proofs, and keeps a few proofs for named key ranges so a repeated check does not rescan keys while the key bytes are unchanged. - Every shortcut that stands in for a lookup checks the same rule: the sampled view hit, the fast revalidation of views and storage elements (storage elements now record their descriptor's keys), the own-object refresh, and the draw recipe's resident targets. ### Tested - Linux (CachyOS, x86-64, NVIDIA RTX 4090): full build with `BUILD_TESTING=ON` and `ctest` pass (128/128); `agc_driver_recorder_tests` (GPU, run by hand) passes. - New `agc_dcc_key_sharing` (ctest, CPU only) drives `KeysServeSurface` through a model of the storage cache: the galaxy map's frame pattern (a color target and two compute descriptors naming two uncompressed key ranges) makes the image once in 100 frames, where the previous rule remakes it 199 times; a fast clear of the named keys, a clear of the followed keys, and a filled or cleared upload each still remake it; descriptors without metadata or naming the image's own keys never scan keys. `KeysServeSurface` is new, so the test does not build without this change. - PPSA21564: on the galaxy map the surface's image constructions dropped from over 1200 per run to 7, and the change has been on my integration branch through repeated passes of my visual regression check (checkpoint frames, flicker, shimmer, video tearing, FPS). ### 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 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
boykopovar commented 2026-10-03 15:06:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-03T15:06:19Z.


Thanks for your active contributions. I’d like to give you merge access to the repository. Would you be interested? So many pull requests...

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5970402160 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/466#issuecomment-5970402160). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-03T15:06:19Z. --- Thanks for your active contributions. I’d like to give you merge access to the repository. Would you be interested? So many pull requests...
adriadam10 commented 2026-10-03 16:34:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-03T16:34:36Z.


Thanks for your active contributions. I’d like to give you merge access to the repository. Would you be interested? So many pull requests...

I agree that should be more reviewers. every time i do a PR i think about the time you have to spend in every one of them :/

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5971132937 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/466#issuecomment-5971132937). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-03T16:34:36Z. --- > Thanks for your active contributions. I’d like to give you merge access to the repository. Would you be interested? So many pull requests... I agree that should be more reviewers. every time i do a PR i think about the time you have to spend in every one of them :/
oneandonlydean commented 2026-10-03 19:41:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-03T19:41:20Z.


Thanks for your active contributions. I’d like to give you merge access to the repository. Would you be interested? So many pull requests...

Thank you, I'd be glad to help with reviews and merges. Here is how I'd plan to use it, so you can say if you'd like it different:

  • I'll keep opening my own work as PRs from my fork and won't merge my own PRs; I'll leave those to you
  • I'll review and merge other contributors' PRs when they follow CONTRIBUTING.md and CI is green, and leave anything architectural, or in areas you're actively changing, to you.
  • When I'm unsure, I'll tag you rather than merge.
  • My reviews will be AI-assisted like my PRs, and I'm responsible for anything I merge.
  • I mostly test on Linux, and I can run PRs that touch the AGC driver or the recompiler through my visual regression check before merging. I am building a Windows test bench with my backup 4090 and a AMD processor to do be able to do Windows tests

Also, #477 should stop the agc_driver_vopc_compare failures that keep hitting Linux CI, which will make reviews a bit easier.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5972810859 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/466#issuecomment-5972810859). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-03T19:41:20Z. --- > Thanks for your active contributions. I’d like to give you merge access to the repository. Would you be interested? So many pull requests... Thank you, I'd be glad to help with reviews and merges. Here is how I'd plan to use it, so you can say if you'd like it different: - I'll keep opening my own work as PRs from my fork and won't merge my own PRs; I'll leave those to you - I'll review and merge other contributors' PRs when they follow CONTRIBUTING.md and CI is green, and leave anything architectural, or in areas you're actively changing, to you. - When I'm unsure, I'll tag you rather than merge. - My reviews will be AI-assisted like my PRs, and I'm responsible for anything I merge. - I mostly test on Linux, and I can run PRs that touch the AGC driver or the recompiler through my visual regression check before merging. I am building a Windows test bench with my backup 4090 and a AMD processor to do be able to do Windows tests Also, #477 should stop the agc_driver_vopc_compare failures that keep hitting Linux CI, which will make reviews a bit easier.
github-actions[bot] commented 2026-10-03 19:51:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-03T19:51:36Z.


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

Pull request Conflicting files (lines on main) Same exports Same new files
#470 core/libs/prx/libSceAgcDriver/CMakeLists.txt L249
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5972887322 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/466#issuecomment-5972887322). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-03T19:51:36Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #470 | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` [L249](https://github.com/boykopovar/AnyPS5/blob/53d1ebc10f0d6dd06b1b9627f03e79406581cb0d/core/libs/prx/libSceAgcDriver/CMakeLists.txt#L249) | | |
boykopovar commented 2026-10-03 21:23:23 +00:00 (Migrated from github.com)

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


Thanks for your active contributions. I’d like to give you merge access to the repository. Would you be interested? So many pull requests...

Thank you, I'd be glad to help with reviews and merges. Here is how I'd plan to use it, so you can say if you'd like it different:

  • I'll keep opening my own work as PRs from my fork and won't merge my own PRs; I'll leave those to you
  • I'll review and merge other contributors' PRs when they follow CONTRIBUTING.md and CI is green, and leave anything architectural, or in areas you're actively changing, to you.
  • When I'm unsure, I'll tag you rather than merge.
  • My reviews will be AI-assisted like my PRs, and I'm responsible for anything I merge.
  • I mostly test on Linux, and I can run PRs that touch the AGC driver or the recompiler through my visual regression check before merging. I am building a Windows test bench with my backup 4090 and a AMD processor to do be able to do Windows tests

Also, #477 should stop the agc_driver_vopc_compare failures that keep hitting Linux CI, which will make reviews a bit easier.

I've sent out an invitation to collaborators. Please avoid regressions on Dreaming Sarah. And of course, you can (and should) merge your PRs too, if you're confident and don't need advice. #477 was merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5973624491 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/466#issuecomment-5973624491). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-03T21:23:23Z. --- > > Thanks for your active contributions. I’d like to give you merge access to the repository. Would you be interested? So many pull requests... > > Thank you, I'd be glad to help with reviews and merges. Here is how I'd plan to use it, so you can say if you'd like it different: > > * I'll keep opening my own work as PRs from my fork and won't merge my own PRs; I'll leave those to you > * I'll review and merge other contributors' PRs when they follow CONTRIBUTING.md and CI is green, and leave anything architectural, or in areas you're actively changing, to you. > * When I'm unsure, I'll tag you rather than merge. > * My reviews will be AI-assisted like my PRs, and I'm responsible for anything I merge. > * I mostly test on Linux, and I can run PRs that touch the AGC driver or the recompiler through my visual regression check before merging. I am building a Windows test bench with my backup 4090 and a AMD processor to do be able to do Windows tests > > Also, #477 should stop the agc_driver_vopc_compare failures that keep hitting Linux CI, which will make reviews a bit easier. I've sent out an invitation to collaborators. Please avoid regressions on Dreaming Sarah. And of course, you can (and should) merge your PRs too, if you're confident and don't need advice. #477 was merged.
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!466
No description provided.