Assassin's Creed Shadows (PPSA20397): early-boot segfault in a dead-handle clear on a task worker, after the launch packs mount #8514

Closed
opened 2026-10-20 14:28:27 +00:00 by akkadbakkad89 · 11 comments
akkadbakkad89 commented 2026-10-20 14:28:27 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T14:28:27Z.


Investigated by Devin (AI) with title-side disassembly and a ptrace-based crash catcher on Linux/WSL.

Title: Assassin's Creed Shadows (PPSA20397), Linux build under WSL2, host i7-10700, flexible memory 344 MiB.

Setup: app.elf produced by the relinker (--skip-syscall-check) from the title's own eboot.bin plus the bundled sce_module PRXs; the scene fakelib SPRXs are excluded (duplicate export NIDs after #-suffix stripping). app0/ carries only the launch-chunk files named by streaminginstall.ini (DataPS5_boot*.forge, shared_00*, WhiteRoom*, AnimusRoom, fonts, localization) — about 43 GB, not the full 316 GB image.

What happens: the title boots through sceNpAppLauncherInitialize (requires #8355 — with main's stub the run aborts there), reads streaminginstall.ini and localization.lang, opens DataPS5_shared_00, DataPS5_boot.forge (32.7 GB), boot_agc, boot_sound — all cleanly — then spawns ~30 worker threads and segfaults deterministically at ~1.1 s. Zero NotImplemented calls in the log; no failed opens except /app0/savecontent/save_data.png (ENOENT — the file does not exist in the package at all, so that is the intended path).

Crash forensics (ptrace catcher; no gdb on this host):

  • rip = relinked eboot file offset 0x4a12b: movl $0,(%rax) with rax = 0xdead000000000005.
  • 0xdead000000000000|slot is Anvil's own dead-handle sentinel — it appears 10+ times as an immediate in the original eboot, so this is a guest-side poisoned table entry, not an unbound import (all 5,927 registry imports resolved).
  • Call chain: a command-stream dispatcher at file 0x4bf50 (reads u32 entries via a cursor at rdi+0x20, end at +0x28) calls a handle-table helper at 0x49a50 which decodes the index (&0x3fff, 16K slots), loads the slot's object pointer and clears its first field — the slot held the sentinel instead of a live object.
  • The faulting thread is one of the generic task workers (worker body at file 0x5246840: scePthreadMutexTrylock on the queue object → scePthreadAttrGetstack writes stack bounds into the task → task state = 3 → scePthreadCondBroadcast → scePthreadMutexUnlock).

Reading: the engine executes a job that walks a handle table and touches a slot that was never populated (or already torn down) — i.e. an engine-side ordering/initialisation assumption breaks under us, rather than a missing API surface. scePthreadAttrGet/Getstack succeed and fill real values, so the worker's own housekeeping is sound.

Files the log shows opened before the crash (order, all OK): streaminginstall.ini, localization/PS5-EU/localization.lang ×2, DataPS5_shared_00.forge, DataPS5_shared_00_agc.forge, DataPS5_boot.forge, savecontent/save_data.png (ENOENT), DataPS5_boot_agc.forge, DataPS5_boot_sound.forge.

Build: main plus #8355 (sceNpAppLauncherInitialize/Terminate lifecycle); the earlier audit-fed PRs (#8352 libc, #8290 psml) are not strictly needed to reach this crash but are in the image.

Next step (not done): identify which subsystem's init was expected to fill that handle slot — the dispatcher's rdi object is a fixed global in the image's RW segment, so its writer should name the owning subsystem. The Japan world packs (DataPS5_Japan*.forge, ~25 GB) are intentionally absent and only load after this point, so they cannot be the trigger.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5943489544 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-20T14:28:27Z. --- > Investigated by Devin (AI) with title-side disassembly and a ptrace-based crash catcher on Linux/WSL. **Title:** Assassin's Creed Shadows (PPSA20397), Linux build under WSL2, host i7-10700, flexible memory 344 MiB. **Setup:** `app.elf` produced by the relinker (`--skip-syscall-check`) from the title's own `eboot.bin` plus the bundled `sce_module` PRXs; the scene `fakelib` SPRXs are excluded (duplicate export NIDs after `#`-suffix stripping). `app0/` carries only the launch-chunk files named by `streaminginstall.ini` (`DataPS5_boot*.forge`, `shared_00*`, `WhiteRoom*`, `AnimusRoom`, fonts, localization) — about 43 GB, not the full 316 GB image. **What happens:** the title boots through `sceNpAppLauncherInitialize` (requires #8355 — with `main`'s stub the run aborts there), reads `streaminginstall.ini` and `localization.lang`, opens `DataPS5_shared_00`, `DataPS5_boot.forge` (32.7 GB), `boot_agc`, `boot_sound` — all cleanly — then spawns ~30 worker threads and **segfaults deterministically at ~1.1 s**. Zero `NotImplemented` calls in the log; no failed opens except `/app0/savecontent/save_data.png` (ENOENT — the file does not exist in the package at all, so that is the intended path). **Crash forensics** (ptrace catcher; no gdb on this host): - `rip` = relinked eboot file offset `0x4a12b`: `movl $0,(%rax)` with `rax = 0xdead000000000005`. - `0xdead000000000000|slot` is **Anvil's own dead-handle sentinel** — it appears 10+ times as an immediate in the original eboot, so this is a guest-side poisoned table entry, not an unbound import (all 5,927 registry imports resolved). - Call chain: a command-stream dispatcher at file `0x4bf50` (reads u32 entries via a cursor at `rdi+0x20`, end at `+0x28`) calls a handle-table helper at `0x49a50` which decodes the index (`&0x3fff`, 16K slots), loads the slot's object pointer and clears its first field — the slot held the sentinel instead of a live object. - The faulting thread is one of the generic task workers (worker body at file `0x5246840`: `scePthreadMutexTrylock` on the queue object → `scePthreadAttrGetstack` writes stack bounds into the task → task state = 3 → `scePthreadCondBroadcast` → `scePthreadMutexUnlock`). **Reading:** the engine executes a job that walks a handle table and touches a slot that was never populated (or already torn down) — i.e. an engine-side ordering/initialisation assumption breaks under us, rather than a missing API surface. `scePthreadAttrGet`/`Getstack` succeed and fill real values, so the worker's own housekeeping is sound. **Files the log shows opened before the crash** (order, all OK): `streaminginstall.ini`, `localization/PS5-EU/localization.lang` ×2, `DataPS5_shared_00.forge`, `DataPS5_shared_00_agc.forge`, `DataPS5_boot.forge`, `savecontent/save_data.png` (ENOENT), `DataPS5_boot_agc.forge`, `DataPS5_boot_sound.forge`. **Build:** `main` plus #8355 (`sceNpAppLauncherInitialize`/`Terminate` lifecycle); the earlier audit-fed PRs (#8352 libc, #8290 psml) are not strictly needed to reach this crash but are in the image. **Next step (not done):** identify which subsystem's init was expected to fill that handle slot — the dispatcher's `rdi` object is a fixed global in the image's RW segment, so its writer should name the owning subsystem. The Japan world packs (`DataPS5_Japan*.forge`, ~25 GB) are intentionally absent and only load after this point, so they cannot be the trigger.
akkadbakkad89 commented 2026-10-20 15:41:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T15:41:30Z.


Follow-up: chased the thread-entry mapping and the faulting function's identity.

Full call chain (relinker preserves file offsets 1:1, so these are guest file offsets):

  1. Worker body 0x5246840 — confirmed generic task-queue worker: scePthreadMutexTrylock on the queue → scePthreadAttrGetstack writes the thread's stack bounds into the task (+0x20) → task state = 3 → scePthreadCondBroadcast → scePthreadMutexUnlock → executes *(task+0x38)->vtable. All calls are plain libkernel pthread ops.
  2. Job Execute trampoline 0x64e08c0 (vtable'd job class; vtable is runtime-built so no RTTI available) calls 0x16e5740.
  3. 0x16e5740 — a large table-driven decoder: bextr bitfield extraction → *(table+idx*8) lookups → 0xff sentinel compares → bounded-array asserts ("Too many elements for %sArray. Size: %u, Max Size: %u").
  4. Dispatcher 0x4bf50 — walks a u32 stream (cursor at obj+0x20, end at +0x28), calls the handler per element.
  5. Handler 0x49a50 — schema-driven attribute deserializer: loads a const descriptor blob at 0x9e22000, performs virtual calls (*0x20(rax), *0x90(rax)), logs via a telemetry error call passing token ON_ATTRIBUTEVALUE_COULD_NOT_BE_PARSED plus an event-schema JSON fragment ("type":"CONTEXT_STOP","typeAttributes":[...]), decodes the slot index with &0x3fff (16K slots), and writes *slot = 0 at 0x4a12b — the slot held 0xdead000000000005.

Code-region identification: the surrounding .rodata is Havok serialization + Anvil (scimitar::) internals — hkSerialize::Note::Import, Patches::V201620r1::Collide / V201820r1::Physics / V201920r1::Constraint, Patches::Current:Common, <Invalid PatchInfo>, hkcdDynamicTree, hknpConstraintData, hknpRagdollMotorConstraintAtom, enableDynamicBodyCollisions, OODLE ERROR : LZ corruption, plus PSR-SDK BVH paths (psr_cpu_interface_bottom_level_bvh_refit.cpp). So the crash sits inside the engine's serialized-data / attribute patch layer, on a worker, ~1.1 s after the launch packs mount.

The dead-slot object (rdi = guest vaddr 0x881f09c) is a static const descriptor table in the image's R segment. No direct rip-relative references to it exist in the exec segment — it is reached through a container pointer, so the owning subsystem is still unnamed. Its entries are pointer-pairs into LOAD3 (0xb3a5ec-range) — consistent with a compiled schema/attribute registry.

Read: during world/boot deserialization a worker job iterates an attribute table whose slot was never populated (or was released by a job that ran too early). That is an engine-side ordering/empty-state assumption, not an API gap — matches the zero-NotImplemented, zero-failed-open log.

In progress: will rerun and compare fault RIP/registers. If the crash moves, the newly loaded content narrows the owning subsystem.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6294818410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6294818410). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-20T15:41:30Z. --- > Follow-up: chased the thread-entry mapping and the faulting function's identity. **Full call chain** (relinker preserves file offsets 1:1, so these are guest file offsets): 1. Worker body `0x5246840` — confirmed generic task-queue worker: `scePthreadMutexTrylock` on the queue → `scePthreadAttrGetstack` writes the thread's stack bounds into the task (`+0x20`) → task state = 3 → `scePthreadCondBroadcast` → `scePthreadMutexUnlock` → executes `*(task+0x38)->vtable`. All calls are plain libkernel pthread ops. 2. Job Execute trampoline `0x64e08c0` (vtable'd job class; vtable is runtime-built so no RTTI available) calls `0x16e5740`. 3. `0x16e5740` — a large table-driven decoder: `bextr` bitfield extraction → `*(table+idx*8)` lookups → `0xff` sentinel compares → bounded-array asserts (`"Too many elements for %sArray. Size: %u, Max Size: %u"`). 4. Dispatcher `0x4bf50` — walks a u32 stream (cursor at `obj+0x20`, end at `+0x28`), calls the handler per element. 5. Handler `0x49a50` — **schema-driven attribute deserializer**: loads a const descriptor blob at `0x9e22000`, performs virtual calls (`*0x20(rax)`, `*0x90(rax)`), logs via a telemetry error call passing token `ON_ATTRIBUTEVALUE_COULD_NOT_BE_PARSED` plus an event-schema JSON fragment (`"type":"CONTEXT_STOP","typeAttributes":[...]`), decodes the slot index with `&0x3fff` (16K slots), and writes `*slot = 0` at `0x4a12b` — the slot held `0xdead000000000005`. **Code-region identification:** the surrounding `.rodata` is Havok serialization + Anvil (`scimitar::`) internals — `hkSerialize::Note::Import`, `Patches::V201620r1::Collide` / `V201820r1::Physics` / `V201920r1::Constraint`, `Patches::Current:Common`, `<Invalid PatchInfo>`, `hkcdDynamicTree`, `hknpConstraintData`, `hknpRagdollMotorConstraintAtom`, `enableDynamicBodyCollisions`, `OODLE ERROR : LZ corruption`, plus PSR-SDK BVH paths (`psr_cpu_interface_bottom_level_bvh_refit.cpp`). So the crash sits inside the engine's serialized-data / attribute patch layer, on a worker, ~1.1 s after the launch packs mount. **The dead-slot object** (`rdi` = guest vaddr `0x881f09c`) is a static const descriptor table in the image's R segment. No direct rip-relative references to it exist in the exec segment — it is reached through a container pointer, so the owning subsystem is still unnamed. Its entries are pointer-pairs into LOAD3 (`0xb3a5ec`-range) — consistent with a compiled schema/attribute registry. **Read:** during world/boot deserialization a worker job iterates an attribute table whose slot was never populated (or was released by a job that ran too early). That is an engine-side ordering/empty-state assumption, not an API gap — matches the zero-`NotImplemented`, zero-failed-open log. **In progress:** will rerun and compare fault RIP/registers. If the crash moves, the newly loaded content narrows the owning subsystem.
akkadbakkad89 commented 2026-10-20 17:56:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T17:56:03Z.


Follow-up: full 295 GB image run — the dead-handle crash was a missing-content artifact; the real frontier is documented barycentric-emulation debt.

Setup delta: complete app0/ extracted (all 10 forge packs verified scimitar magic + sizes), relinked with --to-intel (see below), title-deferred modules (libaegir_f, libmemorywrapper_f) emitted to app0/ root via --module-dir . instead of sce_module/.

1. The dead-handle crash does not reproduce. With the full image the run went ~38 s with zero segfaults and zero NotImplemented — Vulkan device up (llvmpipe), swapchain 1152x648, 73 trophies parsed, UDS/savedata activity, /download0/aegir/networkcache.db created, /temp0/cache/online/* populated. The schema-deserializer dead slot was populated by pack content absent from the 43 GB launch set. It was never an engine bug or an API gap — a content-enumeration artifact of the minimal set.

2. Next failure: SIGILL at file offset 0x3965190, instruction f2 0f 78 c8 20 18 = insertq $0x18,$0x20,%xmm0,%xmm1 (AMD SSE4a). Legal on PS5 Zen-2, illegal on the host i7-10700 (lacks SHA, CLWB, RDPID, SSE4A, CLZERO). The eboot contains 13 SSE4a sites (11 insertq imm + 1 insertq reg-form + 1 extrq); libaegir_f.prx carries 20 more (4 insertq, 16 extrq). The relinker existing --to-intel flag converts them — this run simply had not used it. Rebuilt with --to-intel: all immediate forms converted; the one register-form insertq is already handled by the lowering path.

3. Module-layout requirement found the hard way: libaegir_f/libmemorywrapper_f as sce_module members become DT_NEEDED and init eagerly — before the guest heap exists — so the aegir ctor allocator returns NULL (mov %rax,(%rax), rax=0, aegir file 0x7d600). With --module-dir . they stay title-deferred (dlopen) and init correctly. Repro note for anyone rebuilding: --to-intel --module-dir . with system PRXs in sce_module/.

4. With correct relink: ~14 min of live execution (llvmpipe, software rasterisation — extremely slow; >10 GB RSS) through mass shader registration. No NotImplemented, no segfault. Repeated shader library prebuild skipped: image table snapshot disagrees with the static tables is benign (caught, continues).

5. Terminal failure is a clean throw, not a crash (SIGABRT via a recompiler Require):
shader 0x40731f5200 stage 7: ShaderRecompiler::Recompile: barycentric emulation on the mesh path needs 36864 bytes of mesh output memory, the device allows 32768.

The guest pixel shader needs emulated barycentrics (llvmpipe has no VK_KHR_fragment_shader_barycentric), and on the mesh path the emulation inflates mesh output to 36 KB vs the Vulkan spec-minimum 32 KB. Checked vulkaninfo on every host GPU — llvmpipe, RTX 3070, Intel UHD 630 all report maxMeshOutputMemorySize = 32768, so this wall is not llvmpipe-specific and a discrete-GPU run would hit the same bound. This matches the documented gap in docs/dev/debt/shader.md (barycentric emulation throws on mesh pipelines / interfaces beyond device limits).

Net: PPSA20397 now boots to in-engine shader compilation on the full image. No new AnyPS5 export gap was found along the way — the blockers were (a) launch-subset content, (b) host ISA missing SSE4a (solved by existing --to-intel), (c) deferred-vs-eager module layout, and (d) the documented mesh-path barycentric-emulation budget. Closing the loop on the original crash: it needs no fix; it is a repro-setup artifact.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6297528871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6297528871). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-20T17:56:03Z. --- > Follow-up: full 295 GB image run — the dead-handle crash was a missing-content artifact; the real frontier is documented barycentric-emulation debt. **Setup delta:** complete `app0/` extracted (all 10 forge packs verified `scimitar` magic + sizes), relinked with `--to-intel` (see below), title-deferred modules (`libaegir_f`, `libmemorywrapper_f`) emitted to `app0/` root via `--module-dir .` instead of `sce_module/`. **1. The dead-handle crash does not reproduce.** With the full image the run went ~38 s with zero segfaults and zero `NotImplemented` — Vulkan device up (llvmpipe), swapchain 1152x648, 73 trophies parsed, UDS/savedata activity, `/download0/aegir/networkcache.db` created, `/temp0/cache/online/*` populated. The schema-deserializer dead slot was populated by pack content absent from the 43 GB launch set. It was never an engine bug or an API gap — a content-enumeration artifact of the minimal set. **2. Next failure: SIGILL at file offset `0x3965190`, instruction `f2 0f 78 c8 20 18` = `insertq $0x18,$0x20,%xmm0,%xmm1` (AMD SSE4a).** Legal on PS5 Zen-2, illegal on the host i7-10700 (`lacks SHA, CLWB, RDPID, SSE4A, CLZERO`). The eboot contains 13 SSE4a sites (11 `insertq` imm + 1 `insertq` reg-form + 1 `extrq`); `libaegir_f.prx` carries 20 more (4 `insertq`, 16 `extrq`). The relinker existing `--to-intel` flag converts them — this run simply had not used it. Rebuilt with `--to-intel`: all immediate forms converted; the one register-form `insertq` is already handled by the lowering path. **3. Module-layout requirement found the hard way:** `libaegir_f`/`libmemorywrapper_f` as `sce_module` members become `DT_NEEDED` and init eagerly — before the guest heap exists — so the aegir ctor allocator returns NULL (`mov %rax,(%rax)`, rax=0, aegir file `0x7d600`). With `--module-dir .` they stay title-deferred (dlopen) and init correctly. Repro note for anyone rebuilding: `--to-intel --module-dir .` with system PRXs in `sce_module/`. **4. With correct relink: ~14 min of live execution** (llvmpipe, software rasterisation — extremely slow; >10 GB RSS) through mass shader registration. No `NotImplemented`, no segfault. Repeated `shader library prebuild skipped: image table snapshot disagrees with the static tables` is benign (caught, continues). **5. Terminal failure is a clean throw, not a crash** (SIGABRT via a recompiler `Require`): `shader 0x40731f5200 stage 7: ShaderRecompiler::Recompile: barycentric emulation on the mesh path needs 36864 bytes of mesh output memory, the device allows 32768`. The guest pixel shader needs emulated barycentrics (llvmpipe has no `VK_KHR_fragment_shader_barycentric`), and on the **mesh path** the emulation inflates mesh output to 36 KB vs the Vulkan spec-minimum 32 KB. Checked `vulkaninfo` on every host GPU — llvmpipe, RTX 3070, Intel UHD 630 all report `maxMeshOutputMemorySize = 32768`, so this wall is not llvmpipe-specific and a discrete-GPU run would hit the same bound. This matches the documented gap in `docs/dev/debt/shader.md` (barycentric emulation throws on mesh pipelines / interfaces beyond device limits). **Net:** PPSA20397 now boots to in-engine shader compilation on the full image. No new AnyPS5 export gap was found along the way — the blockers were (a) launch-subset content, (b) host ISA missing SSE4a (solved by existing `--to-intel`), (c) deferred-vs-eager module layout, and (d) the documented mesh-path barycentric-emulation budget. Closing the loop on the original crash: it needs no fix; it is a repro-setup artifact.
akkadbakkad89 commented 2026-10-20 18:57:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T18:57:10Z.


Follow-up: native Windows run on RTX 3070 — the barycentric wall does not exist there (correction to the previous comment), and the title rendered its welcome screen before hitting a different documented-debt wall.

Setup: relinker.exe --windows --to-intel --skip-syscall-check --module-dir ., same relink_src (eboot.bin.elf + 5 sce_module PRXs + aegir/memorywrapper deferred at app0 root). Windows libs rebuilt from the same worktree (feat/psml-mfsr-queries + pending NpGameIntent changes); MinGW runtime DLLs copied beside libs/. Driver 617.42 — the version flagged stable against the nvgpucomp64.dll crash.

Two environment findings first:

  • The Oct-16 build-win libraries were stale: libkernel.prx predated the pipe-read/stdin kevent support, so the first run aborted at kevent: EVFILT_READ on a non-socket descriptor not implemented. Rebuilding libkernel fixed it — on Windows the guest registers EVFILT_READ on a pipe, which current source supports.
  • A rebuilt libkernel.prx against older sibling libs then failed module load with error 127 (ordinal-shifted NID imports). Full-vintage rebuild of all libs resolved it. Lesson for repro: Windows libs must come from a single build — mixing vintages breaks ordinal binding.

Run timeline (all timestamps guest log):

  • +0s ELF entry; Vulkan device ready on NVIDIA GeForce RTX 3070 (driver 617.42), wave32 subgroups, mesh=1
  • +90s presentation window 1920x1080, swapchain 1100x619 — welcome/splash screen rendered and presented
  • +2s..+380s mass shader registration: 9,251 shaders recompiled, ~2 GB disk cache, zero load/write failures, zero NotImplemented
  • +380s..+960s live draw phase: PM4 packets (ACQUIRE_MEM, SET_UCONFIG_REG, WAIT_REG_MEM_64 — one 1000ms fence timeout, non-fatal, recorder recovered), texture streaming (mip detiling tiled->linear at +795s/+958s), storage-image writes, VRAM in use (~950 MiB of 7249 MiB budget), SaveStorageJournal written to /download0/save/
  • +964s fatal throw on a libSceVideoOut worker: shader 0x407335e400 stage 5: ShaderRecompiler::Recompile: stencil reference export emulation requires a proven set of at most 16 values -> abort.

Correction to my previous comment: I wrote the 3070 would hit the same mesh-output bound because maxMeshOutputMemorySize is also 32768. It did not — the 3070 supports VK_KHR_fragment_shader_barycentric natively (fragmentShaderBarycentric=true), so the pixel shader took the native path and the mesh-output emulation never engaged. All 9,251 shaders recompiled without a single barycentric throw.

New wall — also documented debt: NVIDIA lacks VK_EXT_shader_stencil_export, so libSceAgcDriver takes the stencil-reference export replay/emulation path, which docs/dev/debt/libSceAgcDriver.md (Stencil reference export replay) caps at 16 proven values from constant/select/phi exports. Shader 0x407335e400 (stage 5, fragment) exports a stencil reference the prover cannot bound to <=16 values -> Require throws -> abort. Same wall is expected on any NVIDIA device; AMD/Intel/lavapipe expose the extension natively.

Net for PPSA20397: on capable hardware the title boots, renders the welcome screen, streams textures and writes save journals — the frontier is the stencil-export prover's 16-value cap in the AGC driver, not missing APIs. The run needed (a) current-vintage Windows libs, (b) --to-intel, (c) deferred aegir/memorywrapper layout — all reproducible from this issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6298755987 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6298755987). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-20T18:57:10Z. --- > Follow-up: native Windows run on RTX 3070 — the barycentric wall does not exist there (correction to the previous comment), and the title rendered its welcome screen before hitting a different documented-debt wall. **Setup:** `relinker.exe --windows --to-intel --skip-syscall-check --module-dir .`, same `relink_src` (eboot.bin.elf + 5 sce_module PRXs + aegir/memorywrapper deferred at app0 root). Windows libs rebuilt from the same worktree (`feat/psml-mfsr-queries` + pending NpGameIntent changes); MinGW runtime DLLs copied beside `libs/`. Driver 617.42 — the version flagged stable against the `nvgpucomp64.dll` crash. **Two environment findings first:** - The Oct-16 `build-win` libraries were stale: `libkernel.prx` predated the pipe-read/stdin kevent support, so the first run aborted at `kevent: EVFILT_READ on a non-socket descriptor not implemented`. Rebuilding libkernel fixed it — on Windows the guest registers EVFILT_READ on a pipe, which current source supports. - A rebuilt `libkernel.prx` against older sibling libs then failed module load with error 127 (ordinal-shifted NID imports). Full-vintage rebuild of all libs resolved it. Lesson for repro: **Windows libs must come from a single build** — mixing vintages breaks ordinal binding. **Run timeline (all timestamps guest log):** - +0s ELF entry; Vulkan device ready on `NVIDIA GeForce RTX 3070` (driver 617.42), wave32 subgroups, mesh=1 - +90s presentation window 1920x1080, swapchain 1100x619 — **welcome/splash screen rendered and presented** - +2s..+380s mass shader registration: **9,251 shaders recompiled**, ~2 GB disk cache, zero load/write failures, **zero `NotImplemented`** - +380s..+960s live draw phase: PM4 packets (`ACQUIRE_MEM`, `SET_UCONFIG_REG`, `WAIT_REG_MEM_64` — one 1000ms fence timeout, non-fatal, recorder recovered), texture streaming (mip detiling `tiled->linear` at +795s/+958s), storage-image writes, VRAM in use (~950 MiB of 7249 MiB budget), `SaveStorageJournal` written to `/download0/save/` - +964s **fatal throw on a libSceVideoOut worker**: `shader 0x407335e400 stage 5: ShaderRecompiler::Recompile: stencil reference export emulation requires a proven set of at most 16 values` -> abort. **Correction to my previous comment:** I wrote the 3070 would hit the same mesh-output bound because `maxMeshOutputMemorySize` is also 32768. It did **not** — the 3070 supports `VK_KHR_fragment_shader_barycentric` natively (`fragmentShaderBarycentric=true`), so the pixel shader took the native path and the mesh-output emulation never engaged. All 9,251 shaders recompiled without a single barycentric throw. **New wall — also documented debt:** NVIDIA lacks `VK_EXT_shader_stencil_export`, so `libSceAgcDriver` takes the stencil-reference export **replay/emulation** path, which `docs/dev/debt/libSceAgcDriver.md` (Stencil reference export replay) caps at 16 proven values from constant/select/phi exports. Shader `0x407335e400` (stage 5, fragment) exports a stencil reference the prover cannot bound to <=16 values -> `Require` throws -> abort. Same wall is expected on any NVIDIA device; AMD/Intel/lavapipe expose the extension natively. **Net for PPSA20397:** on capable hardware the title boots, renders the welcome screen, streams textures and writes save journals — the frontier is the stencil-export prover's 16-value cap in the AGC driver, not missing APIs. The run needed (a) current-vintage Windows libs, (b) `--to-intel`, (c) deferred aegir/memorywrapper layout — all reproducible from this issue.
MarcZX10 commented 2026-10-20 19:15:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T19:15:30Z.


I checked the current upstream/main stencil replay path (StencilReplay.cpp): Values() stops proving a set once it exceeds 16 values, but StencilReferenceValues() then returns all 256 byte values, and Draw.cpp explicitly supports that replay path. I could not find the reported “requires a proven set of at most 16 values” error in current main; the related current-main failure for an unsupported device is the replay-safety check. This makes the reported 16-value wall look tied to the extra, unsubmitted replay-proof change mentioned in the issue. Could you record the exact commit used for the Windows run (and whether it includes that change), plus the shader/export expression that fails? That will distinguish a current-main gap from a limitation in the local experiment before anyone starts a patch.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6299157102 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6299157102). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T19:15:30Z. --- I checked the current `upstream/main` stencil replay path (`StencilReplay.cpp`): `Values()` stops proving a set once it exceeds 16 values, but `StencilReferenceValues()` then returns all 256 byte values, and `Draw.cpp` explicitly supports that replay path. I could not find the reported “requires a proven set of at most 16 values” error in current `main`; the related current-main failure for an unsupported device is the replay-safety check. This makes the reported 16-value wall look tied to the extra, unsubmitted replay-proof change mentioned in the issue. Could you record the exact commit used for the Windows run (and whether it includes that change), plus the shader/export expression that fails? That will distinguish a current-main gap from a limitation in the local experiment before anyone starts a patch.
akkadbakkad89 commented 2026-10-20 19:44:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T19:44:47Z.


Windows-run details, answering the request above.

Commit / provenance. The run was built from worktree HEAD 127e8ad06 (branch feat/psml-mfsr-queries); the libSceAgcDriver sources in it sit on the Oct-16 base d9b696ddb (merge of #6902). That base predates 7563b4a48 (#6762, op-val export) and f4a4b8aea (#7006, 256-value replay), so it still had the old unbounded-set -> empty -> "at most 16 values" path. No extra unsubmitted replay change — just an older checkout plus throwaway debug instrumentation.

Shader / export expression. Decoded the RecompileRequest: stage 5 fragment, 624 code words at 0x407335e400. The MrtZ stencil export resolves to SelectU32(kept_lane_mask, ImageRead(...).y, const) — a texture-derived per-pixel stencil ID (material/decal mask). Statically unbounded, so on current main it becomes the 256-value replay.

Draw state at the throw (instrumented materializeDrawStage):

  • samples=4 (4xMSAA)
  • front+back: fail/pass/dfail all REPLACE, compare ALWAYS, cmpMask = wMask = 0xff, ref = 0
  • depth test + write on, depth compare ALWAYS

Semantically an unconditional stencil-ID splat: stencil[pixel] = imageRead.y & 0xff; the compare never gates.

Where it stops on current main (ran the request through the pipeline locally with the safety check instrumented):

  • StencilReferenceValues -> unbounded -> all 256 (the old gate is gone)
  • StencilReplaySafe -> fails inside MaskReplaySafety::Check at maskStable() on an own-mask writer — the shader's Ballot/WqmU64 helper-lane bookkeeping → throws "stencil replay refuses stages with side effects, clocks, subgroup dependencies or primitive ID inputs"
  • Even if safety passed, samples=4 trips "stencil replay requires single-sample rendering"

So the title's true frontier on main is the replay-safety analysis plus the MSAA gate — not the prover. The draw writes stencil unconditionally per pixel from a texture fetch; a 256-pass replay would also cost 256x4 MSAA fragments per triangle.

Full run log: ~16 min, 9,251 shaders recompiled, zero NotImplemented, welcome screen rendered, save journals written — abort only at this stencil draw.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6299868572 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6299868572). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-20T19:44:47Z. --- Windows-run details, answering the request above. **Commit / provenance.** The run was built from worktree HEAD `127e8ad06` (branch `feat/psml-mfsr-queries`); the `libSceAgcDriver` sources in it sit on the Oct-16 base `d9b696ddb` (merge of #6902). That base predates `7563b4a48` (#6762, op-val export) and `f4a4b8aea` (#7006, 256-value replay), so it still had the old unbounded-set -> empty -> "at most 16 values" path. No extra unsubmitted replay change — just an older checkout plus throwaway debug instrumentation. **Shader / export expression.** Decoded the `RecompileRequest`: stage 5 fragment, 624 code words at `0x407335e400`. The `MrtZ` stencil export resolves to `SelectU32(kept_lane_mask, ImageRead(...).y, const)` — a texture-derived per-pixel stencil ID (material/decal mask). Statically unbounded, so on current main it becomes the 256-value replay. **Draw state at the throw** (instrumented `materializeDrawStage`): - `samples=4` (4xMSAA) - front+back: fail/pass/dfail all `REPLACE`, compare `ALWAYS`, `cmpMask = wMask = 0xff`, `ref = 0` - depth test + write on, depth compare `ALWAYS` Semantically an unconditional stencil-ID splat: `stencil[pixel] = imageRead.y & 0xff`; the compare never gates. **Where it stops on current main** (ran the request through the pipeline locally with the safety check instrumented): - `StencilReferenceValues` -> unbounded -> all 256 (the old gate is gone) - `StencilReplaySafe` -> fails inside `MaskReplaySafety::Check` at `maskStable()` on an own-mask writer — the shader's `Ballot`/`WqmU64` helper-lane bookkeeping → throws "stencil replay refuses stages with side effects, clocks, subgroup dependencies or primitive ID inputs" - Even if safety passed, `samples=4` trips "stencil replay requires single-sample rendering" So the title's true frontier on main is the replay-safety analysis plus the MSAA gate — not the prover. The draw writes stencil unconditionally per pixel from a texture fetch; a 256-pass replay would also cost 256x4 MSAA fragments per triangle. Full run log: ~16 min, 9,251 shaders recompiled, zero `NotImplemented`, welcome screen rendered, save journals written — abort only at this stencil draw.
akkadbakkad89 commented 2026-10-20 20:37:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T20:37:59Z.


Verified on hardware — rebased the same worktree onto current main (picks up 7563b4a48 + f4a4b8aea), rebuilt all Windows libs one vintage, reran.

The title now dies at the replay-safety gate, not the prover:

shader 0x407325e400 stage 5: ShaderRecompiler::Recompile:
stencil reference export emulation requires a replay-safe pixel shader with late tests
[videoout] presentation failed

Same class of presentation draw as before (fragment, texture-derived stencil export, VideoOut worker), ~728s in this time — the cold shader recompile ate the difference (new recompiler hash invalidated the disk cache: ~8,900 shaders rebuilt). So confirmed: the unbounded-export path reaches 256-value replay, and the next barrier is stencilReplaySafe/maskStable on the shader's Ballot/WqmU64 helper-lane bookkeeping, with the 4xMSAA samples == 1 gate behind it.

Unrelated build note while I was here: main currently does not build Windows tests under MinGW — tests/execution/ImageArrayWindowPastLayerLimit.cpp (from ed599f525b) uses alignas(65536) which exceeds the COFF object-file max of 8192. Libs are unaffected; only that test target fails.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300949173 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6300949173). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-20T20:37:59Z. --- Verified on hardware — rebased the same worktree onto current `main` (picks up `7563b4a48` + `f4a4b8aea`), rebuilt all Windows libs one vintage, reran. The title now dies at the replay-safety gate, not the prover: ``` shader 0x407325e400 stage 5: ShaderRecompiler::Recompile: stencil reference export emulation requires a replay-safe pixel shader with late tests [videoout] presentation failed ``` Same class of presentation draw as before (fragment, texture-derived stencil export, VideoOut worker), ~728s in this time — the cold shader recompile ate the difference (new recompiler hash invalidated the disk cache: ~8,900 shaders rebuilt). So confirmed: the unbounded-export path reaches 256-value replay, and the next barrier is `stencilReplaySafe`/`maskStable` on the shader's `Ballot`/`WqmU64` helper-lane bookkeeping, with the 4xMSAA `samples == 1` gate behind it. Unrelated build note while I was here: `main` currently does not build Windows tests under MinGW — `tests/execution/ImageArrayWindowPastLayerLimit.cpp` (from `ed599f525b`) uses `alignas(65536)` which exceeds the COFF object-file max of 8192. Libs are unaffected; only that test target fails.
akkadbakkad89 commented 2026-10-20 20:45:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-20T20:45:00Z.


Closing as resolved — the reported crash was a launch-subset content artifact, not a runtime bug.

The dead-handle clear never reproduces once app0/ carries the complete image: the slot the task worker cleared is populated by a forge pack absent from the ~43 GB launch set this report was captured on. With all packs mounted, the title runs minutes past the 1.1 s crash point — on Windows/RTX 3070 it presents real boot cinematics (~25 FPS, 9,000+ shaders, save journaling) before stopping at an unrelated stencil-replay emulation gate.

Two genuine gaps this report did surface are fixed upstream or in flight:

  • sceNpAppLauncherInitialize lifecycle — #8355
  • non-SSE4a host ISA (insertq/extrq) — the relinker's existing --to-intel covers it; usage recorded in the thread below

Bring-up continues in the game thread: https://github.com/boykopovar/AnyPS5/discussions/8674 — current frontier is the stencil replay-safety/MSAA emulation described in the comments above.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6301083223 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6301083223). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-20T20:45:00Z. --- Closing as resolved — the reported crash was a launch-subset content artifact, not a runtime bug. The dead-handle clear never reproduces once `app0/` carries the complete image: the slot the task worker cleared is populated by a forge pack absent from the ~43 GB launch set this report was captured on. With all packs mounted, the title runs minutes past the 1.1 s crash point — on Windows/RTX 3070 it presents real boot cinematics (~25 FPS, 9,000+ shaders, save journaling) before stopping at an unrelated stencil-replay emulation gate. Two genuine gaps this report did surface are fixed upstream or in flight: - `sceNpAppLauncherInitialize` lifecycle — #8355 - non-SSE4a host ISA (`insertq`/`extrq`) — the relinker's existing `--to-intel` covers it; usage recorded in the thread below Bring-up continues in the game thread: https://github.com/boykopovar/AnyPS5/discussions/8674 — current frontier is the stencil replay-safety/MSAA emulation described in the comments above.
MarcZX10 commented 2026-10-20 20:45:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T20:45:19Z.


Thanks for the full-image and current-main reruns. This confirms the original dead-handle crash was caused by the incomplete launch content and does not reproduce with the full image. The later current-main stop is a separate stencil-export replay-safety/MSAA limitation in documented debt. It may be clearer to close this crash report and track that renderer limitation in its own issue, preserving the exact current-main reproduction and draw state there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6301089488 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6301089488). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T20:45:19Z. --- Thanks for the full-image and current-main reruns. This confirms the original dead-handle crash was caused by the incomplete launch content and does not reproduce with the full image. The later current-main stop is a separate stencil-export replay-safety/MSAA limitation in documented debt. It may be clearer to close this crash report and track that renderer limitation in its own issue, preserving the exact current-main reproduction and draw state there.
akkadbakkad89 commented 2026-10-21 14:47:10 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-21T14:47:10Z.


Runtime datapoint on the stencil-replay gate (Windows, RTX 3070 — no VK_EXT_shader_stencil_export):

Tested a stack of current main (27bcd6a2) + #9017 (a7f50e9d) + #9030 (393a8e8c). Those two changes do help — the title now gets much further than before: Vulkan device and swapchain come up, trophy UDS parsing runs, save mounts succeed, and ~2,300 shaders compile to the disk cache.

But it still aborts on the same class of gate, on a different shader:

shader 0x407325e400 stage 5: ShaderRecompiler::Recompile: stencil reference export emulation requires a replay-safe pixel shader with late tests
FATAL: abort() (SIGABRT)

(The earlier reported shader was 0x407335e400 — that one now gets through; the next stencil-ref writer trips the check instead.)

So #9017+#9030 are necessary progress but not sufficient for this title — 0x407325e400 fails StencilReplaySafe in a way those two don't cover yet. I can dig into that shader's ref provenance next if useful.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6318910214 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6318910214). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-21T14:47:10Z. --- Runtime datapoint on the stencil-replay gate (Windows, RTX 3070 — no VK_EXT_shader_stencil_export): Tested a stack of current main (`27bcd6a2`) + #9017 (`a7f50e9d`) + #9030 (`393a8e8c`). Those two changes do help — the title now gets much further than before: Vulkan device and swapchain come up, trophy UDS parsing runs, save mounts succeed, and ~2,300 shaders compile to the disk cache. But it still aborts on the same class of gate, on a different shader: ``` shader 0x407325e400 stage 5: ShaderRecompiler::Recompile: stencil reference export emulation requires a replay-safe pixel shader with late tests FATAL: abort() (SIGABRT) ``` (The earlier reported shader was `0x407335e400` — that one now gets through; the next stencil-ref writer trips the check instead.) So #9017+#9030 are necessary progress but not sufficient for this title — `0x407325e400` fails `StencilReplaySafe` in a way those two don't cover yet. I can dig into that shader's ref provenance next if useful.
akkadbakkad89 commented 2026-10-21 16:58:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-21T16:58:07Z.


Root-cause update on shader 0x407325e400 (the stencil-exporting pixel shader that still aborts after #9017 + #9030): I captured its live RecompileRequest and replayed it deterministically with agc_shader_replay --materialize, instrumenting MaskReplaySafety to log each gate. The shader fails four distinct verifier checks in sequence — each peeled only reveals the next:

  1. paired identity check (maskStable, helpers): the mask composes extract(wqmA, 0) (low) with extract(wqmB, 1) (high) where wqmA/wqmB are two distinct WqmU64 IR nodes — the GCN has two s_wqm_b64 ops over duplicate Ballot(exec) sources (values #2573/#2587, same block, nothing between them but WqmU64 itself). The verifier paired words by object identity (==) → paired=0. Fixed by #9266 (structural equivalence, with a no-exec-mask-mutation-between check); instrumented replay confirms paired=1 on all six mask sites.

  2. Provenance of wqm(ballot(true)): the construct's predicate is ConstantBool(true) → onHelper = 1 → the old *low==0 && *high==0 test yields Uncertain. Already covered by #9017 — its Boolean(pred, true) → QuadStable line handles exactly this; my independent implementation of the same relaxation was dropped as a duplicate.

  3. optionalBody region shape: the shader's exec guards are a nested s_cbranch_execz cascade (block_0's body is block_1, itself an execz branch — CFG dumped via --cfg). The single-block shape check fails with "terminator shape". Covered by #9030's region walk; with it stacked, verification reaches gate 4.

  4. quadObserved on a merged phi feeding a nested exec condition (the remaining blocker, no open PR covers this): merge block 10's phi #14620 merges two SelectU32s (skipped/taken), and LogicalNot(phi) (#9194) is the ExecZero condition of nested block 7. inactiveEquals proves the phi inactive-consistent, but quadObserved rejects any phi used by a lane-coupled (execz/vccz) condition. This rejection is arguably correct — the phi merges per-lane selects, and a lane-varying predicate driving exec is genuinely unsafe under quad-broadcast replay — unless the verifier can prove the merged values quad-uniform (e.g. if both sides are themselves whole-quad mask words). That needs quad-uniformity provenance through selects/phis, which is new analyzer machinery rather than another local relaxation.

Current stack for the title: main + #9017 + #9030 + #9266 clears gates 1-3; gate 4 remains and is the next real blocker for PPSA20397's stencil path. The .req fixture (11 KB) is retained locally and can be attached if useful for tests/ShaderReplayRequests.cpp.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6321669056 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6321669056). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-21T16:58:07Z. --- Root-cause update on shader `0x407325e400` (the stencil-exporting pixel shader that still aborts after #9017 + #9030): I captured its live `RecompileRequest` and replayed it deterministically with `agc_shader_replay --materialize`, instrumenting `MaskReplaySafety` to log each gate. The shader fails **four** distinct verifier checks in sequence — each peeled only reveals the next: 1. **`paired` identity check** (`maskStable`, `helpers`): the mask composes `extract(wqmA, 0)` (low) with `extract(wqmB, 1)` (high) where wqmA/wqmB are two *distinct* `WqmU64` IR nodes — the GCN has two `s_wqm_b64` ops over duplicate `Ballot(exec)` sources (values #2573/#2587, same block, nothing between them but `WqmU64` itself). The verifier paired words by object identity (`==`) → `paired=0`. **Fixed by #9266** (structural equivalence, with a no-exec-mask-mutation-between check); instrumented replay confirms `paired=1` on all six mask sites. 2. **Provenance of `wqm(ballot(true))`**: the construct's predicate is `ConstantBool(true)` → `onHelper` = 1 → the old `*low==0 && *high==0` test yields `Uncertain`. **Already covered by #9017** — its `Boolean(pred, true) → QuadStable` line handles exactly this; my independent implementation of the same relaxation was dropped as a duplicate. 3. **`optionalBody` region shape**: the shader's exec guards are a nested `s_cbranch_execz` cascade (block_0's body is block_1, itself an `execz` branch — CFG dumped via `--cfg`). The single-block shape check fails with "terminator shape". **Covered by #9030's** region walk; with it stacked, verification reaches gate 4. 4. **`quadObserved` on a merged phi feeding a nested exec condition** (the remaining blocker, no open PR covers this): merge block 10's phi #14620 merges two `SelectU32`s (`skipped`/`taken`), and `LogicalNot(phi)` (#9194) is the `ExecZero` condition of nested block 7. `inactiveEquals` proves the phi inactive-consistent, but `quadObserved` rejects any phi used by a lane-coupled (execz/vccz) condition. This rejection is arguably *correct* — the phi merges per-lane selects, and a lane-varying predicate driving exec is genuinely unsafe under quad-broadcast replay — unless the verifier can prove the merged values quad-uniform (e.g. if both sides are themselves whole-quad mask words). That needs quad-uniformity provenance through selects/phis, which is new analyzer machinery rather than another local relaxation. Current stack for the title: `main` + #9017 + #9030 + #9266 clears gates 1-3; gate 4 remains and is the next real blocker for PPSA20397's stencil path. The `.req` fixture (11 KB) is retained locally and can be attached if useful for `tests/ShaderReplayRequests.cpp`.
akkadbakkad89 commented 2026-10-21 18:16:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-21T18:16:39Z.


Follow-up on the 0x407325e400 stencil-replay chain — the fourth gate is now implemented and the shader clears the verifier end-to-end.

Rebased on current main (6b6c7016), stacked: #9017 + #9030 + #9266 + #9317.

The remaining quadObserved rejections turned out to be three over-counts of lane-local consumers, matching gap 2 of the Onimusha follow-up on #7006:

  1. Condition uses of already-proven branches — the merged phi (-> LogicalNot -> nested s_cbranch_execz) was rejected even though control() proved that branch safe. controlProven() (memoized, with a visiting set for nested cascades) now exempts condition uses whose consuming branch is proven; unproven ones still reject.
  2. Own-bit ballots — the same merged value feeds Ballot -> extract words -> & wqm halves -> SelectU32(lane<32) -> shr(lane&31) -> &1, i.e. each lane reads only its own ballot bit. A Ballot is exempted only when every use completes that exact funnel; the isolated per-lane bools keep being walked, and any other ballot use still rejects.
  3. Explicit-LOD samples — a mask-derived bool reaches ImageSampleRaw with LevelZero flags; explicit-LOD ops compute no implicit quad derivatives, so per-lane args are lane-local (same rule MaskedSelectEliminator already applies).

Also needed: optionalBody()'s region set had to become per-invocation — nested control() proofs were unioning inner and outer regions.

Validation: agc_shader_replay --prepare on the captured request now prints prepared: 96161 SPIR-V words — StencilReplaySafe accepts the shader. It then stops in SrtWalker::EvaluateRuntimeSources (descriptor source 0 dword 0 unresolved from the captured memory) — a separate runtime-materialization limitation, not the verifier. Five new agc_masked_select cases cover each exemption and the conservative rejections; the positive cases fail when the change is reverted.

Full flow for this shader: mask pairing #9266 -> EXEC-copy provenance #9017 -> multi-block optional bodies #9030 -> quad-observation accounting #9317 -> remaining: SRT descriptor evaluation at capture.

Generated with Devin

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6323247546 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/8514#issuecomment-6323247546). Originally posted by [akkadbakkad89](https://github.com/akkadbakkad89) on 2026-10-21T18:16:39Z. --- Follow-up on the `0x407325e400` stencil-replay chain — the fourth gate is now implemented and the shader clears the verifier end-to-end. **Rebased on current `main` (`6b6c7016`), stacked: #9017 + #9030 + #9266 + #9317.** The remaining `quadObserved` rejections turned out to be three over-counts of lane-local consumers, matching gap 2 of the Onimusha follow-up on #7006: 1. **Condition uses of already-proven branches** — the merged phi (`-> LogicalNot ->` nested `s_cbranch_execz`) was rejected even though `control()` proved that branch safe. `controlProven()` (memoized, with a visiting set for nested cascades) now exempts condition uses whose consuming branch is proven; unproven ones still reject. 2. **Own-bit ballots** — the same merged value feeds `Ballot -> extract words -> & wqm halves -> SelectU32(lane<32) -> shr(lane&31) -> &1`, i.e. each lane reads only its own ballot bit. A `Ballot` is exempted only when every use completes that exact funnel; the isolated per-lane bools keep being walked, and any other ballot use still rejects. 3. **Explicit-LOD samples** — a mask-derived bool reaches `ImageSampleRaw` with `LevelZero` flags; explicit-LOD ops compute no implicit quad derivatives, so per-lane args are lane-local (same rule `MaskedSelectEliminator` already applies). Also needed: `optionalBody()`'s region set had to become per-invocation — nested `control()` proofs were unioning inner and outer regions. **Validation:** `agc_shader_replay --prepare` on the captured request now prints `prepared: 96161 SPIR-V words` — `StencilReplaySafe` accepts the shader. It then stops in `SrtWalker::EvaluateRuntimeSources` (`descriptor source 0 dword 0` unresolved from the captured memory) — a separate runtime-materialization limitation, not the verifier. Five new `agc_masked_select` cases cover each exemption and the conservative rejections; the positive cases fail when the change is reverted. Full flow for this shader: mask pairing #9266 -> EXEC-copy provenance #9017 -> multi-block optional bodies #9030 -> quad-observation accounting #9317 -> remaining: SRT descriptor evaluation at capture. Generated with [Devin](https://devin.ai)
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#8514
No description provided.