fix(agc): keep the template data buffer in dispatch run accesses #21780

Merged
muhmuhkuh merged 1 commit from upstream-pr/21780 into main 2026-11-27 17:19:02 +00:00
muhmuhkuh commented 2026-11-16 19:28:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by muhmuhkuh on 2026-11-16T19:28:49Z.


What

A recorded dispatch that refreshes its template's data (DataRefresh other than none) writes the buffer that holds the template's data words. ShaderResources::RunAccesses, which the dispatch overlap check compares between dispatches of a run, lists guest ranges, a BDA marker and storage images, but not that buffer. A dispatch rewriting the template's data could therefore join a run whose earlier dispatch still reads it, with no barrier between them.

RunAccesses now also lists the buffers of the resources' own allocations as a buffer access (Recorder::RunAccessBuffer), written when the dispatch refreshes the data (VulkanDevice.cpp passes record.dataRefresh != None). The overlap check treats a buffer access as a kind of its own, like an image access, so it never matches another access with the same handle value.

This was found by reading the code. The test shows it at the level of RunAccesses and OverlapCommands, not with a real dispatch series.

Overlap with open pull requests: none found. 66 open PRs that touch ShaderResources.cpp were searched for changed lines containing RunAccesses, RunAccessBuffer or dataRunAccess.

Tested

Windows 11 Pro (10.0.26200), NVIDIA GeForce RTX 3080 Ti, driver 610.88, MinGW GCC 15.2 (UCRT, POSIX threads, SEH), Release, validation layer on (ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation). Built on the same machine on main e602d6a587 and on this change at the same base.

  • The new check dataRunAccessTests runs inside agc_driver_recorder. Every ctest entry that runs agc_driver_recorder_tests (151 entries): all pass on main and all pass on this change.
  • Red probe on this change, reverted afterwards: with the new loop in RunAccesses skipped, agc_driver_recorder fails with "the template's data buffer is missing from its run accesses".
  • VUID: 0 VUID- lines in both logs. The loader log shows the validation layer inserted in every run; the phrase was not found but was requested by env var VK_INSTANCE_LAYERS: 0 occurrences in both.
  • Speed: not claimed; no trace_digest run.
  • Not run: the full CPU suite, Linux, the other AGC tests, and any title.

Checklist

  • Based on current main (e602d6a587 at posting time); 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 3080 Ti, driver 610.88, Windows 11 Pro 10.0.26200
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5343617876 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21780). Originally posted by [muhmuhkuh](https://github.com/muhmuhkuh) on 2026-11-16T19:28:49Z. --- ### What A recorded dispatch that refreshes its template's data (`DataRefresh` other than none) writes the buffer that holds the template's data words. `ShaderResources::RunAccesses`, which the dispatch overlap check compares between dispatches of a run, lists guest ranges, a BDA marker and storage images, but not that buffer. A dispatch rewriting the template's data could therefore join a run whose earlier dispatch still reads it, with no barrier between them. `RunAccesses` now also lists the buffers of the resources' own allocations as a buffer access (`Recorder::RunAccessBuffer`), written when the dispatch refreshes the data (`VulkanDevice.cpp` passes `record.dataRefresh != None`). The overlap check treats a buffer access as a kind of its own, like an image access, so it never matches another access with the same handle value. This was found by reading the code. The test shows it at the level of `RunAccesses` and `OverlapCommands`, not with a real dispatch series. Overlap with open pull requests: none found. 66 open PRs that touch `ShaderResources.cpp` were searched for changed lines containing `RunAccesses`, `RunAccessBuffer` or `dataRunAccess`. ### Tested Windows 11 Pro (10.0.26200), NVIDIA GeForce RTX 3080 Ti, driver 610.88, MinGW GCC 15.2 (UCRT, POSIX threads, SEH), Release, validation layer on (`ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`). Built on the same machine on `main` e602d6a587a and on this change at the same base. - The new check `dataRunAccessTests` runs inside `agc_driver_recorder`. Every `ctest` entry that runs `agc_driver_recorder_tests` (151 entries): all pass on `main` and all pass on this change. - Red probe on this change, reverted afterwards: with the new loop in `RunAccesses` skipped, `agc_driver_recorder` fails with "the template's data buffer is missing from its run accesses". - VUID: 0 `VUID-` lines in both logs. The loader log shows the validation layer inserted in every run; the phrase `was not found but was requested by env var VK_INSTANCE_LAYERS`: 0 occurrences in both. - Speed: not claimed; no trace_digest run. - Not run: the full CPU suite, Linux, the other AGC tests, and any title. ### Checklist - [x] Based on current `main` (e602d6a587a at posting time); 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 3080 Ti, driver 610.88, Windows 11 Pro 10.0.26200 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-20 11:25:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:25:55Z.

Review: APPROVED


Reviewed — looks good

The reviewed change at head 2ab28024e21417ee192efc28e96fed6a761bbe55 adds refreshed template data buffers to dispatch overlap checks, and I found no blocking defect.

What I ran

Read the prepared diff and all six changed files at the pinned head. No commands or tests were run in this review.

Results

Check Result Note
Changed files read passed 6 of 6
Tests in this review not run No execution performed
Author-reported tests not applicable Reported in the PR description

Negative control

Not run in this review. The PR description reports a red probe with the new access loop skipped; it is author-reported, not independently verified.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

No tests were run. The PR description reports passing recorder tests on Windows with an NVIDIA GeForce RTX 3080 Ti; that result was not independently confirmed. Linux, other AGC tests, and title behavior were not run. All changed files were read: VulkanDevice.cpp, Recorder.hpp, ShaderResources.hpp, Recorder.cpp, ShaderResources.cpp, and tests/Recorder.cpp. No changed files were excluded from this review.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5991935522 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/21780#pullrequestreview-5991935522). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T11:25:55Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change at head `2ab28024e21417ee192efc28e96fed6a761bbe55` adds refreshed template data buffers to dispatch overlap checks, and I found no blocking defect. ## What I ran Read the prepared diff and all six changed files at the pinned head. No commands or tests were run in this review. ## Results | Check | Result | Note | |---|---|---| | Changed files read | passed | 6 of 6 | | Tests in this review | not run | No execution performed | | Author-reported tests | not applicable | Reported in the PR description | ## Negative control Not run in this review. The PR description reports a red probe with the new access loop skipped; it is author-reported, not independently verified. ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [VulkanDevice.cpp at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/2ab28024e21417ee192efc28e96fed6a761bbe55/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L5931) - [ShaderResources.cpp at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/2ab28024e21417ee192efc28e96fed6a761bbe55/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L7514) - [Recorder.cpp at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/2ab28024e21417ee192efc28e96fed6a761bbe55/core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp#L1970) - [Recorder test at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/2ab28024e21417ee192efc28e96fed6a761bbe55/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp#L17099) ## Not verified No tests were run. The PR description reports passing recorder tests on Windows with an NVIDIA GeForce RTX 3080 Ti; that result was not independently confirmed. Linux, other AGC tests, and title behavior were not run. All changed files were read: `VulkanDevice.cpp`, `Recorder.hpp`, `ShaderResources.hpp`, `Recorder.cpp`, `ShaderResources.cpp`, and `tests/Recorder.cpp`. No changed files were excluded from this review. ## To get this to a good state Nothing is required.
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!21780
No description provided.