perf(agc): read DCC keys behind the driver's own pending key store without a wait #458

Merged
oneandonlydean merged 1 commit from upstream-pr/458 into main 2026-10-03 22:34:08 +00:00
oneandonlydean commented 2026-10-03 13:52:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-03T13:52:06Z.


What

A CB metadata pass (and a resident target's register-clear check) reads the DCC keys with CurrentDccKeys, which waits for the GPU whenever recorded work writes the key range (SyncThrough). In the intro video of PPSA21564 about 800 passes per 10 s waited about 1.8 ms each, and every one of those waits was behind a key store whose result the driver already knew: its own uncompressed key store (StoreUncompressedOnGpu), or a title fill of uniform keys recorded on the GPU (NoteKeysFillOnGpu).

  • Pending-write notes now carry a serial in recording order (Recorder::noteWrite and noteWriteOn).
  • The key memo remembers the serial of the store it describes (LastWriteNote, taken right after the store is noted).
  • CurrentDccKeys asks NewestWriteNote for the newest pending write over the keys. When that is the store's own note, nothing recorded after the store writes the keys, so they read as the store's keys without a wait.
  • Any later writer, a key range the store does not cover, or a unit shadow over the keys waits as before.

Tested

  • Linux (CachyOS, x86-64, RTX 4090): full build with BUILD_TESTING=ON and ctest pass (145/145).
  • New pendingKeyStoreTests in agc_driver_recorder_tests (GPU, run by hand like the rest of that executable): after a pending uncompressed key store, the keys (and a range inside them) read as uncompressed while the store is still pending; a later writer over part of the keys makes the read wait and the store lands; the keys of a pending fill read as the fill's keys without a wait, and a later, wider writer is waited for. With the PendingStoreKeys line removed from CurrentDccKeys it fails with "reading keys the driver's own pending store wrote waited for the GPU".
  • PPSA21564: on my integration branch since 2026-10-02 through repeated passes of my visual regression check (checkpoint frames, flicker, shimmer, video tearing, FPS).
  • #290 and #291 also edit Recorder.*; each merges cleanly with this branch.

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:4727049572 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/458). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-03T13:52:06Z. --- ### What A CB metadata pass (and a resident target's register-clear check) reads the DCC keys with `CurrentDccKeys`, which waits for the GPU whenever recorded work writes the key range (`SyncThrough`). In the intro video of PPSA21564 about 800 passes per 10 s waited about 1.8 ms each, and every one of those waits was behind a key store whose result the driver already knew: its own uncompressed key store (`StoreUncompressedOnGpu`), or a title fill of uniform keys recorded on the GPU (`NoteKeysFillOnGpu`). - Pending-write notes now carry a serial in recording order (`Recorder::noteWrite` and `noteWriteOn`). - The key memo remembers the serial of the store it describes (`LastWriteNote`, taken right after the store is noted). - `CurrentDccKeys` asks `NewestWriteNote` for the newest pending write over the keys. When that is the store's own note, nothing recorded after the store writes the keys, so they read as the store's keys without a wait. - Any later writer, a key range the store does not cover, or a unit shadow over the keys waits as before. ### Tested - Linux (CachyOS, x86-64, RTX 4090): full build with `BUILD_TESTING=ON` and `ctest` pass (145/145). - New `pendingKeyStoreTests` in `agc_driver_recorder_tests` (GPU, run by hand like the rest of that executable): after a pending uncompressed key store, the keys (and a range inside them) read as uncompressed while the store is still pending; a later writer over part of the keys makes the read wait and the store lands; the keys of a pending fill read as the fill's keys without a wait, and a later, wider writer is waited for. With the `PendingStoreKeys` line removed from `CurrentDccKeys` it fails with "reading keys the driver's own pending store wrote waited for the GPU". - PPSA21564: on my integration branch since 2026-10-02 through repeated passes of my visual regression check (checkpoint frames, flicker, shimmer, video tearing, FPS). - #290 and #291 also edit `Recorder.*`; each merges cleanly with this branch. ### 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
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!458
No description provided.