fix(agc): align recorded fast-clear access scopes #4362

Merged
krishalivaibhav merged 4 commits from upstream-pr/4362 into main 2026-10-12 22:17:11 +00:00
krishalivaibhav commented 2026-10-12 07:40:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T07:40:37Z.


What

Align the recorded DCC fast-clear access scopes in Texture.cpp with the other clear paths: add color-attachment read/write and transfer-read access to the pre-clear source scope and post-clear destination scope. The final code diff consists of these two barrier lines only.

This is access-scope consistency, not a demonstrated race fix. No original synchronization failure has been reproduced, and no game-unblocking or performance claim is made.

The agc_driver_recorded_clear_attachment fixture and its CMake registration have been removed as requested by oneandonlydean, because it passes with both original and proposed masks and does not guard this change.

Tested

  • git diff --check and python3 tools/check_conventions.py --base 436e310dd pass after the removal; final diff independently reviewed.
  • Before fixture removal, controlled Apple M2/MoltenVK runs in the modified local macOS runtime passed 3/3 with original masks and 3/3 with candidate masks. These runs show the fixture did not distinguish the change; they are not a regression reproduction or a clean-main full-suite result. The two production barrier lines are unchanged from that candidate.
  • Independent Windows report likewise found the fixture passing with both versions and no original synchronization-validation hazard. Those are contributor-reported results.
  • Build of the revised PR is pending the maintainer's offered run. Previous executed hosted checks passed at a55472cf9f36f2b033b30fddcb010c7dbcfdcb92; full Linux/Windows jobs there were skipped, not successful full builds.

The gameplay recording shows a combined local runtime reaching gameplay with later crashes. It does not isolate these masks or establish stability or stock-main compatibility.

Checklist

  • Based on main at 436e310d when prepared
  • One topic per PR; final diff only the two access-mask lines
  • Generic behavior; no title-specific workaround
  • No new third-party code or investigation artifacts
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4826371683 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-12T07:40:37Z. --- ### What Align the recorded DCC fast-clear access scopes in `Texture.cpp` with the other clear paths: add color-attachment read/write and transfer-read access to the pre-clear source scope and post-clear destination scope. The final code diff consists of these two barrier lines only. This is access-scope consistency, not a demonstrated race fix. No original synchronization failure has been reproduced, and no game-unblocking or performance claim is made. The `agc_driver_recorded_clear_attachment` fixture and its CMake registration have been removed as [requested by oneandonlydean](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6132847569), because it passes with both original and proposed masks and does not guard this change. ### Tested - `git diff --check` and `python3 tools/check_conventions.py --base 436e310dd` pass after the removal; final diff independently reviewed. - Before fixture removal, controlled Apple M2/MoltenVK runs in the modified local macOS runtime passed 3/3 with original masks and 3/3 with candidate masks. These runs show the fixture did not distinguish the change; they are not a regression reproduction or a clean-main full-suite result. The two production barrier lines are unchanged from that candidate. - [Independent Windows report](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6129389977) likewise found the fixture passing with both versions and no original synchronization-validation hazard. Those are contributor-reported results. - Build of the revised PR is pending the maintainer's offered run. Previous executed hosted checks passed at `a55472cf9f36f2b033b30fddcb010c7dbcfdcb92`; full Linux/Windows jobs there were skipped, not successful full builds. The [gameplay recording](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6120205675) shows a combined local runtime reaching gameplay with later crashes. It does not isolate these masks or establish stability or stock-main compatibility. ### Checklist - [x] Based on main at `436e310d` when prepared - [x] One topic per PR; final diff only the two access-mask lines - [x] Generic behavior; no title-specific workaround - [x] No new third-party code or investigation artifacts - [x] Depends on: none - [x] AI-assisted: yes
MarcZX10 commented 2026-10-12 07:43:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T07:43:34Z.


The conventions job fails only on PR-template structure: it reports What, Tested, and Checklist missing/empty. The checker recognizes ### headings (as in .github/pull_request_template.md), while this body uses ##. Could you change those three headings to ### and make sure the checklist includes Depends on: none and AI-assisted: yes/no? The test evidence and validation limitation can stay as written.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119945714 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6119945714). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T07:43:34Z. --- The conventions job fails only on PR-template structure: it reports `What`, `Tested`, and `Checklist` missing/empty. The checker recognizes `###` headings (as in `.github/pull_request_template.md`), while this body uses `##`. Could you change those three headings to `###` and make sure the checklist includes `Depends on: none` and `AI-assisted: yes/no`? The test evidence and validation limitation can stay as written.
krishalivaibhav commented 2026-10-12 07:56:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T07:56:26Z.


Gameplay follow-up: the tester reports normal enemy sprites and expected character trails after the local barrier candidate with asynchronous clears. The human validation run exited normally (177 seconds), and the focused GPU clear/LOAD/blend fixture passed 12 iterations on M2.

A subsequent longer/manual recording run exposed a separate blocker: AGC graphics: subgroup capability 61 is unsupported for shader stage 1 (GroupNonUniform in the vertex stage). The process aborted after approximately 64 seconds. This means gameplay is demonstrated, but sustained-session compatibility is not yet established. There is no evidence that screen recording caused the failure. We are investigating whether the shader has live subgroup operations or unnecessary declarations; we will not bypass the device capability check.

The uploaded-code PR covers only clear synchronization. The local game build additionally includes experimental macOS runtime and barycentric fallback changes. A gameplay recording has been captured locally and will be attached separately.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120120825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6120120825). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-12T07:56:26Z. --- Gameplay follow-up: the tester reports normal enemy sprites and expected character trails after the local barrier candidate with asynchronous clears. The human validation run exited normally (177 seconds), and the focused GPU clear/LOAD/blend fixture passed 12 iterations on M2. A subsequent longer/manual recording run exposed a separate blocker: `AGC graphics: subgroup capability 61 is unsupported for shader stage 1` (GroupNonUniform in the vertex stage). The process aborted after approximately 64 seconds. This means gameplay is demonstrated, but sustained-session compatibility is not yet established. There is no evidence that screen recording caused the failure. We are investigating whether the shader has live subgroup operations or unnecessary declarations; we will not bypass the device capability check. The uploaded-code PR covers only clear synchronization. The local game build additionally includes experimental macOS runtime and barycentric fallback changes. A gameplay recording has been captured locally and will be attached separately.
krishalivaibhav commented 2026-10-12 08:01:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T08:01:44Z.


Checked #1359: its production change completes pending copied CPU writes before direct reads. This PR changes recorded fast-clear Vulkan barrier access scopes; it does not use #1359’s additions and has no dependency on it.

The reported overlap is the CMake insertion point after the CMASK test. I moved this PR’s independent test registration after the recorder test block to avoid that insertion collision. The test target, sources, links and behavior are unchanged. Depends on: none remains accurate.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120194243 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6120194243). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-12T08:01:44Z. --- Checked #1359: its production change completes pending copied CPU writes before direct reads. This PR changes recorded fast-clear Vulkan barrier access scopes; it does not use #1359’s additions and has no dependency on it. The reported overlap is the CMake insertion point after the CMASK test. I moved this PR’s independent test registration after the recorder test block to avoid that insertion collision. The test target, sources, links and behavior are unchanged. `Depends on: none` remains accurate.
krishalivaibhav commented 2026-10-12 08:02:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T08:02:34Z.


https://github.com/user-attachments/assets/7e89df5e-c0bd-43ea-8812-9253eaf908e9

M2, 16 GB RAM, modified local AnyPS5 build. Gameplay works; a later vertex-subgroup crash remains under investigation.

(quality degraded due to compression).
;-;

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120205675 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6120205675). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-12T08:02:34Z. --- https://github.com/user-attachments/assets/7e89df5e-c0bd-43ea-8812-9253eaf908e9 M2, 16 GB RAM, modified local AnyPS5 build. Gameplay works; a later vertex-subgroup crash remains under investigation. (quality degraded due to compression). ;-;
krishalivaibhav commented 2026-10-12 08:32:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T08:32:55Z.


This PR is now ready for review. All executed checks passed at a55472cf9f. The full Linux/Windows jobs are skipped by the pull_request workflow condition, and the workflow requires a collaborator with write access to manually dispatch Build with pr=4362. Could a maintainer start that full build/test run? The focused GPU fixture has passed locally on M2; clean-main cross-platform GPU validation remains pending.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6120646198 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6120646198). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-12T08:32:55Z. --- This PR is now ready for review. All executed checks passed at a55472cf9f36f2b033b30fddcb010c7dbcfdcb92. The full Linux/Windows jobs are skipped by the pull_request workflow condition, and the workflow requires a collaborator with write access to manually dispatch Build with pr=4362. Could a maintainer start that full build/test run? The focused GPU fixture has passed locally on M2; clean-main cross-platform GPU validation remains pending.
kr4y4 commented 2026-10-12 17:36:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-12T17:36:38Z.


Windows run, as asked above.

Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head a55472cf9 merged into main 2a5eca11c.

  • agc_driver_recorded_clear_attachment passes on both GPUs with --repeat until-fail:3.
  • Full suite (ctest --timeout 120 --parallel 4): 974 of 974 on the RTX 4070. On the iGPU 973 of 974; the one failure, agc_driver_f32_dot2_rounding, fails the same way on main (no shaderFloat64, #4528).
  • In the focused runs, agc_driver_graphics failed once in three on the RTX 4070 with write-watched arena contained no host exclusion to test. That check depends on the process's address layout and fails with other changes too (see #4584), so it isn't this PR.

Whether the fixture catches the missing access bits:

  • With main's Texture.cpp the new test also passes on both GPUs. The recorded clear path does run: a temporary print before its barriers fired 12 times per run, once per frame.
  • I ran the test under the Khronos validation layer 1.4.363 with synchronization validation on (VK_KHRONOS_VALIDATION_VALIDATE_SYNC=true), logging errors and warnings. There were no messages on either GPU, with main's Texture.cpp or with this change.
  • As a control, giving the clear's second barrier TOP_OF_PIPE as its source stage produces 10 SYNC-HAZARD-WRITE-AFTER-WRITE in the same run, so the layer does track this path.

So on Windows, as far as the layer can tell, main's barriers already order this clear before the blended draw, and the fixture doesn't reproduce a hazard. I can't say whether MoltenVK behaves differently.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129389977 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6129389977). Originally posted by [kr4y4](https://github.com/kr4y4) on 2026-10-12T17:36:38Z. --- Windows run, as asked above. Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head a55472cf9 merged into `main` 2a5eca11c. - `agc_driver_recorded_clear_attachment` passes on both GPUs with `--repeat until-fail:3`. - Full suite (`ctest --timeout 120 --parallel 4`): 974 of 974 on the RTX 4070. On the iGPU 973 of 974; the one failure, `agc_driver_f32_dot2_rounding`, fails the same way on `main` (no `shaderFloat64`, #4528). - In the focused runs, `agc_driver_graphics` failed once in three on the RTX 4070 with `write-watched arena contained no host exclusion to test`. That check depends on the process's address layout and fails with other changes too (see #4584), so it isn't this PR. Whether the fixture catches the missing access bits: - With `main`'s `Texture.cpp` the new test also passes on both GPUs. The recorded clear path does run: a temporary print before its barriers fired 12 times per run, once per frame. - I ran the test under the Khronos validation layer 1.4.363 with synchronization validation on (`VK_KHRONOS_VALIDATION_VALIDATE_SYNC=true`), logging errors and warnings. There were no messages on either GPU, with `main`'s `Texture.cpp` or with this change. - As a control, giving the clear's second barrier `TOP_OF_PIPE` as its source stage produces 10 `SYNC-HAZARD-WRITE-AFTER-WRITE` in the same run, so the layer does track this path. So on Windows, as far as the layer can tell, `main`'s barriers already order this clear before the blended draw, and the fixture doesn't reproduce a hazard. I can't say whether MoltenVK behaves differently. Written with AI assistance.
MarcZX10 commented 2026-10-12 20:31:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T20:31:51Z.


Thanks for the Windows run. Since the focused fixture passes unchanged on main on both GPUs and synchronization validation reports no hazard in either version, the current evidence does not demonstrate that the added barrier fixes a live race on those drivers. The TOP_OF_PIPE control shows the layer can detect an injected hazard, but it does not establish one in the original path. I’d keep this open for a MoltenVK/console-specific reproduction or other evidence before merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132113137 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6132113137). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T20:31:51Z. --- Thanks for the Windows run. Since the focused fixture passes unchanged on `main` on both GPUs and synchronization validation reports no hazard in either version, the current evidence does not demonstrate that the added barrier fixes a live race on those drivers. The TOP_OF_PIPE control shows the layer can detect an injected hazard, but it does not establish one in the original path. I’d keep this open for a MoltenVK/console-specific reproduction or other evidence before merging.
krishalivaibhav commented 2026-10-12 20:56:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T20:56:56Z.


MoltenVK follow-up: I ran a controlled local A/B on Apple M2, changing only the two access masks in this PR while keeping the other local macOS runtime changes identical. With Vulkan required (no skip), agc_driver_recorded_clear_attachment passed three consecutive runs with the original masks and three with the candidate masks. The candidate source and library were restored afterward.

This agrees with the Windows result: the current fixture does not establish a live race or demonstrate that these masks caused the gameplay improvement. The earlier gameplay recording used additional local runtime/graphics changes and should not be treated as an isolated reproduction of this PR.

The draw path also records a separate transfer-write to attachment-read/write dependency before a new render pass, which may explain the passing clear-to-LOAD/blend result. I am checking the prior-draw-to-clear dependency and whether a stronger fixture or a controlled gameplay A/B can reproduce a missing dependency. Until then, I agree that merging this as a demonstrated race fix would be premature.

AI-assisted: yes. These are local focused test results, not a clean-main full-suite run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132474535 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6132474535). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-12T20:56:56Z. --- MoltenVK follow-up: I ran a controlled local A/B on Apple M2, changing only the two access masks in this PR while keeping the other local macOS runtime changes identical. With Vulkan required (no skip), `agc_driver_recorded_clear_attachment` passed three consecutive runs with the original masks and three with the candidate masks. The candidate source and library were restored afterward. This agrees with the Windows result: the current fixture does not establish a live race or demonstrate that these masks caused the gameplay improvement. The earlier gameplay recording used additional local runtime/graphics changes and should not be treated as an isolated reproduction of this PR. The draw path also records a separate transfer-write to attachment-read/write dependency before a new render pass, which may explain the passing clear-to-LOAD/blend result. I am checking the prior-draw-to-clear dependency and whether a stronger fixture or a controlled gameplay A/B can reproduce a missing dependency. Until then, I agree that merging this as a demonstrated race fix would be premature. AI-assisted: yes. These are local focused test results, not a clean-main full-suite run.
oneandonlydean commented 2026-10-12 21:22:23 +00:00 (Migrated from github.com)

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


The runs above settle the test: agc_driver_recorded_clear_attachment passes on main on Windows and on MoltenVK, so it doesn't guard the change. Please drop it.

The two barrier lines stand without it: the recorded DCC fast clear in Texture.cpp is the one clear path there whose barriers lack the attachment read/write and transfer read access the others carry. With the test removed and the description saying that instead of claiming a fixed race, I'll build and merge it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132847569 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6132847569). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T21:22:23Z. --- The runs above settle the test: `agc_driver_recorded_clear_attachment` passes on `main` on Windows and on MoltenVK, so it doesn't guard the change. Please drop it. The two barrier lines stand without it: the recorded DCC fast clear in `Texture.cpp` is the one clear path there whose barriers lack the attachment read/write and transfer read access the others carry. With the test removed and the description saying that instead of claiming a fixed race, I'll build and merge it.
krishalivaibhav commented 2026-10-12 21:28:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by krishalivaibhav on 2026-10-12T21:28:01Z.


Done at 0b54425e3fe0b389007c429133e89eac95389645: removed the fixture and its CMake registration. The PR net diff is now only the two Texture.cpp access-mask lines. Title/body describe access-scope consistency, with no fixed-race, game-unblocking or performance claim.

git diff --check and conventions passed; independent review checked the isolated final diff and stage/access compatibility. The revised build is pending your offered run. Thank you for the clarification.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132933585 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4362#issuecomment-6132933585). Originally posted by [krishalivaibhav](https://github.com/krishalivaibhav) on 2026-10-12T21:28:01Z. --- Done at `0b54425e3fe0b389007c429133e89eac95389645`: removed the fixture and its CMake registration. The PR net diff is now only the two `Texture.cpp` access-mask lines. Title/body describe access-scope consistency, with no fixed-race, game-unblocking or performance claim. `git diff --check` and conventions passed; independent review checked the isolated final diff and stage/access compatibility. The revised build is pending your offered run. Thank you for the clarification. 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!4362
No description provided.