feat(agc): implement deferred faults for reads through null SRT pointers #759

Merged
Celegans12 merged 1 commit from upstream-pr/759 into main 2026-10-09 19:06:47 +00:00
Celegans12 commented 2026-10-05 21:12:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-05T21:12:34Z.


What

Capturing a shader throws AGC driver: null or misaligned address when the flat SRT walk reads through a pointer loaded from memory that is null or unmapped, even if the program skips that s_load; the console faults only when a wave runs it. Following boykopovar's guidance, this is a pure runtime check: shaders still compile at registration and nothing per capture enters a key.

  • Registration: each ReadConst of a flat slot that can depend on such a read (ComputeGuardedFlatSlots) checks a flag word in the flattened SRT. A set flag raises an Unmapped BDA fault with the recorded pc and address and stops the invocation like an unmapped BDA read. These programs get the fault buffer (ShaderInfo::usesFaultBuffer).
  • Capture: an inaccessible read (SrtRuntime::accessible) is not made; the slot reads 0 and the capture appends the flags and {pc, address} records.
  • Poisoned and clean captures share one variant, specialization and pipeline; poisoned results skip the dispatch and draw caches. Disk cache format 21.
  • Still throws: descriptors (#1292), branch conditions, uniform fills, table bases and user-data pointers.
  • PPSA26344 v1.008: 0x800027c200 skips the loads through the null pointer at SRT+0x2e0 with s_cbranch_execz.
  • Overlaps: #757 adds the same fault-buffer pieces and #822 also takes format 21; whichever lands second rebases. #1747 also edits EvaluateRawRead and EvaluateRuntimeSourcesImpl.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, based on main 1be6f9f1: configure -DBUILD_TESTING=ON, full build, --target libs, ctest:
  • 486/486 tests pass (ctest --output-on-failure)
  • Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, VK_DRIVER_FILES): 485/485 pass; agc_driver_flat_store is left out there because it takes several minutes on Windows llvmpipe
  • New agc_driver_guarded_null_pointer (GPU): skipped null reads (SCC branch, s_cbranch_execz) don't fault; executed ones fault at their pc and address, even with one lane or an empty EXEC; all runs of a program share one pipeline variant.
  • agc_shader_memory: null, unmapped and chained records, one variant, specialization and module for poisoned and clean captures, replay, and the remaining throws. Neither test builds on main; both pass with -DANYPS5_ENABLE_SPIRV_TOOLS=ON.
  • PPSA26344 v1.008, before #639: 0x800027c200 dispatched with no fault. Not run again.
  • Not tested: graphics-stage execution on a GPU, console behaviour.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4750820019 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-05T21:12:34Z. --- ### What Capturing a shader throws `AGC driver: null or misaligned address` when the flat SRT walk reads through a pointer loaded from memory that is null or unmapped, even if the program skips that `s_load`; the console faults only when a wave runs it. Following boykopovar's guidance, this is a pure runtime check: shaders still compile at registration and nothing per capture enters a key. - Registration: each `ReadConst` of a flat slot that can depend on such a read (`ComputeGuardedFlatSlots`) checks a flag word in the flattened SRT. A set flag raises an `Unmapped` BDA fault with the recorded pc and address and stops the invocation like an unmapped BDA read. These programs get the fault buffer (`ShaderInfo::usesFaultBuffer`). - Capture: an inaccessible read (`SrtRuntime::accessible`) is not made; the slot reads 0 and the capture appends the flags and `{pc, address}` records. - Poisoned and clean captures share one variant, specialization and pipeline; poisoned results skip the dispatch and draw caches. Disk cache format 21. - Still throws: descriptors (#1292), branch conditions, uniform fills, table bases and user-data pointers. - PPSA26344 v1.008: 0x800027c200 skips the loads through the null pointer at SRT+0x2e0 with `s_cbranch_execz`. - Overlaps: #757 adds the same fault-buffer pieces and #822 also takes format 21; whichever lands second rebases. #1747 also edits `EvaluateRawRead` and `EvaluateRuntimeSourcesImpl`. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, based on `main` 1be6f9f1: configure `-DBUILD_TESTING=ON`, full build, `--target libs`, `ctest`: - 486/486 tests pass (`ctest --output-on-failure`) - Same build on lavapipe (Mesa 26.2.4 llvmpipe, 8-wide subgroups, `VK_DRIVER_FILES`): 485/485 pass; `agc_driver_flat_store` is left out there because it takes several minutes on Windows llvmpipe - New `agc_driver_guarded_null_pointer` (GPU): skipped null reads (SCC branch, `s_cbranch_execz`) don't fault; executed ones fault at their pc and address, even with one lane or an empty EXEC; all runs of a program share one pipeline variant. - `agc_shader_memory`: null, unmapped and chained records, one variant, specialization and module for poisoned and clean captures, replay, and the remaining throws. Neither test builds on `main`; both pass with `-DANYPS5_ENABLE_SPIRV_TOOLS=ON`. - PPSA26344 v1.008, before #639: 0x800027c200 dispatched with no fault. Not run again. - Not tested: graphics-stage execution on a GPU, console behaviour. ### Checklist - [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
github-actions[bot] commented 2026-10-06 15:13:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T15:13:30Z.


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
#218 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L1527, L1549-1550
#285 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp L456
#494 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp L90-108
#920 core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp
core/libs/prx/libSceAgcDriver/tests/execution/ImageTableCache.cpp
core/shader/recompiler/ImageTableAbi.hpp
#940 core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp L627-629, L968-971
#1074 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L197, L2458
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp L137
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp L92
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L521
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp L126, L495, L511
#1077 core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp L197, L2458
core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp L137
core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp L92
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp L521
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp L126, L256, L495, L511
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6019321236 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6019321236). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-06T15:13:30Z. --- <!-- 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 | |---|---|---|---| | #218 | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` [L1527](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1527), [L1549-1550](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1549-L1550) | | | | #285 | `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp` [L456](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L456) | | | | #494 | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp` [L90-108](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cpp#L90-L108) | | | | #920 | | | `core/libs/prx/libSceAgcDriver/tests/execution/ImageTable.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/execution/ImageTableCache.cpp`<br>`core/shader/recompiler/ImageTableAbi.hpp` | | #940 | `core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp` [L627-629](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp#L627-L629), [L968-971](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp#L968-L971) | | | | #1074 | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` [L197](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L197), [L2458](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L2458)<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp` [L137](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp#L137)<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp` [L92](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp#L92)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` [L521](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L521)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp` [L126](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L126), [L495](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L495), [L511](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L511) | | | | #1077 | `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` [L197](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L197), [L2458](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp#L2458)<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp` [L137](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/include/Context.hpp#L137)<br>`core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp` [L92](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hpp#L92)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp` [L521](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L521)<br>`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp` [L126](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L126), [L256](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L256), [L495](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L495), [L511](https://github.com/boykopovar/AnyPS5/blob/cea1ef13c35044356348bc6221d45f3a80f7df09/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp#L511) | | |
Celegans12 commented 2026-10-07 16:09:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T16:09:43Z.


A second title for this one: @orbz22 tested Astro's Playroom (PPSA01325) with #759 (a3de45b1) on top of #285, and the guest memory is not readable at 0x28 stop in compute shader 0x5001c6a00 (an SRT walk through a null user-data pointer) is gone (their report). The only conflict they hit was the role list in ShaderValidation.cpp, which needs both Gds and ImageTableMap.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6041871518 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6041871518). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-07T16:09:43Z. --- A second title for this one: @orbz22 tested Astro's Playroom (PPSA01325) with #759 (a3de45b1) on top of #285, and the `guest memory is not readable at 0x28` stop in compute shader 0x5001c6a00 (an SRT walk through a null user-data pointer) is gone ([their report](https://github.com/boykopovar/AnyPS5/pull/285#issuecomment-6041811306)). The only conflict they hit was the role list in `ShaderValidation.cpp`, which needs both `Gds` and `ImageTableMap`.
EdouardSence commented 2026-10-07 16:46:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-07T16:46:50Z.


Run of this PR on PPSA21567, as asked in #479.

Setup: Linux (CachyOS, kernel 7.2.8, GCC 16.2.1), Ryzen 7 7800X3D, RX 9070 XT (RADV GFX1201, Mesa 26.2.3). main 1e5bb880 + #285 (c7eac179) + this PR (a3de45b1). One conflict in ShaderValidation.cpp: the role allow-list gets both Gds (#285) and ImageTableMap (this PR). Default settings, one 180 s run.

stack stop
main compute shader 0x50082b700: AGC graphics: unsupported descriptor role Gds
main + #285 compute shader 0x5005f6100: AGC driver: guest memory is not readable at 0x30 (range 0x30+0x4)
main + #285 + this PR no stop at 0x5005f6100; the next stop is unrelated: FATAL: an address-based build copies 12403 MiB of 35 registered ranges, past 64 MiB (every host import fails on RADV, the case #943 addresses)

Not checked: whether the s_bitcmp1_b32 / s_trap path you pointed at in #479 executed. stderr has no fault report and no message naming 0x5005f6100, but I did not inspect the fault buffer.

AI-assisted: yes (Claude Code ran the builds and wrote this report; the runs are on my machine).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6042548824 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6042548824). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-07T16:46:50Z. --- Run of this PR on PPSA21567, as asked in #479. Setup: Linux (CachyOS, kernel 7.2.8, GCC 16.2.1), Ryzen 7 7800X3D, RX 9070 XT (RADV GFX1201, Mesa 26.2.3). `main` 1e5bb880 + #285 (c7eac179) + this PR (a3de45b1). One conflict in `ShaderValidation.cpp`: the role allow-list gets both `Gds` (#285) and `ImageTableMap` (this PR). Default settings, one 180 s run. | stack | stop | |---|---| | `main` | `compute shader 0x50082b700: AGC graphics: unsupported descriptor role Gds` | | `main` + #285 | `compute shader 0x5005f6100: AGC driver: guest memory is not readable at 0x30 (range 0x30+0x4)` | | `main` + #285 + this PR | no stop at `0x5005f6100`; the next stop is unrelated: `FATAL: an address-based build copies 12403 MiB of 35 registered ranges, past 64 MiB` (every host import fails on RADV, the case #943 addresses) | Not checked: whether the `s_bitcmp1_b32` / `s_trap` path you pointed at in #479 executed. stderr has no fault report and no message naming `0x5005f6100`, but I did not inspect the fault buffer. AI-assisted: yes (Claude Code ran the builds and wrote this report; the runs are on my machine).
Celegans12 commented 2026-10-07 17:02:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T17:02:48Z.


Thanks for running it on RDNA4. A third title, and the first on RADV, is a big help for this one.

On the part you didn't check: you don't need to read the fault buffer for that. If the guarded s_load had actually executed, the deferred fault would surface on stderr as BDA access failed: address=0x30 instruction=0x… bytes=4 … reason=1 for that dispatch, like any other BDA fault. So no such line for 0x5005f6100 means the read behind the branch never ran, which is the case this PR is for.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6042714390 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6042714390). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-07T17:02:48Z. --- Thanks for running it on RDNA4. A third title, and the first on RADV, is a big help for this one. On the part you didn't check: you don't need to read the fault buffer for that. If the guarded `s_load` had actually executed, the deferred fault would surface on stderr as `BDA access failed: address=0x30 instruction=0x… bytes=4 … reason=1` for that dispatch, like any other BDA fault. So no such line for `0x5005f6100` means the read behind the branch never ran, which is the case this PR is for.
EdouardSence commented 2026-10-07 17:36:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-07T17:36:41Z.


Checked: that run's stdout and stderr have no BDA access failed line, so the guarded read in 0x5005f6100 did not execute.

AI-assisted: yes (Claude Code checked the log; the run is on my machine).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6043346250 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6043346250). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-07T17:36:41Z. --- Checked: that run's stdout and stderr have no `BDA access failed` line, so the guarded read in `0x5005f6100` did not execute. AI-assisted: yes (Claude Code checked the log; the run is on my machine).
adriadam10 commented 2026-10-08 11:01:11 +00:00 (Migrated from github.com)

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


@boykopovar this one needs your call, because it's in the #639 area. The last commit (c838c1673) adds srtPoison (slot, pc, address of each read through a null SRT pointer) to ResourceSpecialization, and through BuildKey to the variant and the disk-cache key. #639 replaces specialization by resource with runtime descriptors. It's also stacked on #757/#758, which are already waiting on your ordering against #639.

Why it matters: it removes the guest memory is not readable at 0x28/0x30 stop on three titles. PPSA26344 (author), Astro's Playroom PPSA01325 (orbz22, on top of #285) and PPSA21567 (EdouardSence, RADV RDNA4, on top of #285; no BDA access failed line, so the guarded read really is skipped). Dean also sees this stop blocking a title on main.

Should it land before #639, or wait and get redone on runtime descriptors?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6058415091 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6058415091). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T11:01:11Z. --- @boykopovar this one needs your call, because it's in the #639 area. The last commit (c838c1673) adds `srtPoison` (slot, pc, address of each read through a null SRT pointer) to `ResourceSpecialization`, and through `BuildKey` to the variant and the disk-cache key. #639 replaces specialization by resource with runtime descriptors. It's also stacked on #757/#758, which are already waiting on your ordering against #639. Why it matters: it removes the `guest memory is not readable at 0x28/0x30` stop on three titles. PPSA26344 (author), Astro's Playroom PPSA01325 (orbz22, on top of #285) and PPSA21567 (EdouardSence, RADV RDNA4, on top of #285; no `BDA access failed` line, so the guarded read really is skipped). Dean also sees this stop blocking a title on `main`. Should it land before #639, or wait and get redone on runtime descriptors?
EdouardSence commented 2026-10-08 14:56:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-08T14:56:20Z.


A title that needs this: Ghost of Yōtei (PPSA26344 v01.008.000, retail). Headless runs on Linux, RX 9070 XT, Mesa 26.2.4 RADV.

Current main (29e533ac) stops before its first present:

compute shader 0x80003aa700: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x00000590(GetBufferResource(ReadConst(GetSrtResource, Immediate), ...), IMul32(ReadConstBuffer@pc=0x00000258(...), ShiftLeftLogical32(Phi(ReadConstBuffer@pc=0x000001e8(...), BitwiseAnd32(GetBuiltin(Immediate, Immediate), Immediate)), ...

The image descriptor is read from a buffer, at an offset computed in a loop. main + #1274 stops at the same line.

main at 6b573862 + this PR at c838c167 gets past it. Shader 0x80003aa700 no longer fails, 96 resource builds run instead of 43, and the next stop is a different shader:

compute shader 0x8000265d00: ShaderRecompiler::Recompile: DescriptorBindingBuilder::Populate unnormalized guest sampler is used with a texel offset, which is not implemented

That is the case #822 covers.

Caveats on that build:

  • It is an older base, with #1100 reverted and local logging-only diagnostics.
  • The current head of this PR (6fb7f68e) conflicts with main.
  • Merged together with #822 on current main, it gives 8 conflicts in the recompiler (DescriptorBindingBuilder, ResourceMaterializer, SpirvImageEmitter, ShaderDiskCache). I did not try to resolve those myself.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6062625051 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6062625051). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-08T14:56:20Z. --- A title that needs this: Ghost of Yōtei (PPSA26344 v01.008.000, retail). Headless runs on Linux, RX 9070 XT, Mesa 26.2.4 RADV. **Current `main` (29e533ac)** stops before its first present: ``` compute shader 0x80003aa700: GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x00000590(GetBufferResource(ReadConst(GetSrtResource, Immediate), ...), IMul32(ReadConstBuffer@pc=0x00000258(...), ShiftLeftLogical32(Phi(ReadConstBuffer@pc=0x000001e8(...), BitwiseAnd32(GetBuiltin(Immediate, Immediate), Immediate)), ... ``` The image descriptor is read from a buffer, at an offset computed in a loop. `main` + #1274 stops at the same line. **`main` at 6b573862 + this PR at c838c167** gets past it. Shader 0x80003aa700 no longer fails, 96 resource builds run instead of 43, and the next stop is a different shader: ``` compute shader 0x8000265d00: ShaderRecompiler::Recompile: DescriptorBindingBuilder::Populate unnormalized guest sampler is used with a texel offset, which is not implemented ``` That is the case #822 covers. Caveats on that build: - It is an older base, with #1100 reverted and local logging-only diagnostics. - The current head of this PR (6fb7f68e) conflicts with `main`. - Merged together with #822 on current `main`, it gives 8 conflicts in the recompiler (`DescriptorBindingBuilder`, `ResourceMaterializer`, `SpirvImageEmitter`, `ShaderDiskCache`). I did not try to resolve those myself. *Tested and written by Claude (AI assistant) on a contributor's machine.*
Celegans12 commented 2026-10-08 16:30:22 +00:00 (Migrated from github.com)

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


Thanks for the RADV run, it's good to see 0x80003aa700 get through on AMD too. The conflict with main came from today's cache format bump. 6fb7f68e is rebased onto it and merges cleanly now. For the #759 + #822 combination, I put a merged branch on my fork and described it on #822: https://github.com/Celegans12/AnyPS5/tree/test/yotei-759-822

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6064428378 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6064428378). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-08T16:30:22Z. --- Thanks for the RADV run, it's good to see 0x80003aa700 get through on AMD too. The conflict with `main` came from today's cache format bump. 6fb7f68e is rebased onto it and merges cleanly now. For the #759 + #822 combination, I put a merged branch on my fork and described it on #822: https://github.com/Celegans12/AnyPS5/tree/test/yotei-759-822
Celegans12 commented 2026-10-09 02:31:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-09T02:31:24Z.


I've rebuilt this as a pure runtime check, following boykopovar's guidance. It now sits directly on main instead of on #758 and #757, so it doesn't depend on either of them any more. This is the redo after #639 that adriadam10 asked about.

At registration, every flat SRT slot that can depend on a read through a pointer loaded from memory gets a guard: its ReadConst loads one flag word from the flattened SRT and branches on it. When a capture finds such a read null or unmapped, it skips the read, the slot reads 0, and the flag points at a {pc, address} record. If a wave actually executes the read, the shader raises an Unmapped BDA fault at that pc and stops the invocation. Nothing per capture goes into any key, so poisoned and clean captures share one variant, specialization and pipeline.

oneandonlydean mentioned this is the next fix Astro Bot needs. I haven't run Astro Bot on the new head myself, so a run from someone with the title would be very welcome. Otherwise it's ready for review.

Details
  • Head 56f8a62428 on main 1be6f9f1. Disk cache format 21, because usesFaultBuffer is encoded now; #822 also takes 21.
  • Cost per executed guarded ReadConst: one extra 32-bit load from a buffer the shader already reads, plus a uniform branch.
  • Still throws: descriptors (#1292, stacked on this PR), branch conditions, uniform fills, table bases and reads through user-data pointers.
  • Overlap with #757: the fault-buffer pieces are identical. Whichever of the two lands second has to combine CacheableResult and #757's fault-completion check.
  • Tests: agc_shader_memory and the GPU test agc_driver_guarded_null_pointer. A skipped null read doesn't fault, an executed one faults at its pc and address, and every run of a program uses one pipeline variant. Neither test builds on main.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6073058737 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6073058737). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-09T02:31:24Z. --- I've rebuilt this as a pure runtime check, following boykopovar's guidance. It now sits directly on `main` instead of on #758 and #757, so it doesn't depend on either of them any more. This is the redo after #639 that adriadam10 asked about. At registration, every flat SRT slot that can depend on a read through a pointer loaded from memory gets a guard: its `ReadConst` loads one flag word from the flattened SRT and branches on it. When a capture finds such a read null or unmapped, it skips the read, the slot reads 0, and the flag points at a `{pc, address}` record. If a wave actually executes the read, the shader raises an `Unmapped` BDA fault at that pc and stops the invocation. Nothing per capture goes into any key, so poisoned and clean captures share one variant, specialization and pipeline. oneandonlydean mentioned this is the next fix Astro Bot needs. I haven't run Astro Bot on the new head myself, so a run from someone with the title would be very welcome. Otherwise it's ready for review. <details><summary>Details</summary> - Head 56f8a62428 on `main` 1be6f9f1. Disk cache format 21, because `usesFaultBuffer` is encoded now; #822 also takes 21. - Cost per executed guarded `ReadConst`: one extra 32-bit load from a buffer the shader already reads, plus a uniform branch. - Still throws: descriptors (#1292, stacked on this PR), branch conditions, uniform fills, table bases and reads through user-data pointers. - Overlap with #757: the fault-buffer pieces are identical. Whichever of the two lands second has to combine `CacheableResult` and #757's fault-completion check. - Tests: `agc_shader_memory` and the GPU test `agc_driver_guarded_null_pointer`. A skipped null read doesn't fault, an executed one faults at its pc and address, and every run of a program uses one pipeline variant. Neither test builds on `main`. </details>
EdouardSence commented 2026-10-09 08:05:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-09T08:05:45Z.


Astro Bot (PPSA21567, retail) run on the new head 56f8a624. No regression from this PR, but the run doesn't reach its code yet.

Setup: RX 9070 XT (RDNA4), RADV / Mesa 26.2.4, Linux 7.2.9. Scripted input, headless gamescope, from boot. All stacks are on main a8b032b2 and merged cleanly.

Stack Where the run stops
this PR + #1836 + #1837 (needed to get past registration since #639) about 2 min 20 s: shader image heap capacity exceeded (#1789)
+ CouchRiv's #1789 branch (bd5f22c9) about 3 min: prepared shader artifact is missing for the requested static ABI ... stage=5 wave=64 (the null pixel program, #1901)
same stack without this PR the same stop at the same point
+ #1902 about 2 min 50 s: prepared rectangle artifacts are missing (details on #1902)
  • With this PR applied, no error is new compared with the same stack without it. No Unmapped fault came from the guarded reads.
  • No frame was presented in any of these runs, so the scene that needed this PR on the old astrobot branch is never reached. I'll run it again once the walls above are fixed.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077001771 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6077001771). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-09T08:05:45Z. --- Astro Bot (PPSA21567, retail) run on the new head 56f8a624. No regression from this PR, but the run doesn't reach its code yet. **Setup:** RX 9070 XT (RDNA4), RADV / Mesa 26.2.4, Linux 7.2.9. Scripted input, headless gamescope, from boot. All stacks are on `main` a8b032b2 and merged cleanly. | Stack | Where the run stops | |---|---| | this PR + #1836 + #1837 (needed to get past registration since #639) | about 2 min 20 s: `shader image heap capacity exceeded` (#1789) | | + CouchRiv's #1789 branch (bd5f22c9) | about 3 min: `prepared shader artifact is missing for the requested static ABI ... stage=5 wave=64` (the null pixel program, #1901) | | same stack **without** this PR | the same stop at the same point | | + #1902 | about 2 min 50 s: `prepared rectangle artifacts are missing` (details on #1902) | - With this PR applied, no error is new compared with the same stack without it. No `Unmapped` fault came from the guarded reads. - No frame was presented in any of these runs, so the scene that needed this PR on the old `astrobot` branch is never reached. I'll run it again once the walls above are fixed. *Tested and written by Claude (AI assistant) on a contributor's machine.*
EdouardSence commented 2026-10-09 12:43:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-09T12:43:59Z.


Astro Bot (PPSA21567) now reaches this PR's code, and it gets past the stop. Tested on head 56f8a624, Linux, RX 9070 XT (RADV), scripted and headless.

Base: main 43972e69 + #1836, #1837, #2105, #1893, #1902, #1928 and CouchRiv's #1789 branch (bd5f22c9).

  • Without this PR, the run stops about 1 min 30 s in on compute shader 0x5005f6100: AGC driver: guest memory is not readable at 0x30 (range 0x30+0x4). That is a read through a null SRT pointer.
  • With it, that dispatch goes through. No Unmapped fault is reported, so the guarded read is skipped and never executed.
  • The run continues to about 2 min. It then stops on an unrelated image-mode mismatch: a 2D access bound to a 1D T#, filed as #2237.

No frame is presented yet in these runs.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6081133695 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/759#issuecomment-6081133695). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-09T12:43:59Z. --- Astro Bot (PPSA21567) now reaches this PR's code, and it gets past the stop. Tested on head 56f8a624, Linux, RX 9070 XT (RADV), scripted and headless. **Base:** `main` 43972e69 + #1836, #1837, #2105, #1893, #1902, #1928 and CouchRiv's #1789 branch (bd5f22c9). - Without this PR, the run stops about 1 min 30 s in on `compute shader 0x5005f6100: AGC driver: guest memory is not readable at 0x30 (range 0x30+0x4)`. That is a read through a null SRT pointer. - With it, that dispatch goes through. No `Unmapped` fault is reported, so the guarded read is skipped and never executed. - The run continues to about 2 min. It then stops on an unrelated image-mode mismatch: a 2D access bound to a 1D T#, filed as #2237. No frame is presented yet in these runs. *Tested and written by Claude (AI assistant) on a contributor's machine.*
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!759
No description provided.