fix(agc): count every CP data write of a dispatch group as a write of the run #4586

Merged
ee6aba54 merged 1 commit from upstream-pr/4586 into main 2026-10-13 02:37:39 +00:00
ee6aba54 commented 2026-10-12 16:14:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-12T16:14:50Z.


What

The compute dispatch look-ahead (resolveGroupAhead) captures the dispatches of a group before the earlier ones run, and stops before a dispatch whose captured memory an earlier part of the run writes. WRITE_DATA and RELEASE_MEM stores were noted only as labels, and NoteLabel keeps only 4- and 8-byte values. A WRITE_DATA of more words, such as one that fills a buffer descriptor or an argument block between two dispatches, was not recorded at all, so the later dispatch was captured with the bytes from before the store.

Every such store now also enters the run's written ranges. A later dispatch whose capture overlaps it is no longer resolved ahead and is captured when it runs; an indirect dispatch whose arguments it covers stops the look-ahead as well, through the existing check of those ranges.

Tested

  • Ubuntu 24.04, Linux 7.0, GCC 13.3, Release, based on 2a5eca11c. ctest: 960 tests pass; video_out_flip_* and agc_driver_stencil_ref_export are skipped on this machine.
  • New agc_driver_write_data_written_ahead (RTX 5080): after a gate, one dispatch runs, a 16-byte WRITE_DATA replaces the buffer descriptor the next dispatch loads from memory, and the next dispatch increments the buffer that descriptor names. Without the change it increments the old buffer (stale 1, fresh 0); with it the new one. agc_driver_indirect_arguments_written_ahead still passes.
  • PPSA15304 (engine: Unreal Engine 5): a compute shader loaded record counts from an argument block the command buffer fills just before it and read float bounds left there (-FLT_MAX, -inf) as counts; the next dispatch stopped with "shader buffer exceeds descriptor range limit", and with that check relaxed the GPU hung on the resulting loop. With this change and #4499, #4500 and #4573 the title reaches its main menu.
  • Windows not built or tested.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4832074079 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4586). Originally posted by [ee6aba54](https://github.com/ee6aba54) on 2026-10-12T16:14:50Z. --- ### What The compute dispatch look-ahead (`resolveGroupAhead`) captures the dispatches of a group before the earlier ones run, and stops before a dispatch whose captured memory an earlier part of the run writes. `WRITE_DATA` and `RELEASE_MEM` stores were noted only as labels, and `NoteLabel` keeps only 4- and 8-byte values. A `WRITE_DATA` of more words, such as one that fills a buffer descriptor or an argument block between two dispatches, was not recorded at all, so the later dispatch was captured with the bytes from before the store. Every such store now also enters the run's written ranges. A later dispatch whose capture overlaps it is no longer resolved ahead and is captured when it runs; an indirect dispatch whose arguments it covers stops the look-ahead as well, through the existing check of those ranges. ### Tested - Ubuntu 24.04, Linux 7.0, GCC 13.3, Release, based on `2a5eca11c`. `ctest`: 960 tests pass; `video_out_flip_*` and `agc_driver_stencil_ref_export` are skipped on this machine. - New `agc_driver_write_data_written_ahead` (RTX 5080): after a gate, one dispatch runs, a 16-byte `WRITE_DATA` replaces the buffer descriptor the next dispatch loads from memory, and the next dispatch increments the buffer that descriptor names. Without the change it increments the old buffer (`stale 1, fresh 0`); with it the new one. `agc_driver_indirect_arguments_written_ahead` still passes. - PPSA15304 (engine: Unreal Engine 5): a compute shader loaded record counts from an argument block the command buffer fills just before it and read float bounds left there (`-FLT_MAX`, `-inf`) as counts; the next dispatch stopped with "shader buffer exceeds descriptor range limit", and with that check relaxed the GPU hung on the resulting loop. With this change and #4499, #4500 and #4573 the title reaches its main menu. - Windows not built or tested. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Scramblrrrr commented 2026-10-12 16:16:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T16:16:15Z.


Preparing Windows RTX5070Ti cross-test of head50deecc122117985665f9d4640ce39587b55377e. Applied cleanly to our public007 integration as source-only head9e54939c9ccbb7819288174438936da7716a5994: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-dispatch-write-cross-test . Conventions pass. Will freshly build the new GPU regression and existing indirect-arguments regression, then run production-only negative/restored if positive passes. Current007 import-budget comparison is still running older graphics, so no title-result claim for this fix yet. No duplicate upstream PR. AI-assisted: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128151412 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4586#issuecomment-6128151412). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T16:16:15Z. --- Preparing Windows RTX5070Ti cross-test of head50deecc122117985665f9d4640ce39587b55377e. Applied cleanly to our public007 integration as source-only head9e54939c9ccbb7819288174438936da7716a5994: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-dispatch-write-cross-test . Conventions pass. Will freshly build the new GPU regression and existing indirect-arguments regression, then run production-only negative/restored if positive passes. Current007 import-budget comparison is still running older graphics, so no title-result claim for this fix yet. No duplicate upstream PR. AI-assisted: Codex.
Scramblrrrr commented 2026-10-12 16:27:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T16:27:27Z.


Windows RTX5070Ti cross-test completed on integration9e54939c9 (canonical50deecc1 credited). Fresh GPU positive2/2PASS1.49s: write_data_written_ahead and indirect_arguments_written_ahead. Production-only negative removed the new writes.emplace_back line, retaining the new fixture: FAIL0.44s with exactly stale1/fresh0. Restored4/4PASS1.46s including copied_writer_copy and joined_import_writer_copy, no skips. Worktree clean, conventions pass. Source branch: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-dispatch-write-cross-test .

Patched graphics SHA2560D811ECCA52E21F573DCFD6D8886A546C0A75027EA6AFB8A5D90950E2E3625F4. Preparing007 cross-test, same quiet warm-cache12GiB-import config as previous control; unchanged libc. No007 improvement claim yet. AI-assisted: Codex; no title data uploaded.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128330075 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4586#issuecomment-6128330075). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-12T16:27:27Z. --- Windows RTX5070Ti cross-test completed on integration9e54939c9 (canonical50deecc1 credited). Fresh GPU positive2/2PASS1.49s: write_data_written_ahead and indirect_arguments_written_ahead. Production-only negative removed the new writes.emplace_back line, retaining the new fixture: FAIL0.44s with exactly stale1/fresh0. Restored4/4PASS1.46s including copied_writer_copy and joined_import_writer_copy, no skips. Worktree clean, conventions pass. Source branch: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-dispatch-write-cross-test . Patched graphics SHA2560D811ECCA52E21F573DCFD6D8886A546C0A75027EA6AFB8A5D90950E2E3625F4. Preparing007 cross-test, same quiet warm-cache12GiB-import config as previous control; unchanged libc. No007 improvement claim yet. AI-assisted: Codex; no title data uploaded.
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!4586
No description provided.