feat(agc-driver): replay a request as a prepared artifact with --prepare #4325

Merged
gravelas merged 1 commit from upstream-pr/4325 into main 2026-10-12 12:57:49 +00:00
gravelas commented 2026-10-12 06:12:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gravelas on 2026-10-12T06:12:14Z.


What

agc_shader_replay compiles a request through Recompile, the per-draw path. Shaders the driver prepares at registration go through PrepareShader instead, and that produces a different, larger artifact. So neither a preparation failure nor the size of a prepared artifact can be reproduced from a dumped request.

On Goat Simulator 3 (PPSA04159) the gap is large. Its registered compute shaders are prepared at registration, and the replay tool compiled them to about a third of what the driver actually builds:

Request (code address) Recompile (replay today) PrepareShader (--prepare)
0x200e370000 49,573 SPIR-V words 155,993 SPIR-V words
0x200dc20000 324,203 SPIR-V words 999,286 SPIR-V words

--prepare compiles each request with PrepareShader, the way the driver does at registration, and prints the artifact's SPIR-V size, or the first line of the failure. The usage line lists the option.

Tested

  • Windows 11, NVIDIA RTX 4080, MinGW-w64 GCC 15.2.0, Release with BUILD_TESTING=ON.
  • agc_shader_replay is EXCLUDE_FROM_ALL, so CI does not build it: built it explicitly (cmake --build build --target agc_shader_replay).
  • agc_shader_replay --prepare on 24 registration requests dumped from Goat Simulator 3 (ANYPS5_NO_SHADER_CACHE=1): all prepare, in 0.4 to 3.5 s each; plain replay of the same files still recompiles as before. The table above comes from these runs.
  • tools/check_conventions.py --base origin/main passes.

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:4825618830 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4325). Originally posted by [gravelas](https://github.com/gravelas) on 2026-10-12T06:12:14Z. --- ### What `agc_shader_replay` compiles a request through `Recompile`, the per-draw path. Shaders the driver prepares at registration go through `PrepareShader` instead, and that produces a different, larger artifact. So neither a preparation failure nor the size of a prepared artifact can be reproduced from a dumped request. On Goat Simulator 3 (PPSA04159) the gap is large. Its registered compute shaders are prepared at registration, and the replay tool compiled them to about a third of what the driver actually builds: | Request (code address) | `Recompile` (replay today) | `PrepareShader` (`--prepare`) | |---|---|---| | `0x200e370000` | 49,573 SPIR-V words | 155,993 SPIR-V words | | `0x200dc20000` | 324,203 SPIR-V words | 999,286 SPIR-V words | `--prepare` compiles each request with `PrepareShader`, the way the driver does at registration, and prints the artifact's SPIR-V size, or the first line of the failure. The usage line lists the option. ### Tested - Windows 11, NVIDIA RTX 4080, MinGW-w64 GCC 15.2.0, Release with `BUILD_TESTING=ON`. - `agc_shader_replay` is `EXCLUDE_FROM_ALL`, so CI does not build it: built it explicitly (`cmake --build build --target agc_shader_replay`). - `agc_shader_replay --prepare` on 24 registration requests dumped from Goat Simulator 3 (`ANYPS5_NO_SHADER_CACHE=1`): all prepare, in 0.4 to 3.5 s each; plain replay of the same files still recompiles as before. The table above comes from these runs. - `tools/check_conventions.py --base origin/main` passes. ### 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)
github-actions[bot] commented 2026-10-12 09:14:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T09:14:38Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4048 core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp L155
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6121265136 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4325#issuecomment-6121265136). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T09:14:38Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #4048 | `core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp` [L155](https://github.com/boykopovar/AnyPS5/blob/0ef9dc9282e45b2448db3dc64eec436348d0d126/core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp#L155) | | |
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!4325
No description provided.