Skip to content

fix(shader): keep every lane in a stencil export replay when the device can store through an address - #18530

Merged
oneandonlydean merged 11 commits into
boykopovar:mainfrom
Capmare:fix/agc-stencil-replay-late-tests
Nov 18, 2026
Merged

oneandonlydean merged 11 commits into
boykopovar:mainfrom
Capmare:fix/agc-stencil-replay-late-tests

Conversation

@Capmare

@Capmare Capmare commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What

On a device without VK_EXT_shader_stencil_export (NVIDIA), a pixel shader that exports a stencil reference runs once per reference value, and the hardware stencil test of each pass can skip pixels before the shader runs. A wave branch or a lane read in the shader then sees other lanes than the guest does. StencilReplaySafe therefore refuses every shader whose exec-mask control it cannot prove independent of the lane set, and the draw aborts with stencil reference export emulation requires a replay-safe pixel shader with late tests.

Marvel's Wolverine (PPSA03671) stops on this: shader 0x11d01d0900 is a 208-word pass that loads a texel, remaps it through constant tables, divides by a uniform value and exports depth and stencil. Its s_cbranch_execz after a v_cmpx on the loaded value splits it into two return paths, and the analysis only accepts a body that rejoins a merge block.

The Vulkan spec lets a driver run a fragment shader on fewer pixels than the guest only when the shader has no side effects. A replay shader that the lane-set proof cannot clear now ends in a store through a device address behind a condition that is always false (the reference is at most 255, and the guard reads it from a push constant, so the driver cannot fold it). The driver has to run that shader on every covered pixel in every pass, as the guest does. A shader that the proof already clears gets no store and keeps the early tests, so no shader that works today gets slower. With the lane set fixed, StencilReplaySafe no longer needs the lane-mask proof or the ban on lane reads. Shader clock reads, loops, memory writes, shared memory and the other earlier checks stay. A device without PhysicalStorageBufferAddresses or Int64 keeps the earlier analysis. A device that exposes the extension (Intel and llvmpipe here) exports the stencil natively and is not affected.

The change:

  • StencilReplay.cpp: StencilReplaySafe(program, lanesFixed), StencilReplayLanesFixed(capabilities) and StencilReplayNeedsStore(program, capabilities).
  • SpirvFlowEmitter.cpp and SpirvModuleSetup.cpp: the store and the address capability for replay modules.
  • ShaderValidation.cpp: the capability and SPV_KHR_physical_storage_buffer are allowed for a replay fragment shader.
  • docs/dev/debt/shader.md: the entry says the guarantee is measured on one driver only.

Tested

Rocky Linux 10.2, i7-14700K, RTX 4070 SUPER, NVIDIA 620.70.06, Release. main a26b782 and this branch, same machine. Tests were run as ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V -R '^agc_driver|shader_recompiler'.

main this branch
Tests passing 1062 of 1080 1062 of 1080

The 18 failing tests are the same set on both sides: agc_driver_division, agc_driver_f32_denormal_flush, agc_driver_image_table, agc_driver_image_table_packed* (11), agc_driver_mesh_vector_window_writes and agc_driver_mullit_f32_denormal_modes. Their logs carry the same VUID- counts on both sides, and neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS apart from ctest echoing its regex:

2312 VUID-VkDeviceCreateInfo-pNext-pNext
  82 VUID-VkShaderModuleCreateInfo-pCode-08741
  82 VUID-VkShaderModuleCreateInfo-pCode-08739
  82 VUID-VkShaderModuleCreateInfo-pCode-08737
  14 VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849
  14 VUID-VkPipelineShaderStageCreateInfo-module-parameter

New case in agc_driver_stencil_replay: a pixel shader (assembled for gfx1030, wave64) whose branch tests whether any lane has an odd column. Even columns export 255 on one path and 254 on the other, and the stencil buffer holds 255 under even and 0 under odd columns. In the guest every wave holds both kinds of column, so every pixel is drawn.

  • With this change, every pixel is drawn.
  • With the store removed and the shader still accepted, the even columns are not drawn: pixel (0, 0) is 64, expected drawn. The hardware skips the odd columns in the pass for 255, the branch flips and the even columns export 254.
  • On main, the shader is refused with stencil reference export emulation requires a replay-safe pixel shader with late tests.

agc_driver_stencil_replay also passes under the same validation settings on Intel RPL-S and llvmpipe (Mesa 25.2.7, selected with VK_DRIVER_FILES). Both export the stencil natively, so they do not run the replay.

Marvel's Wolverine: I replayed the dumped request of 0x11d01d0900 through the recompiler offline (the dump lacks one descriptor, which I supplied). It aborts on main and recompiles on this branch (5157 SPIR-V words). I have not drawn it in the game, because the run stalls on texture memory before it reaches this draw (see #12575).

The guarantee rests on the driver following the spec for shaders with side effects (chapter Fragment Operations, section Fragment Shading). The spec does not fix how the driver groups pixels into waves, so the replay assumes that every pass groups them the same way. I measured it on NVIDIA (RTX 4070 SUPER) and, through runs by mrfelek and domx4q, on an RTX 3080 Ti and an RTX 4090. JJenkx and blawesom ran it on AMD (RX 6700 XT, driver 26.10.1, Windows; RX 9070 XT with RADV, Linux). The debt entry says so. fragmentStoresAndAtomics is always required and enabled, the shader cache key already holds the capability list, and agc_driver_stencil_replay logs no new VUID.

tools/pr_overlap.py failed closed, so I searched the diffs of the 39 PRs it lists for the replay code. #10351 (stencil operation values through an attachment) changes SelectStencilExportMode and SpirvEmitterHelpers.cpp around the same lines, and #7689 changes one condition of StencilReplaySafe. Neither adds the lane guarantee. #18322 admits first-lane reads of wave-uniform values on every device and complements this change, which also covers non-uniform lane reads and wave branches but needs PhysicalStorageBufferAddresses and Int64. #16571 only touches a neighbouring debt entry in docs/dev/debt/shader.md. I will rebase on whichever lands first.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed 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: the stencil shader abort of PPSA03671 Marvels Wolverine PPSA03671 Relies on consoles .prxs #1033 (the game still stops at perf(agc): reuse a texture the sampled cache refuses while frames keep using it #12575)
  • GPUs tested: NVIDIA RTX 4070 SUPER, 620.70.06, Rocky Linux 10.2 (all tests above); Intel RPL-S, Mesa 25.2.7, and llvmpipe, Mesa 25.2.7, Rocky Linux 10.2 (agc_driver_stencil_replay only)
  • AI-assisted: yes

…ce can store through an address

Without VK_EXT_shader_stencil_export a pixel shader that exports a stencil reference runs once per reference value, and the hardware stencil test can skip pixels before the shader, so a wave branch or lane read sees other lanes than the guest does. Replay shaders now end in a store through a device address that never runs, so the driver must run them on every covered pixel. The replay then accepts shaders whose only fault was their lane masks.
@JJenkx

JJenkx commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Windows check of head cc21abd2ed, merged onto main 021d3612e8 (GPU merge bdf6423f93; CPU merge 487114c1a5). Setup: Windows 11 Enterprise 22621, AMD RX 6700 XT, AMD driver 26.10.1, MinGW-w64 GCC 15.2 UCRT, Release.

Tests: agc_driver_stencil_replay and agc_driver_stencil_replay_no_gpl.

  • GPU, through the shared Windows GPU FIFO with ANYPS5_REQUIRE_VULKAN=1: both passed in 3 of 3 runs, 6 of 6 outcomes. The binaries matched the hashes recorded at preparation, and the receipt shows exit 0 and app_count=0.
  • CPU, Vulkan hidden: both skipped (they need a device), 0 failed, in 3 of 3 runs.

AI-assisted: yes.

@Capmare

Capmare commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the Windows run. It adds a second vendor and a second driver (AMD RX 6700 XT, 26.10.1) to the NVIDIA result. I added it to the PR text and to the debt entry (head 74c272e4e0).

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

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

Pull request Conflicting files (lines on main) Same exports Same new files
PR 10351 core/shader/recompiler/Recompiler.cpp L908-909
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp L457-463
PR 15343 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp L370
PR 20519 core/shader/recompiler/Recompiler.cpp L908-909
PR 22424 core/shader/recompiler/Recompiler.cpp L908-909
PR 22692 core/libs/prx/libSceAgcDriver/tests/execution/StencilReplay.cpp L127-131

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5371 docs/dev/debt/shader.md
PR 5609 core/shader/recompiler/Recompiler.cpp
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
docs/dev/debt/shader.md
PR 6280 docs/dev/debt/shader.md
PR 6412 core/shader/recompiler/Recompiler.cpp
docs/dev/debt/shader.md
PR 6488 core/shader/recompiler/Recompiler.cpp
docs/dev/debt/shader.md
PR 6751 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp
PR 7392 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp
docs/dev/debt/shader.md
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
PR 7684 docs/dev/debt/shader.md
PR 7689 core/shader/recompiler/StencilReplay.cpp
PR 9356 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
PR 9387 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
docs/dev/debt/shader.md
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
PR 10359 core/shader/recompiler/Recompiler.cpp
PR 10652 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
docs/dev/debt/shader.md
PR 10867 core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
docs/dev/debt/shader.md
PR 11483 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
docs/dev/debt/shader.md
PR 12324 core/shader/recompiler/Recompiler.cpp
PR 12828 core/shader/recompiler/Recompiler.cpp
PR 12944 core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
docs/dev/debt/shader.md
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
PR 14032 core/shader/recompiler/Recompiler.cpp
PR 14944 core/shader/recompiler/Recompiler.cpp
PR 15548 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
docs/dev/debt/shader.md
PR 16952 core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp
docs/dev/debt/shader.md
PR 17611 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
core/shader/recompiler/Recompiler.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
docs/dev/debt/shader.md
PR 20030 core/shader/recompiler/Recompiler.cpp
PR 20111 core/shader/recompiler/Recompiler.cpp
PR 20187 core/shader/recompiler/Recompiler.cpp

@mrfelek

mrfelek commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@Capmare a run of head 74c272e4e0 on an Ampere card and an older NVIDIA driver: it passes, and the store is needed here too.

Setup: Linux 7.3, Ryzen 9 5950X, RTX 3080 Ti (10de:2208), NVIDIA 615.71.09, Release, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. The loader log shows the layer inserted.

agc_driver_stencil_replay with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1:

  • This head: passes in 3 of 3 runs, and with APS5_NO_GPL=1 too, with no VUID- line.
  • With the store's condition locally set to false (if (false && state.stencilReplayLateStore) in SpirvFlowEmitter.cpp), the shader is still accepted. The test then fails in 3 of 3 runs with a wave branch on a lane predicate sees every lane of the original draw: pixel (0, 0) is 64, expected drawn, the same failure as on your 4070 SUPER.

0x11d01d0900 offline, from a request logged on this card when main refused it:

  • Its capabilities have PhysicalStorageBufferAddresses and Int64 and no StencilExportEXT, so StencilReplayLanesFixed is true.
  • StencilReplaySafe(program, false) is false, StencilReplaySafe(program, true) is true, and StencilReplayNeedsStore is true.
  • A full Recompile of the request stops earlier, at SRT evaluation (descriptor source 2 dword 0). The logged request lacks that descriptor too, so I can't confirm the 5157-word module.

Not checked: the game (on this card the title doesn't reach this draw) and the full agc_driver|shader_recompiler set.

AI-assisted.

@Capmare

Capmare commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@mrfelek your notes in section 3 of notes/ppsa03671 describe the two stops this PR and a follow-up target.

  1. Shader 0x11d01d0900 refused by the replay. This PR keeps early stencil tests only when the lane-set proof passes. Otherwise it adds a never-executed store, so the driver runs the shader on every covered pixel. This avoids the ReadFirstLane and wave-packing dependency you found.
  2. stencil replay supports direct triangle lists without restart, mesh or tessellation. A follow-up branch replays triangle strips. Odd triangles use a front-face flip through dynamic state, so one pipeline serves all passes. It will open after this PR merges.

Could you test this branch on the 3080 Ti with agc_driver_stencil_replay and your game run? I have tested only on an RTX 4070 SUPER, and JJenkx tested on AMD.

@mrfelek

mrfelek commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@Capmare the agc_driver_stencil_replay run on the 3080 Ti is in my comment above: it passes, and fails without the store. Here is the game run: with this PR the title gets past 0x11d01d0900 and stops at the next gap you named, the triangle-list limit.

Arms: A = main 735cac0f0b, B = A + this head 74c272e4e0 (clean merge a0a06a5442). Each arm is relinked and run from its own runtime.

Setup: PPSA03671 01.001.005, Linux 7.3, Ryzen 9 5950X, RTX 3080 Ti (NVIDIA 615.71.09), headless, no input, fresh shader cache, APS5_TRACE_SUMMARY_EVERY=10 only, one run per arm.

arm how the run ends
A at +304 s: [gpu] driver failure: shader 0x11d01d0900 stage 5: ShaderRecompiler::Recompile: stencil reference export emulation requires a replay-safe pixel shader with late tests
B at +300 s, at the same draw: [gpu] driver failure: AGC graphics: stencil replay supports direct triangle lists without restart, mesh or tessellation
  • Up to that draw both arms run alike: about 9.2–9.3 FPS through the logos, 0.11 s frames, 0.06 s GPU per frame.
  • In B, 0x11d01d0900 is prepared at use and no longer refused, so the triangle-strip follow-up is what this title needs next on NVIDIA.

Not checked: the picture, and anything past that draw.

AI-assisted.

@blawesom

Copy link
Copy Markdown
Contributor

Validation run (queue item 56) — PR #18530

Verdict: PASS — focused shader-recompiler/stencil/lane/spirv tests green on base and PR head, no new Vulkan validation IDs, validation layer confirmed inserted on both runs. Pushed to fork as validation/pr-18530.

Environment

  • Machine: CachyOS, kernel 7.3.4-1-cachyos, Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RADV GFX1201, /dev/kfd present); Linux/AMD scoped, single run each side (no repeat/statistical claim).
  • Base: origin/main = a9f2910 (worktree /home/benj/scratch/wt5/base-main, reused read-only, clean, prebuilt build/).
  • PR head: c6ce7fa (worktree /home/benj/scratch/wt5/pr-18530, submodules initialized).
  • PR state re-checked before work: state=OPEN, headRefOid=c6ce7fa25912b7adff4988d685172c2bce7fa027 (matches queue entry).

Build

  • cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON → EXIT=0, 10s (log q56-pr18530-configure.log).
  • cmake --build build --parallel 12 (CMAKE_BUILD_PARALLEL_LEVEL=12, MAKEFLAGS=-j12) → EXIT=0, 351s, 9777 targets (log q56-pr18530-build.log).

Focused tests

  • Pattern (identical matched set in both trees, verified by diff of ctest -N -R listings and sorted name lists): stencil|spirv|lane|request_serializer → 69 tests (q56-pattern.txt, q56-pattern-{base,pr}-names.txt).
  • Command on BOTH trees, identical env, timeout 3600:
    ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_ADD_LAYER_PATH=/home/benj/scratch/vvl-layer VK_LOADER_DEBUG=layer ANYPS5_GPU='AMD Radeon RX 9070 XT' ctest --test-dir build -R 'stencil|spirv|lane|request_serializer' -V
  • Base: EXIT=0, 6s wall, 100% tests passed out of 69, 0 failed, 0 skipped (q56-tests-base.log).
  • PR: EXIT=0, 5s wall, 100% tests passed out of 69, 0 failed, 0 skipped (q56-tests-pr.log).
  • Per-test name+status comparison: identical between base and PR (q56-results-{base,pr}.txt diff empty).

Vulkan validation-layer checks (per AGENTS.md)

  • was not found but was requested by env var VK_INSTANCE_LAYERS: 0 occurrences in both logs (absent, as required).
  • Insert instance layer "VK_LAYER_KHRONOS_validation": present in both logs (67 occurrences each), resolving to /home/benj/.local/opt/vulkan-validation-layers/usr/lib/libVkLayer_khronos_validation.so via VK_ADD_LAYER_PATH=/home/benj/scratch/vvl-layer.
  • VUID-/SYNC-HAZARD/bracketed IDs: none present in either log; per-ID diff (q56-ids-{base,pr}.txt) empty → the change adds no new VUID-/SYNC-HAZARD validation errors. Validation Error/Warning: count 0 in both. (ctest reporting Passed does not by itself prove clean validation; the log grep does here.)

Push

  • git push fork +c6ce7fa25912b7adff4988d685172c2bce7fa027:refs/heads/validation/pr-18530 → new branch validation/pr-18530 on blawesom/AnyPS5.

Limitations

  • Linux + AMD RADV (RX 9070 XT) only; no NVIDIA/AMD-PRO/AMDVLK/Windows coverage. Single iteration per tree — no intermittency or statistical claim. GPU name is a selection request, not an independent hardware measurement. RADV prints its usual "not a conformant Vulkan implementation, testing use only" notice. Logs retained under /home/benj/scratch/logs/ with prefix q56-.

@Capmare

Capmare commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@blawesom thank you for the Linux run on the RX 9070 XT. I added it to the debt entry and the PR body.

The failed relinker jobs come from output_fifo_macos, a relinker test that this PR does not touch.

@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict needs rebase Conflicts with main, rebase needed and removed review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 15, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 16, 2026
@github-actions github-actions Bot added the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 16, 2026
@domx4q

domx4q commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

NVIDIA Linux run with the Khronos validation layer of the current head b6c363763e (merge of main with the uniform ReadFirstLane change); the NVIDIA run in the description was on an earlier head against main a26b7827e1.

Setup: Arch Linux, kernel 7.3.4, GCC 16.2.1 Release, NVIDIA GeForce RTX 4090 (10de:2684), driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head b6c363763e merged with --no-ff onto main e4caa07950 (70a87720f1, clean merge).

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest --test-dir build -R 'stencil|^agc_driver_read_first_lane$' -V
main e4caa07950 this PR
Result 18 of 19 passed, 1 skipped, 0 failed 18 of 19 passed, 1 skipped, 0 failed
agc_driver_stencil_replay, _no_gpl, _unsuppressed passed passed, with the new wave-branch case (stencil replay tests passed)
Insert instance layer "VK_LAYER_KHRONOS_validation" 27 27
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- 0 0

The skipped test is agc_driver_stencil_ref_export on both sides (skipped, the device lacks VK_EXT_shader_stencil_export), as expected on NVIDIA. The other stencil, native depth-stencil and agc_driver_read_first_lane tests pass on both sides. Both logs show Selected GPU name=NVIDIA GeForce RTX 4090.

No new VUID- errors; all focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 16, 2026
# Conflicts:
#	core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cpp
#	core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp
#	core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp
#	core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cpp
@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict and removed needs rebase Conflicts with main, rebase needed labels Nov 17, 2026
@Capmare

Capmare commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@mrfelek @domx4q thank you for the runs on the RTX 3080 Ti and the RTX 4090. I added both to the PR text and to the debt entry (head 25b10fcedb).

@mrfelek your game run shows the title passes 0x11d01d0900 and stops at the triangle-list limit. A follow-up branch that replays triangle strips targets that stop. It opens after this PR merges.

@github-actions github-actions Bot removed the review queue Next in the maintainer review queue: checks pass, no open change request, no conflict label Nov 17, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head SHA: 25b10fc (base: main).
  • Read the PR description, commit list, manifest, and the full diff (11 files).
  • Read one range at head with the reader: core/libs/prx/libSceAgcDriver/tests/execution/StencilReplay.cpp lines 84–135.
  • No build and no tests were run in this review.

Results

Check Result Note
Diff read passed 11 of 11 changed files, as diff hunks
Description vs code passed Lane-set relaxation, store and capabilities match the diff
Build and tests not run Author-reported runs only
Callers at head not run Only one test range read

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgcDriver/tests/execution/StencilReplay.cpp:239: storeDevice holds StencilReplayLanesFixed(...), not a store decision. The final check at line 249 compares store presence with that flag, which only holds if the wave-branch shader fails the strict proof. Renaming the variable to lanesFixed would make that dependency visible.
  • core/libs/prx/libSceAgcDriver/tests/execution/StencilReplay.cpp:134: LastReplayStored is set by any OpConvertUToPtr in the replay module, not only by the reference store. Another device-address conversion would set it too. Matching the exact store sequence would make the check precise.
  • core/shader/recompiler/Recompiler.cpp:909: StencilReplaySafe and StencilReplayNeedsStore run the strict analysis again for each replay shader, and DefineOutputs repeats it. The cost is small, but the result could be computed once and passed along.

Not verified

  • Results on NVIDIA, Intel and llvmpipe are the author's; I did not build or run them.
  • The guard assumes the host writes the reference as 255 or less. The writer is not in the diff, so this is not verified.
  • The claim that fragmentStoresAndAtomics is always required and enabled is not in the diff and was not checked.
  • The claim that the shader cache key holds the capability list was not checked.
  • Callers of StencilReplaySafe outside the changed files were not read.
  • The driver behaviour the change relies on (side-effect shaders run on every covered pixel) cannot be checked from the code here; the debt entry says so.

Sources

  • Repository paths are at head 25b10fc; line numbers refer to that commit.

To get this to a good state

Nothing is required. The non-blocking points above are optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs shader core/shader unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants