perf(agc): baseline shader recompilation on registration #639

Merged
boykopovar merged 67 commits from upstream-pr/639 into main 2026-10-08 17:45:54 +00:00
boykopovar commented 2026-10-05 10:34:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-05T10:34:06Z.


What

All game shaders pass through Driver::RegisterShader during game initialization. Recompiling them at this stage would allow draw/dispatch to use precompiled SPIR-V without compiling shaders during gameplay.

The current recompiler embeds resource parameters into shader code, so resource changes require recompilation. Even without resource changes, the initial compilation still occurs just before rendering during gameplay. Original shaders read these parameters at runtime. Recompiled shaders must do the same: fixed code, with resources supplied separately.

Compiled artifacts are separated from invocation data, and RDNA-to-SPIR-V compilation runs during shader registration and static ABI preparation. Draw/dispatch require prepared artifacts and fail if missing. Pipeline specialization and direct access for CPU-resolvable buffers are partially implemented; specialization validation and serialization have been added. Vertex fetch restoration and image/sampler optimization remain incomplete.

If successful, this will eliminate the last fundamental source of performance overhead compared to a real PS5.

Tested

There's no noticeable performance improvement on Dreaming Sarah. This may be because shader recompilation has never been a significant feature in this game.

Checklist

  • 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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4743581750 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-05T10:34:06Z. --- ### What All game shaders pass through `Driver::RegisterShader` during game initialization. Recompiling them at this stage would allow draw/dispatch to use precompiled SPIR-V without compiling shaders during gameplay. The current recompiler embeds resource parameters into shader code, so resource changes require recompilation. Even without resource changes, the initial compilation still occurs just before rendering during gameplay. Original shaders read these parameters at runtime. Recompiled shaders must do the same: fixed code, with resources supplied separately. Compiled artifacts are separated from invocation data, and RDNA-to-SPIR-V compilation runs during shader registration and static ABI preparation. Draw/dispatch require prepared artifacts and fail if missing. Pipeline specialization and direct access for CPU-resolvable buffers are partially implemented; specialization validation and serialization have been added. Vertex fetch restoration and image/sampler optimization remain incomplete. If successful, this will eliminate the last fundamental source of performance overhead compared to a real PS5. ### Tested There's no noticeable performance improvement on Dreaming Sarah. This may be because shader recompilation has never been a significant feature in this game. ### Checklist - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none
adriadam10 commented 2026-10-05 11:03:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T11:03:32Z.


Is there anything I can do to help with this without getting in your way? One idea: before you remove the image/sampler specialization, a test-only PR on main with execution tests that pin results across T#/S# variations (formats, dst_sel, mip/array ranges, clamp/border modes, filters), so you can check the runtime-descriptor version against them. If you would rather have something else, or a separate piece of the remaining work, tell me which and I'll stay off the rest. #473 is on standby until this lands.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5993154220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-5993154220). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-05T11:03:32Z. --- Is there anything I can do to help with this without getting in your way? One idea: before you remove the image/sampler specialization, a test-only PR on `main` with execution tests that pin results across T#/S# variations (formats, `dst_sel`, mip/array ranges, clamp/border modes, filters), so you can check the runtime-descriptor version against them. If you would rather have something else, or a separate piece of the remaining work, tell me which and I'll stay off the rest. #473 is on standby until this lands.
boykopovar commented 2026-10-05 11:08:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-05T11:08:23Z.


Don't worry about changes to the main branch interfering with my progress. Keep up the good work. If my idea works, I'll resolve the conflicts myself and adapt everything.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5993223840 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-5993223840). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-05T11:08:23Z. --- Don't worry about changes to the main branch interfering with my progress. Keep up the good work. If my idea works, I'll resolve the conflicts myself and adapt everything.
adriadam10 commented 2026-10-05 11:11:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T11:11:35Z.


Thanks! Then I'll leave this area to you: no new PRs from me on moving shader compilation to registration or on resource specialization, since your approach replaces it. I'll keep working on the rest as before.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5993270560 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-5993270560). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-05T11:11:35Z. --- Thanks! Then I'll leave this area to you: no new PRs from me on moving shader compilation to registration or on resource specialization, since your approach replaces it. I'll keep working on the rest as before.
boykopovar commented 2026-10-05 11:15:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-05T11:15:00Z.


Regarding #473, it's still not worth making any architecture changes that don't align with shader recompilation at the registration stage.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5993320213 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-5993320213). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-05T11:15:00Z. --- Regarding #473, it's still not worth making any architecture changes that don't align with shader recompilation at the registration stage.
Celegans12 commented 2026-10-06 10:58:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T10:58:54Z.


Testing notes from PPSA26344 (Ghost of Yōtei v1.008) on the runtime buffer path, in case they help.

The pattern. Six compute shaders stop on main at GetBufferResource dword 0 is not a valid runtime value: 0x8000289300, 0x800022d100, 0x800028d800, 0x8000284e00, 0x80002a9600 and 0x80002a1f00.

  • They read a table of 192-byte records through a V# at [SRT+0x1b8]+0x20, then use the V#s stored in each record (+0x00, +0x10, +0xa0, +0xb0).
  • The record offset is either loop-carried (s48 * 0xc0) or taken from a tile-list entry.
  • Accesses through those V#s: buffer_load_ushort / ubyte / dword / dwordx4 (idxen), buffer_load_format_x, buffer_load_format_d16_xyzw (about 128 per shader), s_buffer_load, and buffer_store_byte / _d16_hi (glc).
  • On main, TakeGpuDescriptor routes a runtime V# to BDA only for 32-bit raw accesses, so the ushort load at pc 0x78c reaches GetHandle and throws.

Replay through this branch. I replayed the six captured requests through this branch's agc_shader_replay (531e76d7), with the SRT and record memory reconstructed from values captured live. The replay needed a local test-only patch: req version 8 and memory injection.

  • ResourceTracker accepts five of the six. The sixth (0x800022d100) stops earlier, at a VOP2 SDWA destination selector that #751 fixed on main, so a rebase covers it.

Two things showed up.

  1. Module size.
    • word3 is not an immediate, so formattedDispatch inlines all 77 formats at every formatted access.
    • Each module that compiles is about 56.7-56.9M SPIR-V words (227 MB), with 256 OpSwitches of 77 cases and 1.36M blocks. The title's other shaders are 17k-273k words.
    • I did not try to build a pipeline from one.
    • One SPIR-V function per (format, components, d16) called from the switch, or a switch on the format class, would keep it bounded.
  2. RuntimeImageMode (ResourceMaterializer.cpp:552) throws "image descriptor is incompatible with the static runtime image interface" for the placeholder T#s the title binds at P+0x84..0xe4.
    • These are 1x1 format-56 TYPE 9 (2D) T#s, sampled with image_sample_lz dim:3D.
    • With the captured memory, three of the five hit this. With those T#s nulled, all five recompile.

Not verified. The byte stores through these runtime V#s need write access in the BDA table. As far as I can see, AddressRanges (GuestBufferMemory.cpp:2306) grants it only to imported writable allocations or to ranges in writes, and the driver never sees a runtime V#'s range.

Context. At this point in the title the record table is empty (num_records 0, count 0), so the loop runs zero times on hardware. When the six dispatches are skipped, the title goes on to present frames. Happy to re-run these shaders with the title after a rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6014789347 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6014789347). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T10:58:54Z. --- Testing notes from PPSA26344 (Ghost of Yōtei v1.008) on the runtime buffer path, in case they help. **The pattern.** Six compute shaders stop on `main` at `GetBufferResource dword 0 is not a valid runtime value`: 0x8000289300, 0x800022d100, 0x800028d800, 0x8000284e00, 0x80002a9600 and 0x80002a1f00. - They read a table of 192-byte records through a V# at `[SRT+0x1b8]+0x20`, then use the V#s stored in each record (+0x00, +0x10, +0xa0, +0xb0). - The record offset is either loop-carried (`s48 * 0xc0`) or taken from a tile-list entry. - Accesses through those V#s: `buffer_load_ushort` / `ubyte` / `dword` / `dwordx4` (idxen), `buffer_load_format_x`, `buffer_load_format_d16_xyzw` (about 128 per shader), `s_buffer_load`, and `buffer_store_byte` / `_d16_hi` (glc). - On `main`, `TakeGpuDescriptor` routes a runtime V# to BDA only for 32-bit raw accesses, so the ushort load at pc 0x78c reaches `GetHandle` and throws. **Replay through this branch.** I replayed the six captured requests through this branch's `agc_shader_replay` (531e76d7), with the SRT and record memory reconstructed from values captured live. The replay needed a local test-only patch: req version 8 and memory injection. - `ResourceTracker` accepts five of the six. The sixth (0x800022d100) stops earlier, at a VOP2 SDWA destination selector that #751 fixed on `main`, so a rebase covers it. Two things showed up. 1. **Module size.** - `word3` is not an immediate, so `formattedDispatch` inlines all 77 formats at every formatted access. - Each module that compiles is about 56.7-56.9M SPIR-V words (227 MB), with 256 `OpSwitch`es of 77 cases and 1.36M blocks. The title's other shaders are 17k-273k words. - I did not try to build a pipeline from one. - One SPIR-V function per (format, components, d16) called from the switch, or a switch on the format class, would keep it bounded. 2. **`RuntimeImageMode` (`ResourceMaterializer.cpp:552`)** throws "image descriptor is incompatible with the static runtime image interface" for the placeholder T#s the title binds at `P+0x84..0xe4`. - These are 1x1 format-56 TYPE 9 (2D) T#s, sampled with `image_sample_lz dim:3D`. - With the captured memory, three of the five hit this. With those T#s nulled, all five recompile. **Not verified.** The byte stores through these runtime V#s need write access in the BDA table. As far as I can see, `AddressRanges` (`GuestBufferMemory.cpp:2306`) grants it only to imported writable allocations or to ranges in `writes`, and the driver never sees a runtime V#'s range. **Context.** At this point in the title the record table is empty (`num_records` 0, count 0), so the loop runs zero times on hardware. When the six dispatches are skipped, the title goes on to present frames. Happy to re-run these shaders with the title after a rebase.
Celegans12 commented 2026-10-06 17:49:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-06T17:49:55Z.


Two things from Ghost of Yōtei (PPSA26344) for this branch: a registration check at cf2bf8e27, and the sub-dword buffer stores behind most of its 1.3 fps.

I ran PrepareShader the way RegisterShader calls it (zero user data, code and header only) over the 126 compute programs the title dispatched in a run today: 103 prepare, 23 throw. Only ProcessShutdown is caught on the way out of sceAgcCreateShader, so I'd expect the 23 to stop the title at registration, though I haven't run it on this branch. 16 of them dispatch fine on our integration build.

  1. Five need support main already has: the SDWA selectors from #509 (not #751, as I wrote last time), the vcc global base from #750 and the DPP16 row_share controls from #660.
  2. Seven hit "shader image heap capacity exceeded". Each runtime image joins the group of every mode it might take, so a sampled group gets 18-20 images (capacity 16) or a storage group 5-7 (capacity 4).
  3. Eleven stop at a T# the tracker can't resolve, among them a waterfall (0x800037f200), a T#/S# behind a pointer in a record (0x8000333c00) and a loop over 0x1b8-byte records (0x80003cab00). Are these shapes planned here?
  4. Seven modules exceed the id bound of 4,194,303: 0x8000261500 and five record-table shaders from before (9.97M-12.36M, still the 77-format inline), and 0x8000390600. 0x8000305900 prepares into a valid module; I haven't run it.

On main, the light-culling shader (0x800036e100) takes about 589 ms of GPU time per dispatch, nearly all in compare-exchange loops for its 8- and 16-bit format stores, each an atomic over PCIe on host-imported memory. Plain 8/16-bit stores through aliased views take 28 ms, and the boot logos go from 1.3 to 5.6 fps with identical frames. Here runtime V#s store single bytes, but this shader's V#s take the direct path, where writeBuffer still merges sub-dword fields with AtomicUpdate. I have a small PR for main ready (buffers_u8/buffers_u16 views; odd addresses and devices without 16-bit storage keep the loop). Should I open it to land first, for you to keep or port, or hold it for you to fold in?

Two smaller questions. 0x80001e5f00 stores to tables it reads: is the bindless storage table refusal meant to stay? And 0x80002c4500's S# is unnormalized with wrap, which #799 still refuses (2391 skipped dispatches), but all 26 dispatches I dumped sample inside its 1408x1408 T#, so a clamp-to-edge sampler with a deferred fault outside it would be exact. On #822 that flag would be a ResourceSpecialization bit, which goes away here. Would a PipelineSpecialization entry suit you, and which FaultReason value? #757 adds ImageTable = 8, this branch InvalidDescriptor = 8.

Details
  • Rebase: 0x800022d100 (SDWA), 0x80001e5f00 (global_load_dword with vcc base, pc 0x4a9c), 0x80003b1700, 0x80003c5900, 0x80003dc800 (DPP).
  • Heap: 0x8000253100, 0x8000265d00, 0x80002c4500, 0x80002e1b00, 0x8000368d00, 0x80003cc000, 0x80003cfa00.
  • T#, others: 0x80001d5700, 0x80001fd400, 0x800024de00, 0x800027c200, 0x8000316900, 0x800031e600, 0x8000364b00, 0x80003aa700.
  • 0x800036e100 here: 41 spec constants, 7716 OpAtomicCompareExchange.
  • 0x80002c4500 S# 00008000 00fff000 05000000 00000000; u 0.5-719.5, v 96.5-1055.5.
  • Sub-dword A/B, RTX 3080 Laptop, GPU and draw profiling on: 13-14 to 46-57 presents per 10 s, GPU busy per present ~686 to ~110 ms, 67 frame dumps pixel-identical. Offline replay: 578-593 to 29-31 ms, written buffers byte-identical. A plain read-modify-write loses bytes (tiles share dwords), so it needs real narrow stores. About 4.5M loops per dispatch (138 per group).
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6022128464 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6022128464). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-06T17:49:55Z. --- Two things from Ghost of Yōtei (PPSA26344) for this branch: a registration check at cf2bf8e27, and the sub-dword buffer stores behind most of its 1.3 fps. I ran `PrepareShader` the way `RegisterShader` calls it (zero user data, code and header only) over the 126 compute programs the title dispatched in a run today: 103 prepare, 23 throw. Only `ProcessShutdown` is caught on the way out of `sceAgcCreateShader`, so I'd expect the 23 to stop the title at registration, though I haven't run it on this branch. 16 of them dispatch fine on our integration build. 1. Five need support `main` already has: the SDWA selectors from #509 (not #751, as I wrote last time), the vcc global base from #750 and the DPP16 row_share controls from #660. 2. Seven hit "shader image heap capacity exceeded". Each runtime image joins the group of every mode it might take, so a sampled group gets 18-20 images (capacity 16) or a storage group 5-7 (capacity 4). 3. Eleven stop at a T# the tracker can't resolve, among them a waterfall (0x800037f200), a T#/S# behind a pointer in a record (0x8000333c00) and a loop over 0x1b8-byte records (0x80003cab00). Are these shapes planned here? 4. Seven modules exceed the id bound of 4,194,303: 0x8000261500 and five record-table shaders from before (9.97M-12.36M, still the 77-format inline), and 0x8000390600. 0x8000305900 prepares into a valid module; I haven't run it. On `main`, the light-culling shader (0x800036e100) takes about 589 ms of GPU time per dispatch, nearly all in compare-exchange loops for its 8- and 16-bit format stores, each an atomic over PCIe on host-imported memory. Plain 8/16-bit stores through aliased views take 28 ms, and the boot logos go from 1.3 to 5.6 fps with identical frames. Here runtime V#s store single bytes, but this shader's V#s take the direct path, where `writeBuffer` still merges sub-dword fields with `AtomicUpdate`. I have a small PR for `main` ready (`buffers_u8`/`buffers_u16` views; odd addresses and devices without 16-bit storage keep the loop). Should I open it to land first, for you to keep or port, or hold it for you to fold in? Two smaller questions. 0x80001e5f00 stores to tables it reads: is the bindless storage table refusal meant to stay? And 0x80002c4500's S# is unnormalized with wrap, which #799 still refuses (2391 skipped dispatches), but all 26 dispatches I dumped sample inside its 1408x1408 T#, so a clamp-to-edge sampler with a deferred fault outside it would be exact. On #822 that flag would be a `ResourceSpecialization` bit, which goes away here. Would a `PipelineSpecialization` entry suit you, and which `FaultReason` value? #757 adds `ImageTable = 8`, this branch `InvalidDescriptor = 8`. <details><summary>Details</summary> - Rebase: 0x800022d100 (SDWA), 0x80001e5f00 (`global_load_dword` with vcc base, pc 0x4a9c), 0x80003b1700, 0x80003c5900, 0x80003dc800 (DPP). - Heap: 0x8000253100, 0x8000265d00, 0x80002c4500, 0x80002e1b00, 0x8000368d00, 0x80003cc000, 0x80003cfa00. - T#, others: 0x80001d5700, 0x80001fd400, 0x800024de00, 0x800027c200, 0x8000316900, 0x800031e600, 0x8000364b00, 0x80003aa700. - 0x800036e100 here: 41 spec constants, 7716 `OpAtomicCompareExchange`. - 0x80002c4500 S# `00008000 00fff000 05000000 00000000`; u 0.5-719.5, v 96.5-1055.5. - Sub-dword A/B, RTX 3080 Laptop, GPU and draw profiling on: 13-14 to 46-57 presents per 10 s, GPU busy per present ~686 to ~110 ms, 67 frame dumps pixel-identical. Offline replay: 578-593 to 29-31 ms, written buffers byte-identical. A plain read-modify-write loses bytes (tiles share dwords), so it needs real narrow stores. About 4.5M loops per dispatch (138 per group). </details>
boykopovar commented 2026-10-07 12:01:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-07T12:01:15Z.


@Celegans12 I'll finish this branch myself for now. All that's left is to rebase again. And test it on different games.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6037463261 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6037463261). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-07T12:01:15Z. --- @Celegans12 I'll finish this branch myself for now. All that's left is to rebase again. And test it on different games.
Celegans12 commented 2026-10-07 12:05:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T12:05:06Z.


Sounds good. Once the rebase is up, I'll run Ghost of Yōtei on it (Windows, RTX 3080) and post how far it gets, including the 23 compute programs that failed PrepareShader last time. Until #639 lands I'll keep the sub-dword store change local, and I can redo it on top afterwards if you still want it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6037523859 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6037523859). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-07T12:05:06Z. --- Sounds good. Once the rebase is up, I'll run Ghost of Yōtei on it (Windows, RTX 3080) and post how far it gets, including the 23 compute programs that failed `PrepareShader` last time. Until #639 lands I'll keep the sub-dword store change local, and I can redo it on top afterwards if you still want it.
github-actions[bot] commented 2026-10-07 13:55:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T13:55:59Z.


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
#1128 sceAgcCreatePrimState
sceAgcLinkShaders
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6039494405 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6039494405). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T13:55:59Z. --- <!-- 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 | |---|---|---|---| | #1128 | | `sceAgcCreatePrimState`<br>`sceAgcLinkShaders` | |
boykopovar commented 2026-10-07 15:59:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-07T15:59:06Z.


Test Changes

  • DPP/DS/LDS, scalar, VOP/SDWA, FP16/32/64, buffer/flat/global, atomics, image: corrected buffer descriptor OOB modes: mode 3 for byte addressing, mode 1 for indexed records. The new path enforces index < records && offset < stride; main’s previous direct path bypassed it. Computational expectations remain unchanged.
  • FormatD16/TbufferFormatD16: also corrected OOB fields in descriptors embedded in shader machine code.
  • ShaderMemory/ShaderDiskCache/ShaderDeviceProfile: updated ABI, binding indices, runtime image modes and SPIR-V expectations. Static artifacts are now separate from runtime data; specialization removes unused instructions, constants and bindings. Export mapping no longer changes the static cache key.
  • Graphics/BdaResources: updated ShaderData, mock-device limits, binding indices and diagnostics; verify split BDA ranges with precise read/write permissions. Required by the new runtime ABI and access tracking.
  • ShaderHelpers/InterpolantMapping/GuestShaderLink: updated stubs for registration and ABI preparation. Dummy unregistered headers no longer satisfy registration-time preparation.
  • PreparedShaders/Graphics/Exports/Publication: added registration, ABI compatibility, artifact reuse, publication and runtime-data transition checks. Fixtures and expectations now reflect preparation being separate from draw/dispatch.
  • RuntimeImages, packed image, TypedHeaps, BindlessImages, VertexFetch, BufferLoadStore: added checks that resource changes reuse the static artifact.
  • sRGB/converted UNORM/emulated compare: updated runtime-error expectations, added cached repetitions and checks for bindings retained after specialization. Descriptor validation now occurs during materialization; specialized SPIR-V determines the active bindings.

GuestSystemFont: unrelated to the branch architecture; changed the fixture directory to avoid deleting an open file on Windows.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6041675417 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6041675417). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-07T15:59:06Z. --- Test Changes - DPP/DS/LDS, scalar, VOP/SDWA, FP16/32/64, buffer/flat/global, atomics, image: corrected buffer descriptor OOB modes: mode 3 for byte addressing, mode 1 for indexed records. The new path enforces `index < records && offset < stride`; main’s previous direct path bypassed it. Computational expectations remain unchanged. - FormatD16/TbufferFormatD16: also corrected OOB fields in descriptors embedded in shader machine code. - ShaderMemory/ShaderDiskCache/ShaderDeviceProfile: updated ABI, binding indices, runtime image modes and SPIR-V expectations. Static artifacts are now separate from runtime data; specialization removes unused instructions, constants and bindings. Export mapping no longer changes the static cache key. - Graphics/BdaResources: updated ShaderData, mock-device limits, binding indices and diagnostics; verify split BDA ranges with precise read/write permissions. Required by the new runtime ABI and access tracking. - ShaderHelpers/InterpolantMapping/GuestShaderLink: updated stubs for registration and ABI preparation. Dummy unregistered headers no longer satisfy registration-time preparation. - PreparedShaders/Graphics/Exports/Publication: added registration, ABI compatibility, artifact reuse, publication and runtime-data transition checks. Fixtures and expectations now reflect preparation being separate from draw/dispatch. - RuntimeImages, packed image, TypedHeaps, BindlessImages, VertexFetch, BufferLoadStore: added checks that resource changes reuse the static artifact. - sRGB/converted UNORM/emulated compare: updated runtime-error expectations, added cached repetitions and checks for bindings retained after specialization. Descriptor validation now occurs during materialization; specialized SPIR-V determines the active bindings. GuestSystemFont: unrelated to the branch architecture; changed the fixture directory to avoid deleting an open file on Windows.
boykopovar commented 2026-10-08 15:39:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-08T15:39:00Z.


In main, baseline recompilation depends on the resource configuration and runs on the first use of each corresponding variant.

This branch prepares IR, the static interface, baseline SPIR-V, and available ABI variants during shader registration. The compiled artifact is separate from per-draw and per-dispatch data.

Before the first execution with a new resource configuration, the runtime reads descriptors, validates compatibility, prepares the binding plan, specializes existing SPIR-V by substituting constants and removing unused branches and computations, materializes invocation data, and creates the Vulkan pipeline. These results are cached.

Variants that depend on linked graphics stages are prepared when the corresponding ABI is resolved. Unregistered compute shaders undergo baseline preparation on their first dispatch, emit an error log, and cache the result.

Subsequent executions reuse prepared artifacts, specializations, and pipelines while updating invocation data and resources as needed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6063503837 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6063503837). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-08T15:39:00Z. --- In main, baseline recompilation depends on the resource configuration and runs on the first use of each corresponding variant. This branch prepares IR, the static interface, baseline SPIR-V, and available ABI variants during shader registration. The compiled artifact is separate from per-draw and per-dispatch data. Before the first execution with a new resource configuration, the runtime reads descriptors, validates compatibility, prepares the binding plan, specializes existing SPIR-V by substituting constants and removing unused branches and computations, materializes invocation data, and creates the Vulkan pipeline. These results are cached. Variants that depend on linked graphics stages are prepared when the corresponding ABI is resolved. Unregistered compute shaders undergo baseline preparation on their first dispatch, emit an error log, and cache the result. Subsequent executions reuse prepared artifacts, specializations, and pipelines while updating invocation data and resources as needed.
gjonn commented 2026-10-08 16:23:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-08T16:23:22Z.


Since baseline compilation now runs at shader registration, a large title spends a long time before its first frame with nothing on screen. On one title I tested, the first launch compiled about 1,400 shaders over roughly 100 s before anything appeared; later launches are faster once the disk cache is warm. Could the preparation path report progress? For example, a line like Compiling shaders: N compiled, M failed, updated every ~250 ms, in the console window title and on the console. I tried this locally from the PrepareShader path with SetConsoleTitleA plus a CONOUT$ write, and it made the wait much easier to tell apart from a hang.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064305523 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6064305523). Originally posted by [gjonn](https://github.com/gjonn) on 2026-10-08T16:23:22Z. --- Since baseline compilation now runs at shader registration, a large title spends a long time before its first frame with nothing on screen. On one title I tested, the first launch compiled about 1,400 shaders over roughly 100 s before anything appeared; later launches are faster once the disk cache is warm. Could the preparation path report progress? For example, a line like `Compiling shaders: N compiled, M failed`, updated every ~250 ms, in the console window title and on the console. I tried this locally from the `PrepareShader` path with `SetConsoleTitleA` plus a `CONOUT$` write, and it made the wait much easier to tell apart from a hang.
boykopovar commented 2026-10-08 16:30:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-08T16:30:09Z.


Since baseline compilation now runs at shader registration, a large title spends a long time before its first frame with nothing on screen. On one title I tested, the first launch compiled about 1,400 shaders over roughly 100 s before anything appeared; later launches are faster once the disk cache is warm. Could the preparation path report progress? For example, a line like Compiling shaders: N compiled, M failed, updated every ~250 ms, in the console window title and on the console. I tried this locally from the PrepareShader path with SetConsoleTitleA plus a CONOUT$ write, and it made the wait much easier to tell apart from a hang.

We'll definitely show the recompilation progress. I think it can be done right where the FPS counter is displayed. What game did you test it on, and how was the performance after that long loading time?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064424574 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6064424574). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-08T16:30:09Z. --- > Since baseline compilation now runs at shader registration, a large title spends a long time before its first frame with nothing on screen. On one title I tested, the first launch compiled about 1,400 shaders over roughly 100 s before anything appeared; later launches are faster once the disk cache is warm. Could the preparation path report progress? For example, a line like `Compiling shaders: N compiled, M failed`, updated every ~250 ms, in the console window title and on the console. I tried this locally from the `PrepareShader` path with `SetConsoleTitleA` plus a `CONOUT$` write, and it made the wait much easier to tell apart from a hang. We'll definitely show the recompilation progress. I think it can be done right where the FPS counter is displayed. What game did you test it on, and how was the performance after that long loading time?
adriadam10 commented 2026-10-08 16:37:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T16:37:29Z.


Since baseline compilation now runs at shader registration, a large title spends a long time before its first frame with nothing on screen. On one title I tested, the first launch compiled about 1,400 shaders over roughly 100 s before anything appeared; later launches are faster once the disk cache is warm. Could the preparation path report progress? For example, a line like Compiling shaders: N compiled, M failed, updated every ~250 ms, in the console window title and on the console. I tried this locally from the PrepareShader path with SetConsoleTitleA plus a CONOUT$ write, and it made the wait much easier to tell apart from a hang.

We'll definitely show the recompilation progress. I think it can be done right where the FPS counter is displayed. What game did you test it on, and how was the performance after that long loading time?

this loading progress should be in this or another pr?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064552489 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6064552489). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T16:37:29Z. --- > > Since baseline compilation now runs at shader registration, a large title spends a long time before its first frame with nothing on screen. On one title I tested, the first launch compiled about 1,400 shaders over roughly 100 s before anything appeared; later launches are faster once the disk cache is warm. Could the preparation path report progress? For example, a line like `Compiling shaders: N compiled, M failed`, updated every ~250 ms, in the console window title and on the console. I tried this locally from the `PrepareShader` path with `SetConsoleTitleA` plus a `CONOUT$` write, and it made the wait much easier to tell apart from a hang. > > We'll definitely show the recompilation progress. I think it can be done right where the FPS counter is displayed. What game did you test it on, and how was the performance after that long loading time? this loading progress should be in this or another pr?
boykopovar commented 2026-10-08 16:39:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-08T16:39:23Z.


@adriadam10 I'm so tired of this PR that I don't want to add this new functionality to it. Better in the next one. Otherwise, it might break something.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064585104 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6064585104). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-08T16:39:23Z. --- @adriadam10 I'm so tired of this PR that I don't want to add this new functionality to it. Better in the next one. Otherwise, it might break something.
gjonn commented 2026-10-08 16:40:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-08T16:40:12Z.


Since baseline compilation now runs at shader registration, a large title spends a long time before its first frame with nothing on screen. On one title I tested, the first launch compiled about 1,400 shaders over roughly 100 s before anything appeared; later launches are faster once the disk cache is warm. Could the preparation path report progress? For example, a line like Compiling shaders: N compiled, M failed, updated every ~250 ms, in the console window title and on the console. I tried this locally from the PrepareShader path with SetConsoleTitleA plus a CONOUT$ write, and it made the wait much easier to tell apart from a hang.

We'll definitely show the recompilation progress. I think it can be done right where the FPS counter is displayed. What game did you test it on, and how was the performance after that long loading time?

Gran Turismo 7 - performance is still bad. Working on some other issues that this PR doesn't address.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064599309 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6064599309). Originally posted by [gjonn](https://github.com/gjonn) on 2026-10-08T16:40:12Z. --- > > Since baseline compilation now runs at shader registration, a large title spends a long time before its first frame with nothing on screen. On one title I tested, the first launch compiled about 1,400 shaders over roughly 100 s before anything appeared; later launches are faster once the disk cache is warm. Could the preparation path report progress? For example, a line like `Compiling shaders: N compiled, M failed`, updated every ~250 ms, in the console window title and on the console. I tried this locally from the `PrepareShader` path with `SetConsoleTitleA` plus a `CONOUT$` write, and it made the wait much easier to tell apart from a hang. > > We'll definitely show the recompilation progress. I think it can be done right where the FPS counter is displayed. What game did you test it on, and how was the performance after that long loading time? Gran Turismo 7 - performance is still bad. Working on some other issues that this PR doesn't address.
boykopovar commented 2026-10-08 16:41:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-08T16:41:39Z.


Gran Turismo 7 - performance is still bad. Working on some other issues that this PR doesn't address.

Is the performance worse after long loading times on this game compared to main?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064623623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6064623623). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-08T16:41:39Z. --- > Gran Turismo 7 - performance is still bad. Working on some other issues that this PR doesn't address. Is the performance worse after long loading times on this game compared to main?
gjonn commented 2026-10-08 16:45:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-08T16:45:43Z.


Gran Turismo 7 - performance is still bad. Working on some other issues that this PR doesn't address.

Is the performance worse after long loading times on this game compared to main?

It's worse but it's missing some of the optimizations I had already applied in my other branch. I'm in the process of adding them into this branch now to compare the two.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064693047 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6064693047). Originally posted by [gjonn](https://github.com/gjonn) on 2026-10-08T16:45:43Z. --- > > Gran Turismo 7 - performance is still bad. Working on some other issues that this PR doesn't address. > > Is the performance worse after long loading times on this game compared to main? It's worse but it's missing some of the optimizations I had already applied in my other branch. I'm in the process of adding them into this branch now to compare the two.
boykopovar commented 2026-10-08 17:43:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-08T17:43:09Z.


Finally

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6065674039 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6065674039). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-08T17:43:09Z. --- Finally
Celegans12 commented 2026-10-08 20:52:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-08T20:52:54Z.


Ghost of Yōtei (PPSA26344 v1.008) now stops at start-up on main, about 7-8 s in, before the swapchain is created. The registration-time preparation throws for a program the game hasn't executed yet, nothing catches it, and the process terminates:

  • main 6b56175a (this merge, before #1217): unsupported SOP1 opcode 33
  • main 55e8959b (with #1217): computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvable

Neither error showed up in our hour-long runs on the tree before this PR, so as far as I can tell these programs either never run in that part of the game or aren't reached for a long time. With preparation at registration, one unsupported instruction in any registered program now ends the whole title. That's probably the start-up regression you were worried about, just in a harder form than a slow first launch.

Would it work to record a preparation failure per shader and raise it at that shader's first draw or dispatch instead? That keeps exact-or-throw for every program that actually runs, without stopping a title over ones that don't. I'm happy to test a change on Yōtei.

Details

Windows 11, RTX 3080 Laptop, a save past the first-boot screens, cold shader cache (format 19).

[shader-disk-cache] C:/ps5/work/shader_caches/a94e9b263fff3d29\a94e9b263fff3d29 (source version a94e9b263fff3d29, format 19)
[libc] unhandled exception 'St16invalid_argument' thrown from 00007ffb69cd5956
terminate called after throwing an instance of 'std::invalid_argument'
  what():  computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvable
FATAL: abort() (SIGABRT) on thread 11100

The abort comes right after Vulkan device ready, on the first device. On 4b005b22 (before this PR), the same save gets past the swapchain and stops later at a descriptor read that #759 fixes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6068842924 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/639#issuecomment-6068842924). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-08T20:52:54Z. --- Ghost of Yōtei (PPSA26344 v1.008) now stops at start-up on `main`, about 7-8 s in, before the swapchain is created. The registration-time preparation throws for a program the game hasn't executed yet, nothing catches it, and the process terminates: - `main` 6b56175a (this merge, before #1217): `unsupported SOP1 opcode 33` - `main` 55e8959b (with #1217): `computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvable` Neither error showed up in our hour-long runs on the tree before this PR, so as far as I can tell these programs either never run in that part of the game or aren't reached for a long time. With preparation at registration, one unsupported instruction in any registered program now ends the whole title. That's probably the start-up regression you were worried about, just in a harder form than a slow first launch. Would it work to record a preparation failure per shader and raise it at that shader's first draw or dispatch instead? That keeps exact-or-throw for every program that actually runs, without stopping a title over ones that don't. I'm happy to test a change on Yōtei. <details><summary>Details</summary> Windows 11, RTX 3080 Laptop, a save past the first-boot screens, cold shader cache (`format 19`). ``` [shader-disk-cache] C:/ps5/work/shader_caches/a94e9b263fff3d29\a94e9b263fff3d29 (source version a94e9b263fff3d29, format 19) [libc] unhandled exception 'St16invalid_argument' thrown from 00007ffb69cd5956 terminate called after throwing an instance of 'std::invalid_argument' what(): computed/data-dependent s_swappc_b64 call target at program counter 0x00000074 is not statically resolvable FATAL: abort() (SIGABRT) on thread 11100 ``` The abort comes right after `Vulkan device ready`, on the first device. On 4b005b22 (before this PR), the same save gets past the swapchain and stops later at a descriptor read that #759 fixes. </details>
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!639
No description provided.