fix(agc): check pending DCC writers before proof reuse #6676

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/6676 into main
MarcZX10 commented 2026-10-16 03:55:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T03:55:58Z.


What

An unchanged host write-watch generation is not sufficient to reuse a DCC-key proof when the recorder has an unsignaled GPU writer for the same metadata range. The proof fast path now checks the recorder's pending-write state before returning cached keys. If a pending writer is present, the existing key-read path resolves it before a fresh proof is stored.

The recorder regression now checks that the old proof cannot bypass an unknown pending key writer, that resolving the writer produces a fresh stable proof, and that the proof is reused afterwards. This follows up on the failing keyProofTests assertion reported during review of #6642.

Tested

  • An earlier configured Linux build compiled agc_driver_recorder_tests successfully. A clean rebuild after the rebase fails before reaching the changed code at SrtDescriptorEvaluation.cpp:183 (read.read->Flags<MemoryFlags>(), missing dependent-template disambiguation). This file is outside this PR. The target therefore is not currently reproducible in this clean build environment.
  • python3 tools/check_conventions.py --base upstream/main: passed after rebasing onto 5d9dcc42d.
  • git diff --check: passed.
  • Ran agc_driver_recorder_tests with lavapipe. The key-proof test was skipped because this Linux environment has no guest write-watch support; the full run later failed at the refresh's store of the results did not reach guest memory. Therefore the regression itself was not exercised locally and still needs a run on a write-watch-capable system.

Checklist

  • Based on current main; no other open PR implements the same behavior
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • No notes, investigation files or images added to the repository
  • Generic behavior, not specific to one title
  • Depends on: none
  • GPUs tested: none; lavapipe did not provide guest write-watch support
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4883250484 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6676). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T03:55:58Z. --- ### What An unchanged host write-watch generation is not sufficient to reuse a DCC-key proof when the recorder has an unsignaled GPU writer for the same metadata range. The proof fast path now checks the recorder's pending-write state before returning cached keys. If a pending writer is present, the existing key-read path resolves it before a fresh proof is stored. The recorder regression now checks that the old proof cannot bypass an unknown pending key writer, that resolving the writer produces a fresh stable proof, and that the proof is reused afterwards. This follows up on the failing `keyProofTests` assertion reported during review of #6642. ### Tested - An earlier configured Linux build compiled `agc_driver_recorder_tests` successfully. A clean rebuild after the rebase fails before reaching the changed code at `SrtDescriptorEvaluation.cpp:183` (`read.read->Flags<MemoryFlags>()`, missing dependent-template disambiguation). This file is outside this PR. The target therefore is not currently reproducible in this clean build environment. - `python3 tools/check_conventions.py --base upstream/main`: passed after rebasing onto `5d9dcc42d`. - `git diff --check`: passed. - Ran `agc_driver_recorder_tests` with lavapipe. The key-proof test was skipped because this Linux environment has no guest write-watch support; the full run later failed at `the refresh's store of the results did not reach guest memory`. Therefore the regression itself was not exercised locally and still needs a run on a write-watch-capable system. ### Checklist - [x] Based on current `main`; no other open PR implements the same behavior - [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] No notes, investigation files or images added to the repository - [x] Generic behavior, not specific to one title - [x] Depends on: none - [x] GPUs tested: none; lavapipe did not provide guest write-watch support - [x] AI-assisted: yes
fma-rc commented 2026-10-16 04:16:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-16T04:16:03Z.

Review: CHANGES_REQUESTED


I ran the no-argument agc_driver_recorder_tests with this head (46ddfb117, on main 5d9dcc42d) on an RTX 5080, a Radeon 610M (RADV) and lavapipe, 3 runs each. The rewritten key-proof check passes on all of them. It also passes with DccMetadata.cpp reverted to main, so the test does not fail without the code change.

The old assertion broke with #4554. A first-parent bisect from this PR's earlier base f8c2f0724 to 5d9dcc42d on a Radeon 680M gives 8bf10e51f as the first merge where (9) a scan under a pending write was kept fails. That change makes textureClearKeys call WaitForKeyWriters before reading, so the scan under a pending writer already waits and is stable on main. The test update matches main's current behaviour. Is there a sequence where an old proof is reused under a pending writer on current main? A test for it would need to fail with DccMetadata.cpp reverted.

With either variant the suite then stops in resourceReadTests at second draw observed overwritten input on all three devices, so #6642 still cannot register the full run.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5543006738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6676#pullrequestreview-5543006738). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-16T04:16:03Z. **Review:** CHANGES_REQUESTED --- I ran the no-argument `agc_driver_recorder_tests` with this head (46ddfb117, on main 5d9dcc42d) on an RTX 5080, a Radeon 610M (RADV) and lavapipe, 3 runs each. The rewritten key-proof check passes on all of them. It also passes with `DccMetadata.cpp` reverted to main, so the test does not fail without the code change. The old assertion broke with #4554. A first-parent bisect from this PR's earlier base f8c2f0724 to 5d9dcc42d on a Radeon 680M gives 8bf10e51f as the first merge where `(9) a scan under a pending write was kept` fails. That change makes `textureClearKeys` call `WaitForKeyWriters` before reading, so the scan under a pending writer already waits and is stable on main. The test update matches main's current behaviour. Is there a sequence where an old proof is reused under a pending writer on current main? A test for it would need to fail with `DccMetadata.cpp` reverted. With either variant the suite then stops in `resourceReadTests` at `second draw observed overwritten input` on all three devices, so #6642 still cannot register the full run.
MarcZX10 commented 2026-10-16 04:17:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T04:17:31Z.


Thanks for the detailed current-main check. I can't currently demonstrate a pending-writer sequence where the old proof is reused while is unchanged, and the revised test does not distinguish the production change from current main. I'll withdraw this patch rather than keep an unproven change open.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6207964764 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6676#issuecomment-6207964764). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T04:17:31Z. --- Thanks for the detailed current-main check. I can't currently demonstrate a pending-writer sequence where the old proof is reused while is unchanged, and the revised test does not distinguish the production change from current main. I'll withdraw this patch rather than keep an unproven change open.
MarcZX10 commented 2026-10-16 04:17:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T04:17:39Z.


Correction to my withdrawal note: I meant that I cannot demonstrate a pending-writer sequence where the old proof is reused while DccMetadata.cpp remains unchanged. The revised test also does not distinguish this production change from current main. I am withdrawing the patch.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6207966163 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6676#issuecomment-6207966163). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T04:17:39Z. --- Correction to my withdrawal note: I meant that I cannot demonstrate a pending-writer sequence where the old proof is reused while DccMetadata.cpp remains unchanged. The revised test also does not distinguish this production change from current main. I am withdrawing the patch.

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!6676
No description provided.