AGC: registering a compute shader header without specials throws (ps5-opengl, PPSA99005) #2580

Closed
opened 2026-10-10 06:50:32 +00:00 by AlxcBTW · 3 comments
AlxcBTW commented 2026-10-10 06:50:32 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T06:50:32Z.


PPSA99005 (ps5-opengl showcase) stops at AGC driver: shader metadata is outside the registered header when it registers its compute shaders.

Cause

A registered compute shader takes its wave size from its header's specials (dispatch_modifier), and PrepareRegistered reads them without a null check. ps5-opengl registers compute headers without specials, because it only writes the specials pointer at +40 for linked graphics stages. It passes the wave size in the dispatch initiator instead: sceAgcCbDispatch(..., m->compute_wave_size == 32 ? 0x8000 : 0) in src/platform/ps5_agc_runtime_backend.c. The specials pointer is 0, so registration throws.

Fix

AlxcBTW:fix/agc-compute-without-specials-v2 (d5655a45, on main d5c8e42d). It now uses main's deferred preparation (52b77c20) instead of its own dispatch path. In PrepareRegistered, a compute header without specials calls defer("its header has no specials to give its wave size"), so the shader is prepared at its first dispatch with the wave size from the initiator's CS_W32_EN. The change is 4 lines plus a test. In full CI, Linux and macOS pass. The only Windows failure is agc_driver_prepared_shaders_deferred_undecodable, which currently fails on every main run (#2606). I can't open it as a PR while intake is limited, so it's here if a collaborator wants to cherry-pick it.

Tested

Windows 11, WinLibs GCC 15.2.0 r7.

  • agc_driver_prepared_shaders gains RegistrationWithoutSpecials. It registers a compute header without specials and dispatches it with initiators 0x8041 (wave32) and 0x41 (wave64). Without the change the test fails with shader metadata is outside the registered header. With it, the test passes. ctest -R ^agc on d5c8e42d: all pass except agc_driver_f32_arithmetic_nan, which fails the same way without the change on this NVIDIA GPU.
  • With the first version of this change (AlxcBTW/AnyPS5#4, same behaviour through its own dispatch path), the showcase got past registration, prepared its compute shaders at dispatch and reached ready GL=4.6 (Core Profile) Mesa 26.2.0. The full chain is in #2026. I haven't rerun the showcase on this version yet.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5788929524 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2580). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-10T06:50:32Z. --- PPSA99005 (ps5-opengl showcase) stops at `AGC driver: shader metadata is outside the registered header` when it registers its compute shaders. ### Cause A registered compute shader takes its wave size from its header's specials (`dispatch_modifier`), and `PrepareRegistered` reads them without a null check. ps5-opengl registers compute headers without specials, because it only writes the specials pointer at +40 for linked graphics stages. It passes the wave size in the dispatch initiator instead: `sceAgcCbDispatch(..., m->compute_wave_size == 32 ? 0x8000 : 0)` in `src/platform/ps5_agc_runtime_backend.c`. The specials pointer is 0, so registration throws. ### Fix [`AlxcBTW:fix/agc-compute-without-specials-v2`](https://github.com/AlxcBTW/AnyPS5/pull/10) (`d5655a45`, on `main` d5c8e42d). It now uses `main`'s deferred preparation (52b77c20) instead of its own dispatch path. In `PrepareRegistered`, a compute header without specials calls `defer("its header has no specials to give its wave size")`, so the shader is prepared at its first dispatch with the wave size from the initiator's `CS_W32_EN`. The change is 4 lines plus a test. In [full CI](https://github.com/AlxcBTW/AnyPS5/actions/runs/38034914231), Linux and macOS pass. The only Windows failure is `agc_driver_prepared_shaders_deferred_undecodable`, which currently fails on every `main` run (#2606). I can't open it as a PR while intake is limited, so it's here if a collaborator wants to cherry-pick it. ### Tested Windows 11, WinLibs GCC 15.2.0 r7. - `agc_driver_prepared_shaders` gains `RegistrationWithoutSpecials`. It registers a compute header without specials and dispatches it with initiators `0x8041` (wave32) and `0x41` (wave64). Without the change the test fails with `shader metadata is outside the registered header`. With it, the test passes. `ctest -R ^agc` on d5c8e42d: all pass except `agc_driver_f32_arithmetic_nan`, which fails the same way without the change on this NVIDIA GPU. - With the first version of this change (AlxcBTW/AnyPS5#4, same behaviour through its own dispatch path), the showcase got past registration, prepared its compute shaders at dispatch and reached `ready GL=4.6 (Core Profile) Mesa 26.2.0`. The full chain is in #2026. I haven't rerun the showcase on this version yet. AI-assisted: yes (Claude Code).
LeandroLP23 commented 2026-10-10 08:29:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-10T08:29:57Z.


Windows/AMD data point: this is ps5-opengl's (PPSA99005 v1.0.1) next stop on Windows once its missing imports are present. On main 89a1fb4e it stops at _umtx_op; with #1482 (_umtx_op), the #2106 rebase (pthread_sigmask) and #1872 (pthread_set_name_np) merged on top, it loads, opens video out ([ps5-agc] present-open handle=00000001 ... buffers=2) and stops with:

terminate called after throwing an instance of 'std::runtime_error'
  what():  AGC driver: shader metadata is outside the registered header

Radeon 860M (RDNA 3.5), Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release.

81a5a1a0 doesn't apply to current main any more: ShaderRegistry.cpp has been reworked since (background preparation in #2583, deferred undecodable shaders, the null pixel program prepared at use), and the conflict is in the same function the fix changes (PreparedAtDispatch against main's PreparedAtUse). I didn't rebase it, since it needs to be redone on the new code rather than merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095690759 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2580#issuecomment-6095690759). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-10T08:29:57Z. --- Windows/AMD data point: this is ps5-opengl's (PPSA99005 v1.0.1) next stop on Windows once its missing imports are present. On `main` 89a1fb4e it stops at `_umtx_op`; with #1482 (`_umtx_op`), the #2106 rebase (`pthread_sigmask`) and #1872 (`pthread_set_name_np`) merged on top, it loads, opens video out (`[ps5-agc] present-open handle=00000001 ... buffers=2`) and stops with: ``` terminate called after throwing an instance of 'std::runtime_error' what(): AGC driver: shader metadata is outside the registered header ``` Radeon 860M (RDNA 3.5), Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release. 81a5a1a0 doesn't apply to current `main` any more: `ShaderRegistry.cpp` has been reworked since (background preparation in #2583, deferred undecodable shaders, the null pixel program prepared at use), and the conflict is in the same function the fix changes (`PreparedAtDispatch` against `main`'s `PreparedAtUse`). I didn't rebase it, since it needs to be redone on the new code rather than merged.
AlxcBTW commented 2026-10-10 08:33:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T08:33:34Z.


@LeandroLP23 thanks for the AMD run. 81a5a1a0 was the first version. The fix linked in the issue is the redone one, d5655a45 (AlxcBTW/AnyPS5#10): it uses main's deferred preparation (defer("its header has no specials to give its wave size")) instead of its own dispatch path. Dean carries it in #2627. If you can run the showcase with #2627 on top, that would show whether it gets past registration on AMD too.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095717284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2580#issuecomment-6095717284). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-10T08:33:34Z. --- @LeandroLP23 thanks for the AMD run. 81a5a1a0 was the first version. The fix linked in the issue is the redone one, `d5655a45` ([AlxcBTW/AnyPS5#10](https://github.com/AlxcBTW/AnyPS5/pull/10)): it uses `main`'s deferred preparation (`defer("its header has no specials to give its wave size")`) instead of its own dispatch path. Dean carries it in #2627. If you can run the showcase with #2627 on top, that would show whether it gets past registration on AMD too.
LeandroLP23 commented 2026-10-10 08:51:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-10T08:51:53Z.


@AlxcBTW thanks, I had picked up the first version. With #2627 (f752ef4f) it gets past registration on AMD too. ps5-opengl (PPSA99005 v1.0.1) on main c5d77d6b with #2627, #1482 (_umtx_op), the #2106 rebase (pthread_sigmask), #1872 (pthread_set_name_np) and your #2577/#2578 fixes on top (both merged since, as #2625 and #2626):

  • the compute headers without specials are deferred: Shader 0x21f3d9000 could not be prepared at registration (its header has no specials to give its wave size); preparing it when it is used
  • Mesa comes up: [ps5-gl46-showcase] ready GL=4.6 (Core Profile) Mesa 26.2.0 GLSL=4.60 size=3840x2160 particles=262144 instances=8192
  • it then stops at its first draw's shader, on a recompiler gap rather than anything in this fix: v_fma_mixlo/mixhi_f16 at pc 884 in FLOAT_MODE 204 (f16 denormals not kept or rounding not to nearest even) is not implemented

Radeon 860M (RDNA 3.5), Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095851962 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2580#issuecomment-6095851962). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-10T08:51:53Z. --- @AlxcBTW thanks, I had picked up the first version. With #2627 (`f752ef4f`) it gets past registration on AMD too. ps5-opengl (PPSA99005 v1.0.1) on `main` c5d77d6b with #2627, #1482 (`_umtx_op`), the #2106 rebase (`pthread_sigmask`), #1872 (`pthread_set_name_np`) and your #2577/#2578 fixes on top (both merged since, as #2625 and #2626): - the compute headers without specials are deferred: `Shader 0x21f3d9000 could not be prepared at registration (its header has no specials to give its wave size); preparing it when it is used` - Mesa comes up: `[ps5-gl46-showcase] ready GL=4.6 (Core Profile) Mesa 26.2.0 GLSL=4.60 size=3840x2160 particles=262144 instances=8192` - it then stops at its first draw's shader, on a recompiler gap rather than anything in this fix: `v_fma_mixlo/mixhi_f16 at pc 884 in FLOAT_MODE 204 (f16 denormals not kept or rounding not to nearest even) is not implemented` Radeon 860M (RDNA 3.5), Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release.
Sign in to join this conversation.
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#2580
No description provided.