fix(shader): drop vector stores through TYPE 2/3 and FORMAT 0 buffer V#s as measured #10831

Merged
cgrd merged 2 commits from upstream-pr/10831 into main 2026-10-29 10:22:00 +00:00
cgrd commented 2026-10-25 03:24:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by cgrd on 2026-10-25T03:24:01Z.


What

A buffer V# with TYPE (word 3 bits 30-31) not 0 throws buffer descriptor uses an unsupported type for any access. Puyo Puyo Tetris 2's fill kernel stores through an image T# left in its buffer slot (02100b00 c3c00000 010dc1df 91b00fac, TYPE 2, FORMAT 0), so it stops right after the window opens (#3709).

Measured on a PS5 (CFI-1115B, fw 12.20) with a native test app, one TYPE 0 control per launch:

  • TYPE 2/3, FORMAT 0 or valid: buffer_store_dword and buffer_store_format_x write nothing and don't fault, also with that exact V# and its unmapped base.
  • TYPE 2/3 loads and GLC atomics write nothing but leave the destination VGPR unchanged.
  • TYPE 0, FORMAT 0: loads return 0, stores write nothing.
  • TYPE 1: GPU page fault for every load, store and atomic.

Now a buffer a PS5 shader only stores to through TYPE 2/3, and vector accesses through TYPE 0 FORMAT 0, bind as a null V#. TYPE 1, TYPE 2/3 loads and atomics, tbuffer_*, scalar loads, FORMAT above 77, GCN shaders and run-time-loaded V#s still throw (debt entry in shader.md). For #6412/#7689: those loads don't fault on the console.

Tested

Linux, RX 9070 XT. main 52a8bed576 vs this PR 052f7aa4cb.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R 'agc_driver_buffer_descriptor_runtime|agc_driver_draw_unsupported_buffer_type' -V

The existing 4 tests pass on main and here, with the layer loaded in both (7 insertions each) and 0 VUIDs. The new DisabledDescriptors case passes here and fails on main with buffer specialization has an unsupported format.

Puyo Puyo Tetris 2 (PPSA01937): main stops at the V# above; this PR gets past it to sceRemoteplayInitialize: invalid argument (null heap, separate PR). With that fix too it boots, reaches the title at 10 s and plays a Solo Versus match at 59.9 FPS.

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 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: Fixes #3709
  • Unblocks: PPSA01937 #6421 (with the sceRemoteplayInitialize null heap fix)
  • GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.5, Linux 7.3 (CachyOS)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5001454270 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10831). Originally posted by [cgrd](https://github.com/cgrd) on 2026-10-25T03:24:01Z. --- ### What A buffer V# with TYPE (word 3 bits 30-31) not 0 throws `buffer descriptor uses an unsupported type` for any access. Puyo Puyo Tetris 2's fill kernel stores through an image T# left in its buffer slot (`02100b00 c3c00000 010dc1df 91b00fac`, TYPE 2, FORMAT 0), so it stops right after the window opens (#3709). Measured on a PS5 (CFI-1115B, fw 12.20) with a native test app, one TYPE 0 control per launch: * TYPE 2/3, FORMAT 0 or valid: `buffer_store_dword` and `buffer_store_format_x` write nothing and don't fault, also with that exact V# and its unmapped base. * TYPE 2/3 loads and GLC atomics write nothing but leave the destination VGPR unchanged. * TYPE 0, FORMAT 0: loads return 0, stores write nothing. * TYPE 1: GPU page fault for every load, store and atomic. Now a buffer a PS5 shader only stores to through TYPE 2/3, and vector accesses through TYPE 0 FORMAT 0, bind as a null V#. TYPE 1, TYPE 2/3 loads and atomics, `tbuffer_*`, scalar loads, FORMAT above 77, GCN shaders and run-time-loaded V#s still throw (debt entry in `shader.md`). For #6412/#7689: those loads don't fault on the console. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Linux, RX 9070 XT. `main` 52a8bed576 vs this PR 052f7aa4cb. ``` ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \ ctest --test-dir build -R 'agc_driver_buffer_descriptor_runtime|agc_driver_draw_unsupported_buffer_type' -V ``` The existing 4 tests pass on `main` and here, with the layer loaded in both (7 insertions each) and 0 VUIDs. The new `DisabledDescriptors` case passes here and fails on `main` with `buffer specialization has an unsupported format`. Puyo Puyo Tetris 2 (PPSA01937): `main` stops at the V# above; this PR gets past it to `sceRemoteplayInitialize: invalid argument` (null heap, separate PR). With that fix too it boots, reaches the title at 10 s and plays a Solo Versus match at 59.9 FPS. ### 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 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: Fixes #3709 - [x] Unblocks: PPSA01937 #6421 (with the `sceRemoteplayInitialize` null heap fix) - [x] GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.5, Linux 7.3 (CachyOS) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-25 03:36:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T03:36:38Z.

Review: CHANGES_REQUESTED


I rechecked this exact head and compared the patch with the earlier PR #10827. The diffs are byte-for-byte identical, so the outstanding scope concern from the earlier review still applies here.

The PS5 evidence covers buffer_store_dword and buffer_store_format_x. In disabledBufferDescriptor(), every TYPE 2/3 descriptor up through FORMAT32_32_32_32Float can be disabled when !buffer.read; disabledBufferAccesses() excludes typed, scalar, atomic, image-alias and runtime-loaded descriptor accesses, but does not constrain vector store width or component count. Thus unmeasured multi-dword vector stores are also nulled, while the debt entry explicitly says those are assumed rather than measured.

Please either restrict the change to the exact measured instruction/format forms and leave the other vector stores throwing, or add console measurements plus regression cases for the wider forms. The reported focused GPU test does not cover those unmeasured widths. This request is about the behavior scope; the policy checks pass, while the current head has no hosted product build/test run.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641365024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10831#pullrequestreview-5641365024). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T03:36:38Z. **Review:** CHANGES_REQUESTED --- I rechecked this exact head and compared the patch with the earlier PR #10827. The diffs are byte-for-byte identical, so the outstanding scope concern from the earlier review still applies here. The PS5 evidence covers `buffer_store_dword` and `buffer_store_format_x`. In `disabledBufferDescriptor()`, every TYPE 2/3 descriptor up through FORMAT32_32_32_32Float can be disabled when `!buffer.read`; `disabledBufferAccesses()` excludes typed, scalar, atomic, image-alias and runtime-loaded descriptor accesses, but does not constrain vector store width or component count. Thus unmeasured multi-dword vector stores are also nulled, while the debt entry explicitly says those are assumed rather than measured. Please either restrict the change to the exact measured instruction/format forms and leave the other vector stores throwing, or add console measurements plus regression cases for the wider forms. The reported focused GPU test does not cover those unmeasured widths. This request is about the behavior scope; the policy checks pass, while the current head has no hosted product build/test run.
MarcZX10 commented 2026-10-25 04:27:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T04:27:44Z.

Review: CHANGES_REQUESTED


Reviewed exact head 951e9328671b7d21e04114c16baf966876375ce4. The complete patch is byte-for-byte identical to the patch in your closed PR #10827, so this currently republishes the same work as a second PR. Please reopen/update #10827 or explain the distinct reason for replacing it, rather than leaving duplicate PRs in the queue. The earlier scope concern also remains: disabledBufferAccesses does not limit TYPE 2/3 vector stores to the measured one-dword buffer_store_dword and buffer_store_format_x forms. It nulls any non-typed, non-scalar, non-atomic vector-write descriptor up through FORMAT32_32_32_32Float; the debt entry explicitly says multi-dword behavior is assumed. Please constrain the behavior to measured store forms or add PS5 evidence and regression cases for the broader formats and widths. Diff-check and conventions pass; hosted conventions and labels pass. The reported Linux/Vulkan and title checks are author-reported; this runner has no GPU-backed test binary/device available, so I could not rerun them locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641487594 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10831#pullrequestreview-5641487594). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T04:27:44Z. **Review:** CHANGES_REQUESTED --- Reviewed exact head 951e9328671b7d21e04114c16baf966876375ce4. The complete patch is byte-for-byte identical to the patch in your closed PR #10827, so this currently republishes the same work as a second PR. Please reopen/update #10827 or explain the distinct reason for replacing it, rather than leaving duplicate PRs in the queue. The earlier scope concern also remains: disabledBufferAccesses does not limit TYPE 2/3 vector stores to the measured one-dword buffer_store_dword and buffer_store_format_x forms. It nulls any non-typed, non-scalar, non-atomic vector-write descriptor up through FORMAT32_32_32_32Float; the debt entry explicitly says multi-dword behavior is assumed. Please constrain the behavior to measured store forms or add PS5 evidence and regression cases for the broader formats and widths. Diff-check and conventions pass; hosted conventions and labels pass. The reported Linux/Vulkan and title checks are author-reported; this runner has no GPU-backed test binary/device available, so I could not rerun them locally.
MarcZX10 commented 2026-10-25 04:59:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T04:59:15Z.

Review: CHANGES_REQUESTED


Requesting the same behavior-scope correction on the current open PR; its tree has not changed from the previous reviewed implementation.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5641633681 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10831#pullrequestreview-5641633681). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T04:59:15Z. **Review:** CHANGES_REQUESTED --- Requesting the same behavior-scope correction on the current open PR; its tree has not changed from the previous reviewed implementation.
adriadam10 commented 2026-10-26 22:42:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-26T22:42:05Z.

Review: CHANGES_REQUESTED


Thanks for the measurements. Three things to fix:

  • agc_driver_failed_capture_dump now fails on this head. FailedCaptureDump.cpp:91 builds its trigger from a TYPE 2 V# (0xa1b00fac) and requires the dispatch to throw unsupported type (line 104); with this change that dispatch no longer throws. It was reproduced by @tablefrogpillow, @wachi35676 and @TechLevelZero on RADV, NVIDIA, AMD on Windows and lavapipe. Move that fixture to a descriptor that still throws (a TYPE 1 V#, e.g. 0x61b00fac, was reported to make it pass) in this PR.
  • Scope: disabledBufferDescriptor() (ResourceMaterializer.cpp:1498-1503) nulls every TYPE 2/3 vector write up to Format32_32_32_32Float, but the PS5 measurements cover only one-dword buffer_store_dword and buffer_store_format_x, and the debt entry says multi-dword stores are assumed. Either restrict to the measured forms (MemoryInfo::dataDwords/componentCount == 1 in disabledBufferAccesses, others keep throwing, with a test that they do) or add measurements for the wider forms.
  • This patch is identical to #10827, which was closed. Please say why it replaces it, or continue there.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5660085617 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10831#pullrequestreview-5660085617). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-26T22:42:05Z. **Review:** CHANGES_REQUESTED --- Thanks for the measurements. Three things to fix: - `agc_driver_failed_capture_dump` now fails on this head. `FailedCaptureDump.cpp:91` builds its trigger from a TYPE 2 V# (`0xa1b00fac`) and requires the dispatch to throw `unsupported type` (line 104); with this change that dispatch no longer throws. It was reproduced by @tablefrogpillow, @wachi35676 and @TechLevelZero on RADV, NVIDIA, AMD on Windows and lavapipe. Move that fixture to a descriptor that still throws (a TYPE 1 V#, e.g. `0x61b00fac`, was reported to make it pass) in this PR. - Scope: `disabledBufferDescriptor()` (`ResourceMaterializer.cpp:1498-1503`) nulls every TYPE 2/3 vector write up to `Format32_32_32_32Float`, but the PS5 measurements cover only one-dword `buffer_store_dword` and `buffer_store_format_x`, and the debt entry says multi-dword stores are assumed. Either restrict to the measured forms (`MemoryInfo::dataDwords`/`componentCount` == 1 in `disabledBufferAccesses`, others keep throwing, with a test that they do) or add measurements for the wider forms. - This patch is identical to #10827, which was closed. Please say why it replaces it, or continue there.
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!10831
No description provided.