fix(shader): keep faulting invocations in their wave and mask their later writes #6416

Merged
Celegans12 merged 3 commits from upstream-pr/6416 into main 2026-11-18 23:44:32 +00:00
Celegans12 commented 2026-10-15 14:31:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-15T14:31:05Z.


What

Stopping a faulting invocation can leave wave ballots unable to converge and stop its healthy partner lane. Eligible non-pixel programs with two lanes per invocation, ballots or shuffles now keep voting with the failed read's zero and mask that lane's later writes, atomics and exports. Existing spanned-wave, barrier and mesh exclusions remain.

Continuing exposed a guarded-SRT reporting regression: the second word of a null pointer replaced the first fault record. Adopt ThatsLeo's first-fault latch from #7922, adapted so masked lanes count as continuing. The existing guarded-pointer runtime oracle stays unchanged, and its host checks require compare-from-zero latches without unconditional overwrites. No spanned-wave policy from #7922 is included.

Masking adds work even without faults. Astro Bot's reported startup delay remains unexplained; no performance claim. The barrier-safe extension and subgroup-specific skip remain separate in #7392 and #6751.

Tested

Based on main b4a82720a8 (rebased 2026-11-13 as one commit; the only conflict was the cache format, now ShaderDiskCache::FormatVersion 90). On that tip, 61 focused host and NVIDIA tests (fault, guarded-pointer and guarded-load, faulting-wave, BDA span and anchor reads, GPU buffer format, wave decoding, shader memory and shader cache) passed three times with validation 1.4.363 loaded and no VUIDs or skips.

Earlier rounds, on main e6f57307fa: Windows 11, MinGW-w64 GCC 15.2.0: Release, -DBUILD_TESTING=ON, SPIR-V Tools ON. Before repair, main passes agc_driver_guarded_null_pointer; the merged PR fails 3/3 at address4 instead of0, PC0x24. One diagnostic run confirms the overwrite.

Repaired head 771c8bdae4: 13/13 focused processes pass: host shader-memory; NVIDIA guarded-pointer x3, faulting-wave, GPU-buffer-format, BDA-device and span-reads; the same five GPU tests once on Windows lavapipe. All GPU runs require Vulkan, disable application shader caching and load validation 1.4.363; zero skips, timeouts or validation diagnostics. Lavapipe subgroup8 does not establish paired wave64-on32 behavior. Test registration, conventions and source review pass.

Earlier baseline e2df06e661 plus the faulting-wave fixture fails on main because partner lane37 stays untouched. Not tested: current-head Linux, AMD/Intel hardware, console behavior or titles.

On the merge with main 98346b748c, the wave invocation case initially failed on the hardware-spanning wave path. The follow-up keeps those lanes active but masks writes after a fault, and guards byte loads when the lane continues. Six selected fault, guarded-load, wave-decode and cache tests passed twice on Windows with an NVIDIA RTX 3080 Laptop GPU and Vulkan validation enabled. The updated emitter, BDA read and shader-cache sources also passed Linux C++ syntax and layout-guard compilation. No Linux GPU run was performed.

Checklist

  • Based on current main; the first-fault latch from #7922 is adopted with attribution
  • 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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: PPSA26344 #675
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, driver 610.62; llvmpipe (Mesa 26.2.4); Windows 11
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4874920841 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-15T14:31:05Z. --- ### What Stopping a faulting invocation can leave wave ballots unable to converge and stop its healthy partner lane. Eligible non-pixel programs with two lanes per invocation, ballots or shuffles now keep voting with the failed read's zero and mask that lane's later writes, atomics and exports. Existing spanned-wave, barrier and mesh exclusions remain. Continuing exposed a guarded-SRT reporting regression: the second word of a null pointer replaced the first fault record. Adopt ThatsLeo's first-fault latch from #7922, adapted so masked lanes count as continuing. The existing guarded-pointer runtime oracle stays unchanged, and its host checks require compare-from-zero latches without unconditional overwrites. No spanned-wave policy from #7922 is included. Masking adds work even without faults. Astro Bot's reported startup delay remains unexplained; no performance claim. The barrier-safe extension and subgroup-specific skip remain separate in #7392 and #6751. ### Tested Based on `main` b4a82720a8 (rebased 2026-11-13 as one commit; the only conflict was the cache format, now `ShaderDiskCache::FormatVersion` 90). On that tip, 61 focused host and NVIDIA tests (fault, guarded-pointer and guarded-load, faulting-wave, BDA span and anchor reads, GPU buffer format, wave decoding, shader memory and shader cache) passed three times with validation 1.4.363 loaded and no VUIDs or skips. Earlier rounds, on `main` e6f57307fa: Windows 11, MinGW-w64 GCC 15.2.0: Release, -DBUILD_TESTING=ON, SPIR-V Tools ON. Before repair, main passes `agc_driver_guarded_null_pointer`; the merged PR fails 3/3 at address4 instead of0, PC0x24. One diagnostic run confirms the overwrite. Repaired head `771c8bdae4`: 13/13 focused processes pass: host shader-memory; NVIDIA guarded-pointer x3, faulting-wave, GPU-buffer-format, BDA-device and span-reads; the same five GPU tests once on Windows lavapipe. All GPU runs require Vulkan, disable application shader caching and load validation 1.4.363; zero skips, timeouts or validation diagnostics. Lavapipe subgroup8 does not establish paired wave64-on32 behavior. Test registration, conventions and source review pass. Earlier baseline `e2df06e661` plus the faulting-wave fixture fails on main because partner lane37 stays untouched. Not tested: current-head Linux, AMD/Intel hardware, console behavior or titles. On the merge with main `98346b748c`, the wave invocation case initially failed on the hardware-spanning wave path. The follow-up keeps those lanes active but masks writes after a fault, and guards byte loads when the lane continues. Six selected fault, guarded-load, wave-decode and cache tests passed twice on Windows with an NVIDIA RTX 3080 Laptop GPU and Vulkan validation enabled. The updated emitter, BDA read and shader-cache sources also passed Linux C++ syntax and layout-guard compilation. No Linux GPU run was performed. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; the first-fault latch from #7922 is adopted with attribution - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: PPSA26344 #675 - [x] GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, driver 610.62; llvmpipe (Mesa 26.2.4); Windows 11 - [x] AI-assisted: yes
Pipodi commented 2026-10-15 17:36:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Pipodi on 2026-10-15T17:36:18Z.


@Celegans12 a data point from Ghost of Yōtei (PPSA26344): RTX 4090, driver 617.42, Windows 11. This PR on main 0dab493f5 + #5815 #5781 #6227 #5405 #6402 #6174, with APS5_SPANNED_WAVE=1 (#5405) and a cold shader cache (our run163).

In our base, this PR conflicted in SpirvEmitter.cpp with a local change that kept spanned programs out of the BDA stop. I took this PR's version and counted spannedWave as a wave operation (waveOperations = ... || state.spannedWave), so spanned programs take the write-masking path.

It still loses the device, at ~1,460 s (frame ~817):

  • nvlddmkm event 153, a TDR (TdrDelay 10 s);
  • vkQueueSubmit recorder: Vulkan result -4;
  • 42 device faults with an unknown instruction pointer at 0x309250c60-0x3092511c0.

That's the same signature as our earlier spanned runs without this PR.

The non-spanned build of 0x80001e5f00 (839,036 words) dispatched fine. The spanned pipeline (838,306 words) was created about 5 minutes before the loss, but the log has no dispatch line for it. After it came several minutes of cold compiles of new 0x801d* programs, and the loss hit while 0x801d29eb00 was being created. So I can't tell whether that program or another spanned one hung. With spanned waves off, the same base runs well past that point.

If you have a suspect, I can rerun with more logging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6198345889 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6198345889). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-10-15T17:36:18Z. --- @Celegans12 a data point from Ghost of Yōtei (PPSA26344): RTX 4090, driver 617.42, Windows 11. This PR on main 0dab493f5 + #5815 #5781 #6227 #5405 #6402 #6174, with `APS5_SPANNED_WAVE=1` (#5405) and a cold shader cache (our run163). In our base, this PR conflicted in `SpirvEmitter.cpp` with a local change that kept spanned programs out of the BDA stop. I took this PR's version and counted `spannedWave` as a wave operation (`waveOperations = ... || state.spannedWave`), so spanned programs take the write-masking path. It still loses the device, at ~1,460 s (frame ~817): - nvlddmkm event 153, a TDR (TdrDelay 10 s); - `vkQueueSubmit recorder: Vulkan result -4`; - 42 device faults with an unknown instruction pointer at 0x309250c60-0x3092511c0. That's the same signature as our earlier spanned runs without this PR. The non-spanned build of 0x80001e5f00 (839,036 words) dispatched fine. The spanned pipeline (838,306 words) was created about 5 minutes before the loss, but the log has no dispatch line for it. After it came several minutes of cold compiles of new 0x801d* programs, and the loss hit while 0x801d29eb00 was being created. So I can't tell whether that program or another spanned one hung. With spanned waves off, the same base runs well past that point. If you have a suspect, I can rerun with more logging.
Celegans12 commented 2026-10-15 19:23:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-15T19:23:19Z.


A cost I measured tonight that reviewers should know about: on NVIDIA, the write mask roughly doubles pipeline compile time for PPSA26344's giant two-lane compute programs.

Compiled side by side on the same machine, compute 0x801cdd2700 (about 1.75M SPIR-V words) takes 700 s with the earlier "reads continue, nothing masked" version and 1,411 s with this PR. The module is only about 0.5% bigger: roughly 90 more branches and about 550 more stores and loads of the per-lane faulted flag. So the extra time looks like NVIDIA's compiler handling a flag that stays live across the whole program, not the extra code itself.

For now our game branch keeps the older version, so our precompiles don't take twice as long. I'll look at making the mask cheaper, for example only guarding writes that a fault can reach, or keeping the flag in a form the compiler handles better, and post numbers here. If anyone has a preferred shape for this, I'm happy to hear it before I start.

Details
  • Windows 11, RTX 3080 Laptop GPU (driver 610.62). agc_shader_replay --pipeline-only into an empty VkPipelineCache and an empty NVIDIA store, both builds compiling concurrently.
  • Request: PPSA26344 compute 0x801cdd2700. 1,751,533 SPIR-V words without the mask, 1,760,989 with it.
  • A smaller program (0x806eddec00, 589k words) doesn't take the flag path and compiles in 18 s either way, with an identical pipeline fingerprint.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6200432893 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6200432893). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-15T19:23:19Z. --- A cost I measured tonight that reviewers should know about: on NVIDIA, the write mask roughly doubles pipeline compile time for PPSA26344's giant two-lane compute programs. Compiled side by side on the same machine, compute 0x801cdd2700 (about 1.75M SPIR-V words) takes 700 s with the earlier "reads continue, nothing masked" version and 1,411 s with this PR. The module is only about 0.5% bigger: roughly 90 more branches and about 550 more stores and loads of the per-lane faulted flag. So the extra time looks like NVIDIA's compiler handling a flag that stays live across the whole program, not the extra code itself. For now our game branch keeps the older version, so our precompiles don't take twice as long. I'll look at making the mask cheaper, for example only guarding writes that a fault can reach, or keeping the flag in a form the compiler handles better, and post numbers here. If anyone has a preferred shape for this, I'm happy to hear it before I start. <details><summary>Details</summary> - Windows 11, RTX 3080 Laptop GPU (driver 610.62). `agc_shader_replay --pipeline-only` into an empty VkPipelineCache and an empty NVIDIA store, both builds compiling concurrently. - Request: PPSA26344 compute 0x801cdd2700. 1,751,533 SPIR-V words without the mask, 1,760,989 with it. - A smaller program (0x806eddec00, 589k words) doesn't take the flag path and compiles in 18 s either way, with an identical pipeline fingerprint. </details>
Dextroid17 commented 2026-10-15 19:59:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-15T19:59:49Z.


Tested on Linux with lavapipe, the CI device: llvmpipe (Mesa 26.2.4, LLVM 23.1.1), CachyOS, GCC 16.2.1, CMake 4.4.3, default build type, full build with BUILD_TESTING=ON. Each run used a clean environment (env -i with HOME, PATH, VK_ICD_FILENAMES and GALLIUM_OVERRIDE_CPU_CAPS=avx).

This PR (b5a0c1ff7 merged into main 44df21632, no conflicts):

  • agc_driver_faulting_wave_invocation and agc_driver_gpu_buffer_format: pass, 3 runs out of 3.
  • With this PR's 5 source files reverted to main and its tests kept, both still pass, 3 runs out of 3. So on lavapipe the new test passes without the fix.

The reason, from the code: lavapipe reports 8-wide subgroups (minSubgroupSize = maxSubgroupSize = 8). Two lanes per invocation only happens when the host subgroup is 32 (SpirvEmitter.cpp:265, laneCount is 2 only when hostSubgroupSize == 32u). The write mask itself is still enabled there, since the execz branch makes the program need ballots. But the failures the test checks (the execz loop that never ends, and the partner lane 37 stopping with lane 5) need two lanes per invocation. So the description's "on main it fails" holds on 32-wide subgroups but not on lavapipe, and CI would stay green if the fix regressed. Wave32Subgroup.cpp:73 skips with a reason when the subgroup does not fit. Something similar here, for example:

if (device->Target().subgroupSize != 32u) {
    std::printf("skipped, the device runs wave64 programs on %u-wide subgroups\n", device->Target().subgroupSize);
    return VulkanTestSkipped;
}

would make lavapipe report a device-limited skip (tools/check_skips.py accepts reasons that mention subgroups) instead of a pass. Only a suggestion; whether a 64-wide device should run it is your call.

This may be useful for the mask rework you mention: on lavapipe the test passes even with the fix reverted, so it can't show whether a cheaper mask still handles the two-lane cases. That can only be checked on a 32-wide device, such as your RTX 3080 Laptop GPU.

Merged together with #6402 (on main 44df21632, no conflicts): full ctest: 2 of 1269 fail, 57 skipped (the same skips as main). The two failures are not from either PR:

  • agc_driver_mesh_index_cache segfaults on main too (and 5 runs out of 5 on the merge).
  • agc_frame_dump_io (from #5800) also fails on plain main, in 13 of 200 runs on an idle machine: closed pipe pixel write was accepted. Reading the test, its 128×128×4 = 65,536 pixel bytes are exactly Linux's default pipe buffer, so if the reader drains the 54-byte header before the pixel write starts, the empty pipe takes the whole write and it succeeds before the reader closes. Not measured beyond that.

Apart from those, the failed and skipped lists match main's full run.

Not tested: NVIDIA, AMD, Intel, PPSA26344.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6201096317 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6201096317). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-15T19:59:49Z. --- Tested on Linux with lavapipe, the CI device: llvmpipe (Mesa 26.2.4, LLVM 23.1.1), CachyOS, GCC 16.2.1, CMake 4.4.3, default build type, full build with `BUILD_TESTING=ON`. Each run used a clean environment (`env -i` with `HOME`, `PATH`, `VK_ICD_FILENAMES` and `GALLIUM_OVERRIDE_CPU_CAPS=avx`). **This PR** (`b5a0c1ff7` merged into `main` `44df21632`, no conflicts): - `agc_driver_faulting_wave_invocation` and `agc_driver_gpu_buffer_format`: pass, 3 runs out of 3. - With this PR's 5 source files reverted to `main` and its tests kept, both still pass, 3 runs out of 3. So on lavapipe the new test passes without the fix. The reason, from the code: lavapipe reports 8-wide subgroups (`minSubgroupSize` = `maxSubgroupSize` = 8). Two lanes per invocation only happens when the host subgroup is 32 (`SpirvEmitter.cpp:265`, `laneCount` is 2 only when `hostSubgroupSize == 32u`). The write mask itself is still enabled there, since the execz branch makes the program need ballots. But the failures the test checks (the execz loop that never ends, and the partner lane 37 stopping with lane 5) need two lanes per invocation. So the description's "on `main` it fails" holds on 32-wide subgroups but not on lavapipe, and CI would stay green if the fix regressed. `Wave32Subgroup.cpp:73` skips with a reason when the subgroup does not fit. Something similar here, for example: ```cpp if (device->Target().subgroupSize != 32u) { std::printf("skipped, the device runs wave64 programs on %u-wide subgroups\n", device->Target().subgroupSize); return VulkanTestSkipped; } ``` would make lavapipe report a device-limited skip (`tools/check_skips.py` accepts reasons that mention subgroups) instead of a pass. Only a suggestion; whether a 64-wide device should run it is your call. This may be useful for the mask rework you mention: on lavapipe the test passes even with the fix reverted, so it can't show whether a cheaper mask still handles the two-lane cases. That can only be checked on a 32-wide device, such as your RTX 3080 Laptop GPU. **Merged together with #6402** (on `main` `44df21632`, no conflicts): full ctest: 2 of 1269 fail, 57 skipped (the same skips as `main`). The two failures are not from either PR: - `agc_driver_mesh_index_cache` segfaults on `main` too (and 5 runs out of 5 on the merge). - `agc_frame_dump_io` (from #5800) also fails on plain `main`, in 13 of 200 runs on an idle machine: `closed pipe pixel write was accepted`. Reading the test, its 128×128×4 = 65,536 pixel bytes are exactly Linux's default pipe buffer, so if the reader drains the 54-byte header before the pixel write starts, the empty pipe takes the whole write and it succeeds before the reader closes. Not measured beyond that. Apart from those, the failed and skipped lists match `main`'s full run. Not tested: NVIDIA, AMD, Intel, PPSA26344. AI-assisted: yes
Amoenus commented 2026-10-16 05:10:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-16T05:10:08Z.


Barrier-program follow-up: #6689.

I reproduced later guest writes after an unmapped BDA read plus s_barrier on otherwise unchanged main. Main plus your current head b5a0c1ff79eb52bd52fea0ba6d0434e072190b99 still reproduces it in 5/5 runs on each of an RTX 5080 and AMD Radeon iGPU (Windows). bdaFaultMasksWrites currently requires bdaStopsInvocations, which excludes the barrier programs.

Proposed follow-up reuses your per-lane mask, keeps the invocations at their barriers, and carries the checked BDA helper's fault result back to the correct lane half. All-fault and mixed valid/faulting lane tests pass 5/5 per GPU. The full Windows build and focused checks passed, but broader regression/static-analysis gates remain incomplete; the current checkpoint and remaining checks are recorded in #6689. This prototype is deferred while we pivot to PR maintenance.

Proposed ordering is #6416 first, then this compute follow-up. If you prefer to incorporate it here, the focused commit is available to take. No competing upstream PR is open.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6208563419 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6208563419). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-16T05:10:08Z. --- Barrier-program follow-up: #6689. I reproduced later guest writes after an unmapped BDA read plus `s_barrier` on otherwise unchanged main. Main plus your current head `b5a0c1ff79eb52bd52fea0ba6d0434e072190b99` still reproduces it in 5/5 runs on each of an RTX 5080 and AMD Radeon iGPU (Windows). `bdaFaultMasksWrites` currently requires `bdaStopsInvocations`, which excludes the barrier programs. [Proposed follow-up](https://github.com/Amoenus/AnyPS5/commit/21745fa2234cbb9d95a264fc0e21adf715edf0da) reuses your per-lane mask, keeps the invocations at their barriers, and carries the checked BDA helper's fault result back to the correct lane half. All-fault and mixed valid/faulting lane tests pass 5/5 per GPU. The full Windows build and focused checks passed, but broader regression/static-analysis gates remain incomplete; the current checkpoint and remaining checks are recorded in #6689. This prototype is deferred while we pivot to PR maintenance. Proposed ordering is #6416 first, then this compute follow-up. If you prefer to incorporate it here, the focused commit is available to take. No competing upstream PR is open. AI-assisted: yes.
MarcZX10 commented 2026-10-16 05:54:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T05:54:14Z.


While preparing the barrier follow-up, I checked the narrow-subgroup case raised in the review. The current agc_driver_faulting_wave_invocation passes on llvmpipe with subgroup size 8, and the review reports it also passes with the implementation reverted there; that device does not exercise the two-lane EXEC case the test is meant to cover. A device-limitation skip when subgroup size is not 32 would make that coverage status explicit. The follow-up mixed-lane control had the same assumption: on subgroup 8 it reported 63 mismatches. I have a local test-only guard for that mixed control on subgroup != 32; the two focused CTests then pass on llvmpipe (with the host CPU capability guard temporarily bypassed). The 32-lane mixed case still needs a suitable device, as your Windows NVIDIA/AMD runs provide.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6209086616 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6209086616). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T05:54:14Z. --- While preparing the barrier follow-up, I checked the narrow-subgroup case raised in the review. The current `agc_driver_faulting_wave_invocation` passes on llvmpipe with subgroup size 8, and the review reports it also passes with the implementation reverted there; that device does not exercise the two-lane EXEC case the test is meant to cover. A device-limitation skip when subgroup size is not 32 would make that coverage status explicit. The follow-up mixed-lane control had the same assumption: on subgroup 8 it reported 63 mismatches. I have a local test-only guard for that mixed control on subgroup != 32; the two focused CTests then pass on llvmpipe (with the host CPU capability guard temporarily bypassed). The 32-lane mixed case still needs a suitable device, as your Windows NVIDIA/AMD runs provide.
MarcZX10 commented 2026-10-16 09:35:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T09:35:35Z.


I opened stacked follow-up #6751 for the test-only subgroup guard discussed here. The agc_driver_faulting_wave_invocation case now reports a device-limited skip unless the host subgroup is exactly 32 lanes, because narrower/wider subgroups do not exercise the two-lanes-per-invocation wave64 case. #6751 carries your current PR commits unchanged and depends on #6416; Linux target build and conventions passed locally. The focused CTest cannot reach Vulkan on my Xeon because it lacks the required CPU instruction sets.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6212585734 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6212585734). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T09:35:35Z. --- I opened stacked follow-up #6751 for the test-only subgroup guard discussed here. The `agc_driver_faulting_wave_invocation` case now reports a device-limited skip unless the host subgroup is exactly 32 lanes, because narrower/wider subgroups do not exercise the two-lanes-per-invocation wave64 case. #6751 carries your current PR commits unchanged and depends on #6416; Linux target build and conventions passed locally. The focused CTest cannot reach Vulkan on my Xeon because it lacks the required CPU instruction sets.
blawesom commented 2026-10-17 14:42:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T14:42:04Z.


Rebase handoff — rebased onto current main (authorship unchanged). One conflict in SpirvEmitter.cpp: main added !state.spannedWave to the bdaStopsInvocations condition while this PR adds the bdaFaultMasksWrites computation after it — the merged version keeps main's condition and layers your fault-masking computation.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: green apart from the known main regression (agc_driver_tessellation segfault, #4727), not this PR

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6416
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 48482f629.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6235225760 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6235225760). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-17T14:42:04Z. --- **Rebase handoff** — rebased onto current `main` (authorship unchanged). One conflict in `SpirvEmitter.cpp`: `main` added `!state.spannedWave` to the `bdaStopsInvocations` condition while this PR adds the `bdaFaultMasksWrites` computation after it — the merged version keeps `main`'s condition and layers your fault-masking computation. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: green apart from the known `main` regression** (`agc_driver_tessellation` segfault, #4727), not this PR **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/6416 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `48482f629`.
oneandonlydean commented 2026-10-18 12:51:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T12:51:57Z.


Thanks. Main has moved under this PR: since bd6ed97f6d, bdaStopsInvocations is false in spanned waves (a single-wave wave64 compute program on a 32-lane host with full subgroups, 80e3d90ed60/7a6cc717863). Because bdaFaultMasksWrites requires bdaStopsInvocations and StopBdaInvocationIf returns early without it, a straight rebase turns the masking off for every single-wave program, including the test here, which I'd expect to fail on an NVIDIA or full-subgroup AMD device after the rebase. Since masking keeps invocations running, could it apply in spanned waves too (record the fault in StopBdaInvocationIf before the !bdaStopsInvocations return, and gate masking on the fault kinds rather than on stopping), with the test covering a spanned single wave and a two-wave workgroup? Pipodi still sees spanned wave64 dispatches hang in PPSA26344, so a run of the rebased head there would tell us whether this is the remaining cause.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6250136150 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6250136150). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-18T12:51:57Z. --- Thanks. Main has moved under this PR: since bd6ed97f6d6, `bdaStopsInvocations` is false in spanned waves (a single-wave wave64 compute program on a 32-lane host with full subgroups, 80e3d90ed60/7a6cc717863). Because `bdaFaultMasksWrites` requires `bdaStopsInvocations` and `StopBdaInvocationIf` returns early without it, a straight rebase turns the masking off for every single-wave program, including the test here, which I'd expect to fail on an NVIDIA or full-subgroup AMD device after the rebase. Since masking keeps invocations running, could it apply in spanned waves too (record the fault in `StopBdaInvocationIf` before the `!bdaStopsInvocations` return, and gate masking on the fault kinds rather than on stopping), with the test covering a spanned single wave and a two-wave workgroup? Pipodi still sees spanned wave64 dispatches hang in PPSA26344, so a run of the rebased head there would tell us whether this is the remaining cause.
oneandonlydean commented 2026-10-18 14:21:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T14:21:59Z.


Correction to my earlier note: spanned waves are opt-in on main (APS5_SPANNED_WAVE, VulkanDevice.cpp:1784), so by default this PR's test runs the two-lane path with masking on and passes, and it fails with masking forced off, so the rebase onto main is fine as is. I pushed it to this branch (9c768176) and started a full CI run. The gap I described applies only with APS5_SPANNED_WAVE=1: there bdaStopsInvocations is false, masking is off, and the test fails with "lane 5 stored after its read faulted". Not a blocker for this PR; as a follow-up, could the masking also cover spanned waves (record the fault before the !bdaStopsInvocations return) and the test run once with APS5_SPANNED_WAVE=1? That may be what still hangs PPSA26344's spanned runs.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251016010 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6251016010). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-18T14:21:59Z. --- Correction to my earlier note: spanned waves are opt-in on `main` (`APS5_SPANNED_WAVE`, VulkanDevice.cpp:1784), so by default this PR's test runs the two-lane path with masking on and passes, and it fails with masking forced off, so the rebase onto `main` is fine as is. I pushed it to this branch (9c768176) and started a full CI run. The gap I described applies only with `APS5_SPANNED_WAVE=1`: there `bdaStopsInvocations` is false, masking is off, and the test fails with "lane 5 stored after its read faulted". Not a blocker for this PR; as a follow-up, could the masking also cover spanned waves (record the fault before the `!bdaStopsInvocations` return) and the test run once with `APS5_SPANNED_WAVE=1`? That may be what still hangs PPSA26344's spanned runs.
jotitadev commented 2026-10-19 02:19:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T02:19:09Z.

Review: COMMENTED


Apple GPU / MoltenVK run. Apple's subgroup size is exactly 32, the case agc_driver_faulting_wave_invocation needs (see #6751): red without the fix, green with it, and no other change.

Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head 9c768176f, PR diff applied cleanly. Driver: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), subgroup=32.

Tested: the tree is main a373e85e5 + mugurc's macOS series (ci/macos-series-2) + the PRs needed to build on macOS (#6667, #6668, #7524, #6969, and two files of #7332), not plain main (it doesn't build on macOS yet). Base on that tree: 40 ^agc failures, the same known failures in every run below unless noted.

  • agc_driver_faulting_wave_invocation with the PR: passes 3 of 3.
  • The test alone on the base tree: fails with lane 0 left the EXEC loop after 100 passes, expected 4 (the loop stops at 100).
  • Full ^agc suite with the PR: 40 of 728 fail, the same 40 as the base.

About the spanned-wave gap @oneandonlydean described: it can't occur on MoltenVK today. With APS5_SPANNED_WAVE=1 the driver logs spans two full 32-lane subgroups: 0, because MoltenVK doesn't give full compute subgroups, so wave64 always takes the two-lane path here and the masking stays on.

GPUs tested: Apple M2 Max (MoltenVK 1.4.2)

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5566288703 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#pullrequestreview-5566288703). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T02:19:09Z. **Review:** COMMENTED --- <!-- head: 9c768176f --> Apple GPU / MoltenVK run. Apple's subgroup size is exactly 32, the case `agc_driver_faulting_wave_invocation` needs (see #6751): red without the fix, green with it, and no other change. Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head 9c768176f, PR diff applied cleanly. Driver: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0), `subgroup=32`. **Tested:** the tree is `main` a373e85e5 + mugurc's macOS series (`ci/macos-series-2`) + the PRs needed to build on macOS (#6667, #6668, #7524, #6969, and two files of #7332), not plain `main` (it doesn't build on macOS yet). Base on that tree: 40 `^agc` failures, the same known failures in every run below unless noted. - `agc_driver_faulting_wave_invocation` with the PR: passes 3 of 3. - The test alone on the base tree: fails with `lane 0 left the EXEC loop after 100 passes, expected 4 (the loop stops at 100)`. - Full `^agc` suite with the PR: 40 of 728 fail, the same 40 as the base. About the spanned-wave gap @oneandonlydean described: it can't occur on MoltenVK today. With `APS5_SPANNED_WAVE=1` the driver logs `spans two full 32-lane subgroups: 0`, because MoltenVK doesn't give full compute subgroups, so wave64 always takes the two-lane path here and the masking stays on. GPUs tested: Apple M2 Max (MoltenVK 1.4.2) Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Celegans12 commented 2026-10-19 23:49:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-19T23:49:32Z.


@oneandonlydean, thanks for doing the rebase and for sorting out the spanned-wave question. Yes, I'll take the spanned-wave masking as a follow-up PR once this one is in. The plan is what you describe: record the fault in StopBdaInvocationIf before the !bdaStopsInvocations return, gate the masking on the fault kinds rather than on stopping, and run the test once more with APS5_SPANNED_WAVE=1, for a single spanned wave and for a two-wave workgroup. @jotitadev's run shows the gap can't happen on MoltenVK, so the follow-up is about NVIDIA and full-subgroup AMD.

About Yōtei: our runs do use APS5_SPANNED_WAVE=1, but they don't carry this PR's masking yet, because of the compile-time cost I mentioned earlier. So I can't tell yet whether this is what still hangs the spanned runs. I'll try it in a game run with the follow-up once the machine is free.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6279896669 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#issuecomment-6279896669). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-19T23:49:32Z. --- @oneandonlydean, thanks for doing the rebase and for sorting out the spanned-wave question. Yes, I'll take the spanned-wave masking as a follow-up PR once this one is in. The plan is what you describe: record the fault in `StopBdaInvocationIf` before the `!bdaStopsInvocations` return, gate the masking on the fault kinds rather than on stopping, and run the test once more with `APS5_SPANNED_WAVE=1`, for a single spanned wave and for a two-wave workgroup. @jotitadev's run shows the gap can't happen on MoltenVK, so the follow-up is about NVIDIA and full-subgroup AMD. About Yōtei: our runs do use `APS5_SPANNED_WAVE=1`, but they don't carry this PR's masking yet, because of the compile-time cost I mentioned earlier. So I can't tell yet whether this is what still hangs the spanned runs. I'll try it in a game run with the follow-up once the machine is free.
XairRrR commented 2026-11-02 22:49:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T22:49:15Z.

Review: APPROVED


Reviewed — approved

The merge with main is clean and builds. The focused tests pass with no new validation IDs, and the updated guarded-pointer host check fails without the production change. This machine's lavapipe cannot run the wave64 two-lane path or the spanned-wave path, so for those paths I rely on the NVIDIA runs that other people reported.

What I ran

Head 19eddecba1143143bb4c5b750f51632a4cf2eef8, main 9090972b7e91fd266819cbd77a8b058e177b5682, merged tree 8d69bdea97d7ba1a41e27e654c4ef880fb16bf9c (--no-ff). Machine: Debian 13 VM, 2× Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19, subgroup 8).

git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...19eddecba1143143bb4c5b750f51632a4cf2eef8
python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682
env ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx ctest --test-dir build -j8 --test-load 32 --output-on-failure \
  -R "^(agc_driver_faulting_wave_invocation|agc_driver_guarded_null_pointer|agc_shader_memory|agc_driver_bda_device|agc_driver_bda_span_reads|agc_driver_bda_span_reads_draw_pipeline|agc_driver_bda_anchor_reads|agc_driver_gpu_buffer_format)$"
env ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 build/tests/agc_driver_faulting_wave_invocation_tests
# negative control: the PR's 8 production files restored from main, then
ninja -C build -j32 -l32 agc_shader_memory_tests agc_driver_guarded_null_pointer_tests agc_driver_faulting_wave_invocation_tests
ctest --test-dir build --output-on-failure -R "^(agc_driver_faulting_wave_invocation|agc_driver_guarded_null_pointer|agc_shader_memory)$"
# merged files restored from 8d69bdea, rebuilt, same ctest again; git status --porcelain empty

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure / build / libs (script) ok
Selected tests (script) 2033 ran: 0 new failures, 0 timeouts. 7 known main failures (agc_driver_division, denormal-mode tests, unwrap_self, vector_constant_factor_tininess). agc_driver_runtime_formatted_store passed on rerun
Skips 111, all with device-limitation reasons (check_skips.py)
Vulkan validation vs main (script) 758 tests, layer loaded in 757, missing in none, 0 tests with new VUIDs
Focused tests (8) all pass. agc_shader_memory 8.7 s, every other test under 3.4 s
New test registration picked up automatically by the tests/execution/*.cpp glob as agc_driver_faulting_wave_invocation
New test on lavapipe
Selected GPU name=llvmpipe (LLVM 19.1.7, 256 bits) ... subgroup=8
single-wave wave64 compute spans two full 32-lane subgroups: 0
[gpu] deferred write-back failed: BDA access failed: address=0x... instruction=0x10 bytes=1 stage=4 reason=1
faulting wave invocation tests passed

Negative control

I restored the 8 production files from main and kept the PR's tests: ShaderDiskCache.hpp, SpirvBda.hpp, SpirvEmitterState.hpp, SpirvBdaFault.cpp, SpirvBdaRead.cpp, SpirvEmitter.cpp, SpirvFlowEmitter.cpp and SpirvMemoryInstructions.cpp. Then I rebuilt the three affected test executables.

  • agc_shader_memory fails as it should: guarded pointer: a continuing guarded read must latch its first fault without overwriting the guard word or calling record_bda_fault.
  • agc_driver_faulting_wave_invocation still passes. That is expected on this device: with 8-wide subgroups, laneCount is 1 and no wave spans subgroups, so neither the two-lane path nor the spanned path is reached. This confirms with my own run what Dextroid17 and MarcZX10 reported for lavapipe. The red-without/green-with evidence for this test comes from jotitadev (MoltenVK, subgroup 32), from cookie42073-cmd (RTX 4070 SUPER, UHD 770) and from the author.
  • agc_driver_guarded_null_pointer passes in both arms on lavapipe.

After restoring the merged files and rebuilding, all three tests pass again and git status --porcelain is empty.

Findings

Blocking

None.

Non-blocking

  1. The description no longer matches the last commit. The description says "Existing spanned-wave, barrier and mesh exclusions remain". But 19eddecba1 removes !state.spannedWave from bdaStopsInvocations (core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp:331). It then enables write masking for spanned waves through (waveOperations || state.spannedWave) (SpirvEmitter.cpp:335). Spanned waves are on by default on main for devices with full 32-lane compute subgroups: they are disabled only by APS5_NO_SPANNED_WAVE, in VulkanDevice.cpp:2098. So on NVIDIA this is now the main path that the new test exercises. This is in effect the spanned-wave follow-up that oneandonlydean asked for. Please update the "What" paragraph so reviewers know that spanned compute waves now continue with masked writes instead of being excluded. Pipodi's PPSA26344 report of a device loss with spanned waves plus masking was made on an earlier version, so a rerun with this head would be useful.
  2. The technical-debt entry for unlinked calls is now partly outdated. docs/dev/debt/shader.md:47 says an unlinked call "records the UnlinkedCall fault ... and stops the invocation, or continues after the call in programs whose faults do not stop invocations". With this PR, EmitUnlinkedCall (SpirvFlowEmitter.cpp:959) → StopBdaInvocationIf (SpirvBdaFault.cpp:132) no longer stops in masked programs. The invocation instead continues past the call with its later guest writes masked. A one-clause update of that entry would keep the debt file accurate.
  3. Lavapipe CI cannot detect a regression in the new test. I confirmed this with the negative control above; Dextroid17 and MarcZX10 had already reported it. #6751 adds the subgroup-32 skip. Mentioning that dependency here, or folding the guard in, would avoid a test that passes on CI without exercising anything.
  4. Cost without faults. The author reports roughly 2× NVIDIA pipeline compile time on very large two-lane programs, and an Astro Bot startup delay on an RTX 4090 is still unexplained. I did not measure either. The PR makes no performance claim, so this is not a rule issue, but it is worth tracking before titles with large DMA compute programs depend on it.

Not verified

  • Behaviour on a device with 32-wide subgroups: the two-lane wave64 path and the hardware-spanning path. This machine only has lavapipe with subgroup 8, so these come from third-party runs (TechLevelZero's RTX 2000 Ada run on this exact head, the author's RTX 3080 Laptop GPU run, and earlier MoltenVK, RTX 4070 SUPER and UHD 770 runs).
  • Whether every StopBdaInvocationIf caller that may now continue in a masked program guards its later accesses. The byte-load path is guarded in SpirvBdaRead.cpp:44-45. I read the runtime-buffer and overflow callers, and they look guarded or zero-valued, but I did not check all of them exhaustively.
  • Compile time and run time impact, and title behaviour (PPSA26344).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5744536848 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#pullrequestreview-5744536848). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-02T22:49:15Z. **Review:** APPROVED --- # Reviewed — approved The merge with `main` is clean and builds. The focused tests pass with no new validation IDs, and the updated guarded-pointer host check fails without the production change. This machine's lavapipe cannot run the wave64 two-lane path or the spanned-wave path, so for those paths I rely on the NVIDIA runs that other people reported. ## What I ran Head `19eddecba1143143bb4c5b750f51632a4cf2eef8`, `main` `9090972b7e91fd266819cbd77a8b058e177b5682`, merged tree `8d69bdea97d7ba1a41e27e654c4ef880fb16bf9c` (`--no-ff`). Machine: Debian 13 VM, 2× Xeon Gold 6136, GCC 14.2.0, Release, Ninja, lavapipe (Mesa 26.1.6, LLVM 19, subgroup 8). ``` git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...19eddecba1143143bb4c5b750f51632a4cf2eef8 python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682 env ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx ctest --test-dir build -j8 --test-load 32 --output-on-failure \ -R "^(agc_driver_faulting_wave_invocation|agc_driver_guarded_null_pointer|agc_shader_memory|agc_driver_bda_device|agc_driver_bda_span_reads|agc_driver_bda_span_reads_draw_pipeline|agc_driver_bda_anchor_reads|agc_driver_gpu_buffer_format)$" env ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 build/tests/agc_driver_faulting_wave_invocation_tests # negative control: the PR's 8 production files restored from main, then ninja -C build -j32 -l32 agc_shader_memory_tests agc_driver_guarded_null_pointer_tests agc_driver_faulting_wave_invocation_tests ctest --test-dir build --output-on-failure -R "^(agc_driver_faulting_wave_invocation|agc_driver_guarded_null_pointer|agc_shader_memory)$" # merged files restored from 8d69bdea, rebuilt, same ctest again; git status --porcelain empty ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure / build / libs (script) | ok | | Selected tests (script) | 2033 ran: 0 new failures, 0 timeouts. 7 known `main` failures (`agc_driver_division`, denormal-mode tests, `unwrap_self`, `vector_constant_factor_tininess`). `agc_driver_runtime_formatted_store` passed on rerun | | Skips | 111, all with device-limitation reasons (`check_skips.py`) | | Vulkan validation vs `main` (script) | 758 tests, layer loaded in 757, missing in none, **0 tests with new VUIDs** | | Focused tests (8) | all pass. `agc_shader_memory` 8.7 s, every other test under 3.4 s | | New test registration | picked up automatically by the `tests/execution/*.cpp` glob as `agc_driver_faulting_wave_invocation` | <details><summary>New test on lavapipe</summary> ``` Selected GPU name=llvmpipe (LLVM 19.1.7, 256 bits) ... subgroup=8 single-wave wave64 compute spans two full 32-lane subgroups: 0 [gpu] deferred write-back failed: BDA access failed: address=0x... instruction=0x10 bytes=1 stage=4 reason=1 faulting wave invocation tests passed ``` </details> ## Negative control I restored the 8 production files from `main` and kept the PR's tests: `ShaderDiskCache.hpp`, `SpirvBda.hpp`, `SpirvEmitterState.hpp`, `SpirvBdaFault.cpp`, `SpirvBdaRead.cpp`, `SpirvEmitter.cpp`, `SpirvFlowEmitter.cpp` and `SpirvMemoryInstructions.cpp`. Then I rebuilt the three affected test executables. - `agc_shader_memory` **fails** as it should: `guarded pointer: a continuing guarded read must latch its first fault without overwriting the guard word or calling record_bda_fault`. - `agc_driver_faulting_wave_invocation` **still passes**. That is expected on this device: with 8-wide subgroups, `laneCount` is 1 and no wave spans subgroups, so neither the two-lane path nor the spanned path is reached. This confirms with my own run what Dextroid17 and MarcZX10 reported for lavapipe. The red-without/green-with evidence for this test comes from jotitadev (MoltenVK, subgroup 32), from cookie42073-cmd (RTX 4070 SUPER, UHD 770) and from the author. - `agc_driver_guarded_null_pointer` passes in both arms on lavapipe. After restoring the merged files and rebuilding, all three tests pass again and `git status --porcelain` is empty. ## Findings ### Blocking None. ### Non-blocking 1. **The description no longer matches the last commit.** The description says "Existing spanned-wave, barrier and mesh exclusions remain". But `19eddecba1` removes `!state.spannedWave` from `bdaStopsInvocations` (`core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp:331`). It then enables write masking for spanned waves through `(waveOperations || state.spannedWave)` (`SpirvEmitter.cpp:335`). Spanned waves are on by default on `main` for devices with full 32-lane compute subgroups: they are disabled only by `APS5_NO_SPANNED_WAVE`, in `VulkanDevice.cpp:2098`. So on NVIDIA this is now the main path that the new test exercises. This is in effect the spanned-wave follow-up that oneandonlydean asked for. Please update the "What" paragraph so reviewers know that spanned compute waves now continue with masked writes instead of being excluded. Pipodi's PPSA26344 report of a device loss with spanned waves plus masking was made on an earlier version, so a rerun with this head would be useful. 2. **The technical-debt entry for unlinked calls is now partly outdated.** `docs/dev/debt/shader.md:47` says an unlinked call "records the `UnlinkedCall` fault ... and stops the invocation, or continues after the call in programs whose faults do not stop invocations". With this PR, `EmitUnlinkedCall` (`SpirvFlowEmitter.cpp:959`) → `StopBdaInvocationIf` (`SpirvBdaFault.cpp:132`) no longer stops in masked programs. The invocation instead continues past the call with its later guest writes masked. A one-clause update of that entry would keep the debt file accurate. 3. **Lavapipe CI cannot detect a regression in the new test.** I confirmed this with the negative control above; Dextroid17 and MarcZX10 had already reported it. #6751 adds the subgroup-32 skip. Mentioning that dependency here, or folding the guard in, would avoid a test that passes on CI without exercising anything. 4. **Cost without faults.** The author reports roughly 2× NVIDIA pipeline compile time on very large two-lane programs, and an Astro Bot startup delay on an RTX 4090 is still unexplained. I did not measure either. The PR makes no performance claim, so this is not a rule issue, but it is worth tracking before titles with large DMA compute programs depend on it. ## Not verified - Behaviour on a device with 32-wide subgroups: the two-lane wave64 path and the hardware-spanning path. This machine only has lavapipe with subgroup 8, so these come from third-party runs (TechLevelZero's RTX 2000 Ada run on this exact head, the author's RTX 3080 Laptop GPU run, and earlier MoltenVK, RTX 4070 SUPER and UHD 770 runs). - Whether every `StopBdaInvocationIf` caller that may now continue in a masked program guards its later accesses. The byte-load path is guarded in `SpirvBdaRead.cpp:44-45`. I read the runtime-buffer and overflow callers, and they look guarded or zero-valued, but I did not check all of them exhaustively. - Compile time and run time impact, and title behaviour (PPSA26344). <!-- anyps5-bots job=2329 head=19eddecba1143143bb4c5b750f51632a4cf2eef8 -->
MarcZX10 commented 2026-11-16 18:43:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-16T18:43:15Z.

Review: COMMENTED


Reviewed — comments

Changes are required before merge: please confirm the invocation fault mask is correct for memory writes that happen inside emitted helper functions.

What I ran

Reviewed head ab3e21c97c54ce34cff2611cc5dd33f3bb02fb3a using the prepared diff and the pinned repo_read.py reader. No build or tests were run by me; test results in the PR description are author reported.

Results

Check Result Note
Diff and targeted source review passed Emitter, fault, read and test paths inspected
Build and tests not run No commands executed

Findings

Blocking

None verified.

Non-blocking

  • The new guard in EmitUnlessInvocationFaulted applies only to instructions emitted directly from the structured block. Please verify that writes performed by helper functions called from a later instruction are also suppressed after a lane faults. I did not trace all helper call paths, so this is a question for follow-up rather than a verified defect. The relevant dispatch is at core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp:837.

Not verified

  • ShaderMemory.cpp was read through the pinned reader around the changed guarded-pointer checks; the rest of that large file was not read. All other changed source files listed as included in the manifest were read in targeted sections, along with the added FaultingWaveInvocation.cpp.
  • repo_read.py reports ShaderMemory.cpp as excluded from the review folder for size; the remaining changed files were included. files.json was unavailable as a review-folder file, so exclusions are reported from the manifest and reader listing.
  • Build, current-head tests, CI, console behavior, and the complete set of helper-function write paths were not verified. Test outcomes in description.md are author reported.

To get this to a good state

Nothing is required. Optional: confirm and, if needed, test that helper-function writes are masked after the faulting read.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5925473220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6416#pullrequestreview-5925473220). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-16T18:43:15Z. **Review:** COMMENTED --- # Reviewed — comments Changes are required before merge: please confirm the invocation fault mask is correct for memory writes that happen inside emitted helper functions. ## What I ran Reviewed head `ab3e21c97c54ce34cff2611cc5dd33f3bb02fb3a` using the prepared diff and the pinned `repo_read.py` reader. No build or tests were run by me; test results in the PR description are author reported. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Emitter, fault, read and test paths inspected | | Build and tests | not run | No commands executed | ## Findings ### Blocking None verified. ### Non-blocking - The new guard in `EmitUnlessInvocationFaulted` applies only to instructions emitted directly from the structured block. Please verify that writes performed by helper functions called from a later instruction are also suppressed after a lane faults. I did not trace all helper call paths, so this is a question for follow-up rather than a verified defect. The relevant dispatch is at `core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp:837`. ## Not verified - `ShaderMemory.cpp` was read through the pinned reader around the changed guarded-pointer checks; the rest of that large file was not read. All other changed source files listed as included in the manifest were read in targeted sections, along with the added `FaultingWaveInvocation.cpp`. - `repo_read.py` reports `ShaderMemory.cpp` as excluded from the review folder for size; the remaining changed files were included. `files.json` was unavailable as a review-folder file, so exclusions are reported from the manifest and reader listing. - Build, current-head tests, CI, console behavior, and the complete set of helper-function write paths were not verified. Test outcomes in `description.md` are author reported. ## To get this to a good state Nothing is required. Optional: confirm and, if needed, test that helper-function writes are masked after the faulting read.
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!6416
No description provided.