Skip to content

fix(shader): export valid-mask colors without branching on EXEC - #14341

Merged
oneandonlydean merged 8 commits into
boykopovar:mainfrom
LeandroLP23:fix/shader-valid-mask-export-unconditional
Nov 14, 2026
Merged

oneandonlydean merged 8 commits into
boykopovar:mainfrom
LeandroLP23:fix/shader-valid-mask-export-unconditional

Conversation

@LeandroLP23

@LeandroLP23 LeandroLP23 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What

On Windows, agc_driver_quad_pixel_mask fails in the implicit-LOD case under a partial quad mask, on both AMD and NVIDIA (#14237). The pixel samples the wrong mip level: level 0 on an RTX 5060 Ti, levels 3 and 4 on a Radeon 860M, where level 2 is expected.

The cause is not the demoted helpers. A pixel export with vm set was stored inside if (exec) { ... }. The sampled value is only used inside that branch, so both Windows drivers move the OpImageSampleImplicitLod into it, out of uniform control flow, and the derivatives lose the neighbouring lanes. I checked this by editing the generated SPIR-V by hand on both GPUs:

Variant of the mask-2 module Radeon 860M RTX 5060 Ti
as generated levels 3 / 4 level 0
OpDemoteToHelperInvocation removed levels 3 / 4 -
demote and both OpKills removed levels 3 / 4 -
export branch condition replaced by true level 2 level 2

The fix keeps the EXEC semantics but drops the divergent control flow, only where it matters. A pixel program whose result depends on helper lanes either has neighbourLaneReads set (implicit-LOD samples, ImageQueryLod, DPP/swizzle/permute/readlane/ballot, WQM) or reads an offset barycentric (a GetBuiltin of a sample or centre barycentric kind), which goes through InterpolateAtOffset. In such a program, an MRT export without a color merge now stores select(exec, new, previous) unconditionally. previous is the last color the invocation stored to that output, kept in a Private shadow per output, zero-initialized with OpConstantNull, because the packed and reversed-order output specializations only accept whole stores to the Output variable. A lane with EXEC clear therefore keeps its earlier color, including when a later vm export makes it valid again, and the helper-lane reads stay in uniform control flow. Every other pixel export keeps its EXEC branch as on main, and so do targets with a color merge and the alpha-to-coverage store (in its own branch).

New checks:

  • agc_driver_quad_pixel_mask also runs the sequence from review: red to MRT 0 with EXEC set, then green to MRT 0 with vm and EXEC clear, then a NULL vm done export with EXEC set. It expects red. It passes on main, fails on this PR's first version (52fcd28bba, which stored green), and passes now.
  • agc_shader_quad_mask_no_demote checks that the color store of a pixel program with a live cross-lane read (ds_permute with EXEC left at the live lanes) is not nested in any selection or loop construct, with and without a quad mask. That check needs no GPU. It fails with main's emitter and passes here.
  • The same test checks a pixel program that exports its sample barycentrics with off-centre sample locations: the color store must not be nested either. It failed at 20acd940ce, whose check looked for the offset kinds in the program's input list, which records only the base barycentric.

Tested

  • Windows 11, NVIDIA RTX 5060 Ti: full ctest -j 6 with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, main 26fa1212b8 against 81b3d01f31.

  • Windows 11, AMD Radeon 860M: ctest -R '^(agc_|shader)' (1,217 tests) on 81b3d01f31, same environment.

    • agc_driver_quad_pixel_mask and agc_shader_quad_mask_no_demote pass.
    • 5 fail: agc_driver_mesh, agc_driver_msaa_dcc_srgb_clear_2/4/8 and agc_driver_sample_order_grid_reference. They fail the same way with main's SpirvModuleEmitter.cpp.
    • No VUID- lines, and the layer was loaded.
  • Windows 11, NVIDIA RTX 5060 Ti (621.01), head d35348be5e on main b611e634f7: agc_driver_quad_pixel_mask and agc_shader_memory with the same environment. main: the quad mask test fails; this PR: both pass. The layer was loaded and there are no VUID- lines.

  • Independent runs:

    • DonRyuzaki, Windows, RX 7800 XT (AMD 26.10.1), d35348be5e with fix(agc): bind the sample order depth set after its pipeline #9503 on main c3a5290c7d: agc_driver_sample_order_grid_reference passes 3 of 3 (0 color and 0 depth samples differ), where fix(agc): bind the sample order depth set after its pipeline #9503 alone leaves 42 color samples. agc_driver_quad_pixel_mask passes on main and on this head there.
    • Superseabas, Windows 11, 81b3d01f31: the RTX 5070 Ti (621.01) fails on main and passes with this PR; the Ryzen 7 7700X iGPU (RDNA 2, AMD 24.30.18) passes on both. No VUID- lines.
    • TechLevelZero's NVIDIA bot, RTX 2000 Ada on Linux: 0 new failures and no new validation IDs.

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: Fixes AGC: agc_driver_quad_pixel_mask samples the wrong mip level under a partial quad mask on Windows (RTX 5060 Ti and Radeon 860M) #14237
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5060 Ti, driver 621.01 (32.0.16.2101), Windows 11; AMD Radeon 860M, driver 32.0.13058.8001, Windows 11 (also RTX 5070 Ti and Ryzen 7 7700X iGPU on Windows, and RTX 2000 Ada on Linux, from other contributors)
  • AI-assisted: yes (Claude Code)

@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

The unconditional store is sound on the paths I read: a lane with a clear valid mask is killed at every return unless it is a helper invocation, so its stored value is discarded. One non-blocking question remains about helper invocations.

What I ran

Reviewed head 25eb2a4c36d8d62f6567161fc0e7f0842c256824 against base 26fa1212b82f76dd49cf12d65e445d6ff3e0844c; the precheck merge preview is clean. Environment: Linux x86-64, Python 3.11. I read the full diff and the emitter paths listed under Sources at this head. No local build or shader test was run.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14341
python3 -I tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 26fa1212b82f76dd49cf12d65e445d6ff3e0844c --head 25eb2a4c36d8d62f6567161fc0e7f0842c256824 --json
python3 -I tools/pr_test_quality.py --root <git archive of 25eb2a4c36: core/libs, core/shader, docs/dev/debt> --json core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp

The precheck's ABI and test-quality helpers were missing from the PR head tree, so I ran both by hand from the main checkout.

Results

Check Result
git diff --check, conventions and PR template (precheck) Passed
Live dependency and mergeability (precheck) Passed
ABI audit (by hand) Not applicable: no export declaration changed
Test quality (by hand) One possible-unregistered-cpp-test finding for core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp; false positive, the file is registered in core/libs/prx/libSceAgcDriver/tests/cmake/agc_shader_memory_tests.cmake
Build and the AGC shader tests Not run (no-build protocol)
conventions_and_pr_template, unedited precheck output
All conventions checks passed.

Findings

Blocking

None found.

Non-blocking

  1. Helper invocations. EmitKillIfPixelValidMaskInactive keeps a helper invocation alive even when its valid mask is clear (SpirvFlowEmitter.cpp#L30-L45). Such a lane now executes the unconditional store, where the EXEC branch previously skipped it. Please state why a value written by a helper lane is not observable on the target, or cover that case in the GPU evidence. This is a question, not a request for a change.

Sources

Not verified

  • The GPU results in the PR (Radeon 860M and RTX 5060 Ti) are author-reported; I did not reproduce them.
  • The build, the AGC shader tests, and the hosted Windows, macOS and relinker jobs (queued or running at review time).
  • The helper-invocation question above.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

The terminal valid-mask export case makes sense, but the new condition also removes EXEC guarding from a nonterminal VM color export. A later VM export can make that lane valid again.

AMD’s RDNA ISA, section 11.2.1, says that EXEC gates each export’s data write, exports accumulate, and the final VM export supplies the valid mask: https://docs.amd.com/api/khub/documents/mU0vhV4IgdmIWSgRqlt70g/content

For one lane, with no color merge:

  1. With EXEC set, export red to MRT 0 without VM.
  2. Clear EXEC and export green to MRT 0 with VM, without DONE.
  3. Set EXEC and issue a NULL export with VM and DONE.

The final mask keeps the lane, but step 2 must not replace its red output. On 25eb2a4c36, SpirvModuleEmitter.cpp:2271–2276 stores green unconditionally at step 2; the NULL export then updates the mask before returning. The visible result becomes green. The existing branch keeps red.

Could you restrict this optimization to exports proven safe with respect to the final valid mask, or preserve inactive lanes’ previous output without divergent control flow, and add this repeated-VM/NULL-reactivation regression? Please retain the implicit-LOD fix and the EXEC guard for color-merge writes. The new structural test checks only one quad mask and a terminal export, so it cannot catch this sequence.

This finding comes from the exact source and an ISA schedule model; I have not executed this sequence through the C++ emitter or on a GPU.

@github-actions github-actions Bot added shader core/shader agc libSceAgc* labels Nov 1, 2026
@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Thanks, both.

oneandonlydean: you're right, the first version broke that schedule. Changed in a87ddedfd1 and 81b3d01f31:

  • No divergent branch, EXEC still respected. A pixel MRT export without a color merge now stores select(exec, new, previous) unconditionally. previous is the color the invocation last stored to that output, kept in a Private shadow per output. I first loaded it back from the Output variable (a87ddedfd1), but the packed and reversed-order output specializations refuse anything other than whole stores, so 8 color-target tests failed. The shadow keeps the Output variable whole-stored.
  • Branches kept: color-merge writes keep their EXEC branch, and the alpha-to-coverage store gets its own branch around only that store.
  • Regression test: agc_driver_quad_pixel_mask now runs your sequence (red with EXEC set, green with vm and EXEC clear, NULL vm done with EXEC set) and expects red. It passes on main, fails on 52fcd28bba (green), and passes on 81b3d01f31. The implicit-LOD case still passes on both GPUs.

MarcZX10: a helper's store to an Output variable only changes that invocation's own copy; a helper never writes a fragment to the attachments. With the select, a demoted helper's EXEC bit is clear, so it keeps its previous color anyway.

Results for 81b3d01f31 are in the description. RTX 5060 Ti, full suite against main: no new failure, and agc_driver_quad_pixel_mask now passes. Radeon 860M, 1,217 agc_/shader tests: only the 5 that also fail with main's emitter. 0 VUID- lines on both.

AI-assisted: yes (Claude Code)

@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Another data point: this also clears the remaining failure of agc_driver_sample_order_grid_reference in #12277 on the Radeon 860M. With #9503 applied on top, it passes 3 of 3; with #9503 and main's emitter it fails 3 of 3 on the same 42 color samples #12277 describes (the AMD interpolateAtOffset under if (!gl_HelperInvocation) case). Details in #12277.

AI-assisted: yes (Claude Code)

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

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 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 6412 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 6488 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 7642 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 7684 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 8004 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 9356 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 9387 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 10193 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 10359 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 10652 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 10757 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 11483 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 11551 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 12324 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 12828 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 13928 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 13929 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 14217 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 14218 core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 14944 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
PR 15548 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 17056 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
PR 17611 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp
PR 18390 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 81b3d01 merged onto main a644edf · tested 2026-11-01 11:26 UTC · 23 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,431 passed · 4 failed (0 new, 3 also fail on main, 1 unstable on main) · 45 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,480 of 3,148 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (931 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ agc_driver_graphics_maps_fallback 30.3 s, ⚠️ agc_driver_graphics 30.1 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 1 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (5 IDs in 484 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (484 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 476 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Skipped (45)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fps_limit: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_o
Reproduce
git fetch origin 81b3d01f318f04101ec772ab112e9d42a1d3451a a644edf30c501a612d06f17d05ef1b7051350cef
git checkout a644edf30c501a612d06f17d05ef1b7051350cef && git merge --no-ff 81b3d01f318f04101ec772ab112e9d42a1d3451a
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@Superseabas

Copy link
Copy Markdown
Contributor

Tested on Windows with two more GPUs: the fix clears the failure on an RTX 5070 Ti, and the integrated Radeon of a Ryzen 7 7700X passes before and after.

main f2d874c1fd, and the PR head 81b3d01f31 merged onto it (bc2a3cafb1). Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -R '^agc_driver_quad_pixel_mask$' -V, 3 runs each, with ANYPS5_GPU selecting the device (confirmed by the Selected GPU line).

GPU Driver main PR
NVIDIA GeForce RTX 5070 Ti (10de:2c05) 621.01 fails 3 of 3: implicit-LOD sample with quad pixel mask 2: pixel (1, 0) channel 0 is 32, expected 96 passes 3 of 3
AMD Radeon Graphics, Ryzen 7 7700X iGPU (1002:164e, RDNA 2) AMD 24.30.18 (32.0.13018.6) passes 3 of 3 passes 3 of 3
  • agc_shader_memory, which holds the new no-nested-store check, passes on the PR with both devices selected.
  • The validation layer loaded (Vulkan SDK 1.4.363.0, confirmed with VK_LOADER_DEBUG=layer). No log contains was not found but was requested by env var VK_INSTANCE_LAYERS, and none reports a VUID- error, on main or the PR.

For #14237: unlike the Radeon 860M, this RDNA 2 iGPU on AMD's Windows driver samples level 2 on main, so the wrong level does not show on every AMD Windows device.

AI-assisted: yes (Claude Code)

@CnRJay CnRJay 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.

The diagnosis is clear: sinking the sample into the EXEC branch is what breaks the derivatives, and the table of hand-edited modules shows it. The fix is wider than the bug, though, and the PR carries no cost figure for that.

1. It applies to every pixel shader, not only to the shaders that hit the bug. preserveInactive is stage == Pixel && kind == Mrt && no merge for the target. Nothing in it looks at vm, a quad mask, or an implicit-LOD sample. So every ordinary pixel export in every title now gets a Private shadow variable, an OpLoad of it, a 4-wide OpCompositeConstruct of EXEC, an OpSelect, and two stores, where before it had one branch. In the common case (EXEC set for the whole shader, a single export) a driver compiler can usually fold the select away, but only if it can prove EXEC is uniform. The shader here reads EXEC as a runtime value, so on a shader that does s_mov exec or wave-mask work before the export the compiler keeps 4 v_cndmask per export per target and an extra live range. With 8 MRTs that is 32 selects per pixel. The new agc_shader_quad_mask_no_demote test counts nesting, not instructions, so it does not show either.

Please restrict preserveInactive to the cases that need it: a program with a quad mask or demote, an export with vm, or a program that samples with implicit LOD after an EXEC change. Everything else keeps the branch it has on main. If you want it unconditional, show the cost.

2. The SPIR-V and pipeline compile-time cost is not measured. The description tests correctness on four GPUs and runs the full suite, but gives no figure for SPIR-V size or pixel-stage compile time. A before/after of spirv-dis | wc -l and Driver.Draw.prepare ms per frame on one pixel-heavy scene would settle it. Pipeline compile time matters on a cold cache, where every pixel variant is compiled at the first draw.

3. Uninitialized shadow. The first export reads the Private shadow before any store. That is undefined, so a lane with EXEC clear on the first export gets an undefined color, where main's branch left the output undefined as well. Fine for correctness, but state that the previous value is only meaningful after a store, and consider an OpConstantNull initializer so drivers can fold the first select when EXEC is a known constant.

@LeandroLP23
LeandroLP23 force-pushed the fix/shader-valid-mask-export-unconditional branch from 81b3d01 to 20acd94 Compare November 1, 2026 21:04
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 20acd94 merged onto main 93dbd0f · tested 2026-11-02 05:35 UTC · 19 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,443 passed · 4 failed (0 new, 3 also fail on main, 1 unstable on main) · 45 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,492 of 3,165 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (930 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ agc_driver_graphics 34.4 s, ⚠️ agc_driver_graphics_maps_fallback 33.8 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 1 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (5 IDs in 484 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (484 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 476 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
VUID-VkShaderModuleCreateInfo-pCode-08737 (1 test): agc_driver_image_sample_derivatives
Skipped (45)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_eop_main: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_fps_limit: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_o
Reproduce
git fetch origin 20acd940ce94896ade451a0dc142e28c9244ecc3 93dbd0f82aea684e95f15f06e7d42c0064af18cf
git checkout 93dbd0f82aea684e95f15f06e7d42c0064af18cf && git merge --no-ff 20acd940ce94896ade451a0dc142e28c9244ecc3
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@LeandroLP23

LeandroLP23 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks, @CnRJay. Changed in 99cc751eb4 and 20acd940ce, rebased onto main:

  1. Scope. The select now applies only to pixel programs whose result depends on helper lanes: neighbourLaneReads (implicit-LOD samples, ImageQueryLod, DPP/swizzle/permute/readlane/ballot, WQM), or an offset barycentric input, which goes through InterpolateAtOffset. Every other pixel export keeps its main EXEC branch, so the common case has no shadow, select or extra store. I didn't narrow it to quad-mask/demote programs only: the interpolateAtOffset case in AGC: agc_driver_sample_order_grid_reference on RX 9070 GRE (RDNA 4, Windows): the exact path loses odd-row depth, with or without APS5_NO_GPL #12277 has no quad mask, and the same branch is what AMD's driver mishandles there. With fix(agc): bind the sample order depth set after its pipeline #9503, that test passed on the Radeon 860M with the earlier, unnarrowed head (81b3d01f31). The narrowed version should still cover it through the offset-barycentric condition, but I haven't rerun that pairing.
  2. Cost. With the narrowing, unaffected pixel shaders compile to the same SPIR-V as on main, so there's nothing to measure for them. In an affected shader, each MRT export without a merge trades a selection construct (merge, conditional branch, two blocks) for one load, one 4-component construct, one select and one more store. I haven't timed pipeline compiles on a title scene; I have no title to run here.
  3. Shadow initialization. The shadow is now initialized with OpConstantNull, through the existing DefineInitializedGlobalVariable.

The structural test now uses a pixel program with a live cross-lane read (ds_permute, EXEC left at the live lanes). The constant-EXEC shaders it used before never had the branch, even on main. It fails with main's emitter and passes here.

On the RTX 5060 Ti, full ctest with the validation layer, main 5bae1a4bc2 against 20acd940ce: main fails agc_driver_quad_pixel_mask and agc_driver_vulkan_test_device_no_driver; this head fails only the second (#14069). 0 VUID- lines on either. On the Radeon 860M, the quad-mask, packed, uint, reversed-order and agc_driver_graphics tests pass; the full agc_/shader run there is still going, and I'll add it.

AI-assisted: yes (Claude Code)

@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Radeon 860M (AMD 32.0.13058.8001, Windows 11) on 20acd940ce: ctest -R '^(agc_|shader)', 1,219 tests, validation layer loaded, 0 VUID- lines. agc_driver_quad_pixel_mask and agc_shader_quad_mask_no_demote pass. 5 fail, the same ones as on main on this GPU, each tracked: agc_driver_mesh (#14376), agc_driver_msaa_dcc_srgb_clear_2/4/8 (#14380), and agc_driver_sample_order_grid_reference (the depth part #9503 fixes).

AI-assisted: yes (Claude Code)

@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; the valid-mask export path has no hosted run of its execution test

This PR changes how the SPIR-V emitter writes pixel exports when the shader reads helper lanes. Inactive lanes now keep their previous value through a private shadow variable, instead of branching on EXEC. The Windows run passed three shader cases, but the execution test for this path, QuadPixelMask.cpp, is a stub on Windows and did not run. I read the production change in full.

What I ran

  • Head 20acd940ce94896ade451a0dc142e28c9244ecc3; base 5bae1a4bc2cffc66c13e37ce8e63ae48b1b5dd1e. 4 files, +68/-3: SpirvBackend/src/SpirvModuleEmitter.cpp (+35/-, the export path), SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp (+1), libSceAgcDriver/tests/ShaderMemory.cpp (+28), and libSceAgcDriver/tests/execution/QuadPixelMask.cpp (+7).
  • Read the SpirvModuleEmitter.cpp change in full. When a pixel MRT export is not merged and the shader reads neighbour lanes or non-barycentric inputs, the export writes through a private Select between the new value (active lanes) and the previous value (inactive lanes). The shadow variable is added to the interface list only for SPIR-V 1.4 and later. Otherwise the code keeps the original EXEC branch.
  • Read the ShaderMemory.cpp additions by their names only, and QuadPixelMask.cpp by its names only.
  • Hosted, Windows CTest: 21 of 21 passed. agc_shader_quad_mask_no_demote (Test #1909), agc_shader_result_memo_budget_masked (Test #1913), agc_shader_table_snapshot_reuse_unmasked (Test #1904) and agc_shader_memory (Test #1917) passed. The QuadPixelMask execution test does not appear in the run; on Windows it is a stub unless it is listed in ANYPS5_AGC_EXECUTION_TESTS, and it is not.
  • Read-only checks from the trusted main checkout: diff check and conventions passed. ABI audit not applicable. Stack check: clean, no declared dependencies, no errors.
  • No MarcZX10 review at this head.

Results

Check Result Note
Diff check passed
Conventions and PR template passed conventions check from the main checkout
Mergeability and dependencies passed stack check: clean; no declared dependencies
ABI audit not applicable no export changed
Four shader cases (hosted, Windows) passed Test #1904, #1909, #1913, #1917
QuadPixelMask execution test (the changed path) not verified an execution stub on Windows; no case in the run
Export path in SpirvModuleEmitter.cpp (read) passed by reading the shadow-variable path is as described; no blocking defect found
Behaviour on hardware and the SPIR-V validator not verified not run here
Negative controls not run no local build
Read-only check output

Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: not applicable. Stack check: clean, no declared dependencies, no errors. Hosted: gh api repos/boykopovar/AnyPS5/commits/20acd940ce94896ade451a0dc142e28c9244ecc3/check-runs, and the Windows job log (21 of 21).

Negative control

Not run here. A negative control needs a local build and run of the execution test, and code from this head is not run here.

Findings

Blocking

None from the code read.

Non-blocking

  • The execution test that covers the new path (QuadPixelMask) did not run on Windows. The hosted shader cases that passed do not exercise the valid-mask export on a helper-lane shader. A run of QuadPixelMask on a host that builds the execution tests would close that gap.
  • The shadow variable is a private global that is written on every masked export. Its cost on large shaders was not measured.

Sources

Not verified

  • The QuadPixelMask execution test (stub on Windows).
  • The new path's behaviour on hardware and under the SPIR-V validator.
  • The bodies of the ShaderMemory.cpp additions.

To get this to a good state

  • Nothing blocking. Run QuadPixelMask at this head in hosted CI, or add it to the Windows execution list.

@JJenkx

JJenkx commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Windows check of exact head 20acd940ce on an AMD RDNA 2 card. This driver passes agc_driver_quad_pixel_mask without the fix too (main 0cc3899f69), so this checks that the change keeps a driver that never failed correct.

Setup: Windows 11 Enterprise 10.0.22621, Radeon RX 6700 XT, AMD proprietary driver 26.10.1, WinLibs GCC 15.2.0 UCRT r7, Release. Runs went through the shared GPU queue with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1.

  • agc_driver_quad_pixel_mask: 3/3 pass, quad pixel mask tests passed (demote to helper invocation), no VUIDs.
  • Full suite once (3,280 tests, layer inserted 1,096 times): 3,231 pass and 20 skip.
    • 28 of the 29 failures also fail on main 0cc3899f69 on this machine: 26 video_out_flip_* that need a display (it was off, VK_ERROR_SURFACE_LOST), agc_driver_sample_order_grid_reference and ngs2_pitchshift.
    • The 29th was a 20 s CTest timeout of the Python annotate_module test, outside this change. It then passed 3/3 on the same build in about 5 s.
    • The VUIDs are the same three main reports here.

@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Thanks, @MarcZX10 and @JJenkx.

On the execution test: the hosted Windows runners have no GPU, so agc_driver_quad_pixel_mask would skip there even if QuadPixelMask were in ANYPS5_AGC_EXECUTION_TESTS. It has run with a real device at this head or its rebased equivalent:

  • TechLevelZero's NVIDIA CI (RTX 2000 Ada, Linux): passed, 0 new failures.
  • RTX 5060 Ti (Windows, 621.01): full suite, fails on main and passes with the change.
  • Radeon 860M (Windows): fails on main and passes with the change, 0 VUID- lines.
  • RX 6700 XT (Windows, JJenkx above): 3/3, a driver that never failed stays correct.
  • Superseabas's RTX 5070 Ti and 7700X iGPU, on the earlier head.

All of these ran with VK_LAYER_KHRONOS_validation loaded, which includes SPIR-V validation of the emitted modules.

On cost: the shadow is one Private vec4 per MRT target, only in pixel programs that read helper lanes or an offset barycentric. Every other shader keeps the main code. I have not measured large shaders; drivers normally keep such a Private variable in registers.

AI-assisted: yes (Claude Code)

@sharveshprabhu

Copy link
Copy Markdown
Contributor

@LeandroLP23 on whether the narrowed head still covers #12277: on a Radeon 780M it doesn't. With #9503, 20acd940ce leaves the same 42 colour samples, and the earlier 81b3d01f31 clears them.

Radeon 780M (RDNA 3 integrated), AMD 26.10.2 (32.0.32015.12012), Windows 11, WinLibs GCC 15.2.0 r7, Release. main 5b1d381d5a + #15015 + #9503 ddffce8428, each #14341 head applied as its diff. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, 5 runs each:

agc_driver_sample_order_grid_reference Result Exact path vs reference
#9503 only 0 of 5 42 color, 0 depth
#9503 + 20acd940ce (current) 0 of 5 42 color, 0 depth
#9503 + 81b3d01f31 (earlier) 5 of 5 0 color, 0 depth

agc_driver_sample_order and _recipe_depth_locations pass 5 of 5 in all three. With VK_LAYER_KHRONOS_validation loaded, no VUID- lines.

So the readsHelperLanes condition from 99cc751eb4 doesn't seem to select this test's reference shader. I haven't checked which input it declares.

AI-assisted: yes (Claude Code)

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 20acd94 merged onto main b11c7bf · tested 2026-11-04 18:41 UTC · 19 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,752 passed · 10 failed (0 new, 7 also fail on main, 3 unstable on main) · 60 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,822 of 3,894 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (975 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.3 s, ⚠️ public_headers 80.5 s, ⚠️ agc_driver_array_layer_target 33.0 s, ⚠️ agc_driver_depth_clear_hle 32.9 s, ⚠️ agc_driver_image_sample_unnormalized 32.1 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_depth_fast_clear_submit: failed in 2 of the last 10 main runs
agc_driver_pipeline_journal: failed in 8 of the last 10 main runs
guest_pthread_start: failed in 1 of the last 10 main runs
Failing on main too (7, not counted against this PR)
agc_driver_image_table
agc_driver_native_depth_bda_clear
agc_driver_native_multisample_depth
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (8 IDs in 549 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (549 tests): agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, and 541 more
VUID-vkCmdCopyImage-srcImage-01548 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_srgb8_color_target
VUID-VkSamplerCreateInfo-addressModeU-01079 (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeU-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeV-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeW-parameter (1 test): agc_driver_image_gather_volume
Skipped (60)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_idle_publish_wait: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a forced watch of the import reads its submissions as CPU stores
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_storage_pending_key_refresh: skipped, refreshes over a pending key store are not testable here
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platf
Reproduce
git fetch origin 20acd940ce94896ade451a0dc142e28c9244ecc3 b11c7bf84f5d2f636ff60166cc3371bd071e24d5
git checkout b11c7bf84f5d2f636ff60166cc3371bd071e24d5 && git merge --no-ff 20acd940ce94896ade451a0dc142e28c9244ecc3
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

LeandroLP23 and others added 6 commits November 4, 2026 21:54
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…instead of storing it unconditionally

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… copy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…read no helper lanes and zero-initialize the shadow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cross-lane read

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Thanks @sharveshprabhu, that was a bug in 99cc751eb4. Its check looked for a sample or centre barycentric kind in the program's input list, but ShaderInfoCollector records those reads under the base BaryCoordSmooth / BaryCoordNoPerspective input, so the check never matched and only neighbourLaneReads selected the select path.

Fixed in d35348be5e, rebased onto main b611e634f7: the SPIR-V analysis now flags GetBuiltin reads of an offset barycentric (offsetBarycentricReads), and the emitter uses that. agc_shader_memory adds a GPU-free check with a pixel program that exports its sample barycentrics under off-centre sample locations: the color store must sit outside any selection. It fails at 20acd940ce and passes now.

On the RTX 5060 Ti (621.01), agc_driver_quad_pixel_mask still fails on main and passes with the PR, and agc_shader_memory passes, with the validation layer loaded and no VUID- lines. I can't run your 780M pairing with #9503 here. If you can rerun agc_driver_sample_order_grid_reference at d35348be5e, that would confirm it matches 81b3d01f31 again.

AI-assisted: yes (Claude Code)

@DonRyuzaki

Copy link
Copy Markdown
Contributor

Windows AMD RX 7800 XT data point for exact head d35348b, merged alone into main b611e63 (local merge f3b4212671f09d1be425c879e5f5ce4700d76d72, clean tree).

Windows x64 build 26300.9711, AMD driver 26.10.1 (LLPC), Vulkan 1.4.359, WinLibs GCC 15.2.0 UCRT, Release. agc_driver_quad_pixel_mask passed on both main and this head; agc_shader_quad_mask_no_demote also passed on this head. Logs selected AMD Radeon RX 7800 XT (1002:747e). This card passed the quad-mask test on main, so this is regression coverage rather than a reproduction of the reported failure.

I ran ctest --test-dir R:/b-latest -V with ANYPS5_GPU=7800 XT, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. The layer loaded from Steam's CEF bundle. It uses older Vulkan headers and reports VUID-VkDeviceCreateInfo-pNext-pNext for unknown extension structs on both main and this head; no additional VUID ID appeared. That limits the validation conclusion. AI-assisted local test; no game or FPS claim.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head d35348b merged onto main b611e63 · tested 2026-11-04 22:26 UTC · 18 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,789 passed · 8 failed (0 new, 7 also fail on main, 1 unstable on main) · 58 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,855 of 3,946 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (976 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 121.0 s, ⚠️ agc_driver_image_sample_unnormalized 59.9 s, ⚠️ agc_driver_lazy_resolved_abi 52.0 s, ⚠️ agc_driver_stream_copy 51.0 s, ⚠️ agc_driver_sdwa_integer_selectors 45.7 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 9 of the last 10 main runs
Failing on main too (7, not counted against this PR)
agc_driver_image_gather_volume
agc_driver_image_table
agc_driver_native_depth_bda_clear
agc_driver_native_multisample_depth
agc_driver_submit_progress
agc_submit_progress
agc_submit_progress_no_timeline
Passed on retry (1, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)
agc_driver_sgpr_pattern_fill_keys: Failed in the parallel run; also passed only on retry in 6 other runs in the last 7 days
Validation IDs already present on main (4 IDs in 556 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (556 tests): agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, and 548 more
VUID-vkCmdCopyImage-srcImage-01548 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (58)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_idle_publish_wait: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a forced watch of the import reads its submissions as CPU stores
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in cur
Reproduce
git fetch origin d35348be5edf44c89dbe31cc33b5b303dccc34f2 b611e634f7fc024f0c13e342d96de744448ef1d9
git checkout b611e634f7fc024f0c13e342d96de744448ef1d9 && git merge --no-ff d35348be5edf44c89dbe31cc33b5b303dccc34f2
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@DonRyuzaki

Copy link
Copy Markdown
Contributor

RX 7800 XT follow-up to the request to retest the narrowed head: d35348be5e does clear the 42 remaining color samples in agc_driver_sample_order_grid_reference when paired with #9503. This is the discrete RDNA 3 card on which I previously reported only quad-mask regression coverage; that earlier run did not test this pairing.

I built three successive, clean local source trees with the same Release/WinLibs GCC 15.2 UCRT toolchain. The baseline is upstream main c3a5290c7d; the #9503 arm adds its public head ddffce8428 (local merge 7a08d45f33); the final arm adds this PR's public head d35348be5e (local merge 27a8d28e5b). No source edits beyond those two PRs. Windows x64 26300.9711, RX 7800 XT (1002:747e), AMD driver 26.10.1 (LLPC), Vulkan 1.4.359. The logs explicitly select this GPU. I ran the registered CTest case separately and serially with ANYPS5_GPU=7800 XT, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.

Source tree agc_driver_sample_order_grid_reference Exact path vs reference, each run
main c3a5290c7d 0/2 pass 402 color, 2,048 depth samples differ
main + #9503 0/2 pass 42 color, 0 depth samples differ
main + #9503 + #14341 d35348be5e 3/3 pass 0 color, 0 depth samples differ

The #9503 arm's 42-color result also repeats with the validation layer disabled, so that residual is not introduced by this older layer. With both PRs, the other registered sample-order cases (agc_driver_sample_order, _recipe_depth_locations, _planning) pass once each; agc_driver_quad_pixel_mask also passes once. This directly checks the updated offset-barycentric detection in this PR on an affected RDNA 3 GPU. It supports the pairing, but does not claim either PR alone makes the grid test pass here or measure a game/FPS change.

Validation limitation: the available layer comes from Steam CEF and uses Vulkan header version 284. It loads, but it reports VUID-VkDeviceCreateInfo-pNext-pNext for newer extension structures on all GPU arms, so I cannot claim a clean VUID run. I found no additional VUID ID in the paired arm. The bit-exact color/depth results and the no-layer repeat are independent of that warning.

AI-assisted local test; source, build and CTest logs are retained locally.

@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Thanks @DonRyuzaki, that's the pairing I couldn't run: with #9503, d35348be5e clears the 42 colour samples on your RX 7800 XT, as 81b3d01f31 did on the 780M. I added it to the description.

AI-assisted: yes (Claude Code)

@sharveshprabhu

Copy link
Copy Markdown
Contributor

@LeandroLP23 confirmed on the Radeon 780M: with #9503, d35348be5e clears the 42 colour samples again, the same as 81b3d01f31.

Same setup as before (780M, AMD 26.10.2, main 5b1d381d5a + #15015 + #9503 ddffce8428), with this PR's own commits from b611e634f7 to d35348be5e applied:

  • agc_driver_sample_order_grid_reference: 5 of 5, the exact path differs from the reference in 0 color and 0 depth samples.
  • agc_driver_sample_order and _recipe_depth_locations: 5 of 5 each.
  • With VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (LunarG SDK 1.4.363, insert logged), -R '^agc_driver_sample_order.*$' passes 4 of 4 with no VUID- lines.

AI-assisted: yes (Claude Code)

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head d35348b merged onto main acac7c8 · tested 2026-11-05 06:19 UTC · 27 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,805 passed · 5 failed (0 new, 3 also fail on main, 2 unstable on main) · 55 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,865 of 3,960 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (986 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ public_headers 30.9 s
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 3 of the last 10 main runs
agc_driver_submit_progress: failed in 2 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (9 IDs in 556 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (556 tests): agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, and 548 more
VUID-VkShaderModuleCreateInfo-pCode-08737 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkShaderModuleCreateInfo-pCode-08739 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkShaderModuleCreateInfo-pCode-08741 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
VUID-VkPipelineShaderStageCreateInfo-module-parameter (1 test): agc_driver_float16_unused_nan_payloads
VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849 (1 test): agc_driver_float16_unused_nan_payloads
Skipped (55)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_disabled: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_four_k: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_height_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_limit: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_malformed: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_width_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver
Reproduce
git fetch origin d35348be5edf44c89dbe31cc33b5b303dccc34f2 acac7c854182a1674162f5e623aa25a6469985ae
git checkout acac7c854182a1674162f5e623aa25a6469985ae && git merge --no-ff d35348be5edf44c89dbe31cc33b5b303dccc34f2
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

…l programs

A pixel program that reads helper lanes stores its MRT color outside the
EXEC branch, so a lane with EXEC clear must store its previous color: a
later valid-mask export can make the lane valid again, and it must then
show the color it exported while active. The structural checks only
looked at where the store is. Require that every color store of the
offset-interpolating and neighbour-reading programs takes its value
from a select between the new and the previous color.

Co-authored-by: LeandroLP23 <92315992+LeandroLP23@users.noreply.github.com>
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @LeandroLP23, I pushed one small commit to your branch, 608b3860c7, on top of d35348be5e. It only adds a test to ShaderMemory.cpp.

Your change keeps an inactive lane's previous color in pixel programs that read helper lanes: the MRT store sits outside the EXEC branch and stores Select(exec, value, previous). Nothing pinned that select, though. ReactivatedPixelCode in QuadPixelMask.cpp reads no helper lanes, so it takes the ordinary EXEC-branch path, and the new structural checks only look at where the store is. With the select replaced by the plain new value, every test still passed.

The commit adds a check next to yours: for the offset-interpolating program and the neighbour-reading program (masked and unmasked), every store to a color output must take its value from an OpSelect. It passes on your head. With the select replaced by the new value, it fails with "a color export of a pixel program that interpolates at an offset does not keep an inactive lane's previous color".

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 608b386 merged onto main 82fcf46 · tested 2026-11-06 05:40 UTC · 20 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,904 passed · 4 failed (0 new, 3 also fail on main, 1 unstable on main) · 56 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,964 of 4,158 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (979 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 1 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (9 IDs in 594 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (594 tests): agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, and 586 more
VUID-VkShaderModuleCreateInfo-pCode-08737 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkShaderModuleCreateInfo-pCode-08739 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkShaderModuleCreateInfo-pCode-08741 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
VUID-VkPipelineShaderStageCreateInfo-module-parameter (1 test): agc_driver_float16_unused_nan_payloads
VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849 (1 test): agc_driver_float16_unused_nan_payloads
Skipped (56)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_net_ctl_disconnected: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_device_capability: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_disabled: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_four_k: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_height_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_limit: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_malformed: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_width_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan de
Reproduce
git fetch origin 608b3860c7c782b1cc79224f08caac22f6adee39 82fcf46d250e0ec2f436ceffd607dd2ff04c62d7
git checkout 82fcf46d250e0ec2f436ceffd607dd2ff04c62d7 && git merge --no-ff 608b3860c7c782b1cc79224f08caac22f6adee39
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@LeandroLP23

Copy link
Copy Markdown
Contributor Author

Thanks, that's a gap I missed. The structural checks pinned where the store sits, not what it stores, so dropping the Select would have passed.

I read 608b3860c7. It only adds outputStoresKeepInactiveColor and the two requires, and the check fits the change: every OpStore to an Output variable must store an OpSelect result, and the lambda requires at least one such store. I haven't built it locally. The NVIDIA run on this head passed with no new failures and no new validation IDs. I'm keeping the commit as it is.

AI-assisted: yes (Claude Code)

@irwanrivaldi

Copy link
Copy Markdown
Contributor

Radeon 860M (RDNA 3.5, 1002:1114), AMD driver 32.0.32015.7029, Windows 11, WinLibs GCC 16.2.0 UCRT, Release, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, no validation layer, so this says nothing about VUIDs.

Tree agc_driver_sample_order_grid_reference
main b11c7bf84f 0 of 5 (402 color, 2048 depth samples differ)
b11c7bf84f + #9503 ddffce8428 0 of 3 (42 color, 0 depth)
b11c7bf84f + #9503 + this PR 608b3860c7 3 of 3

agc_driver_quad_pixel_mask, agc_shader_quad_mask_no_demote and the other three agc_driver_sample_order* tests also pass 3 of 3 on the last tree. One caveat: this head is based on newer main, so that merge also brings in 413 upstream commits, and this run doesn't isolate the 42 samples to this PR alone. Focused tests only, not the full GPU suite. AI-assisted: yes.

@gabichuuuuu gabichuuuuu 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.

A Windows NVIDIA run on a GPU where agc_driver_quad_pixel_mask already passes on main, to check that this change keeps it passing.

Setup: Windows 11 x64, NVIDIA laptop GPU (Turing), driver 610, WinLibs GCC 15.2.0 r7 UCRT, Release, every AGC execution test built. Head 608b3860c7 merged onto main 4e44ed59b2 (clean merge), with main 4e44ed59b2 from the same build directory as the control. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1, Selected GPU was the NVIDIA GPU. No validation layer on this machine.

Tree agc_driver_quad_pixel_mask
main 4e44ed59b2 10 of 10
this PR 10 of 10

No pixel (1, 0) channel 0 is 32, expected 96 on either side. This driver is older than 617.42, which #14237 reports as passing, so it does not reproduce the 621.x failure. It does show that this change does not regress Turing.

AI-assisted: yes.

@Superseabas

Copy link
Copy Markdown
Contributor

Re-test of head 608b3860c7 on the RTX 5070 Ti, which fails agc_driver_quad_pixel_mask on main, and on the Ryzen 7 7700X iGPU.

main e0af82d615, and the PR head merged onto it (f3ef39fd7d, clean merge). Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, with ANYPS5_GPU selecting the device (confirmed by the Selected GPU line). RTX 5070 Ti (10de:2c05, 621.01): 10 runs on each tree. Radeon (1002:164e, AMD 26.10.2, 32.0.21045.20006): 3 runs on each tree.

Test RTX main RTX PR Radeon main Radeon PR
agc_driver_quad_pixel_mask 0 of 10 10 of 10 3 of 3 3 of 3
agc_shader_quad_mask_no_demote 10 of 10 10 of 10 3 of 3 3 of 3
agc_driver_sample_order 10 of 10 10 of 10 3 of 3 3 of 3
agc_driver_sample_order_grid_reference skips skips 0 of 3 0 of 3

Red checks on the merge, 3 runs on each GPU:

Change to SpirvModuleEmitter.cpp agc_driver_quad_pixel_mask agc_shader_quad_mask_no_demote
main's file fails on the RTX with the error above, passes on the Radeon fails on both: "stored inside an EXEC branch"
Store the new color instead of selected, to both the shadow and the output passes on both fails on both: "does not keep an inactive lane's previous color"

Non-blocking note: the second row shows that the new check from 608b3860c7 works, and that agc_driver_quad_pixel_mask doesn't catch this mistake. As I read it, ReactivatedPixelCode reads no helper lanes, so since 69134b4308 it takes the EXEC branch path and never reaches the select. Of these two tests, only the SPIR-V structure check covers the kept color. A draw with the same export sequence in a program that also reads a neighbour lane would check it on a GPU.

Not run: the rest of the AGC suite, on either tree or with either red check.

AI-assisted: yes

@oneandonlydean
oneandonlydean merged commit f838026 into boykopovar:main Nov 14, 2026
15 checks passed
@LeandroLP23
LeandroLP23 deleted the fix/shader-valid-mask-export-unconditional branch November 14, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* fix error Closes an issue (Fixes #N) shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGC: agc_driver_quad_pixel_mask samples the wrong mip level under a partial quad mask on Windows (RTX 5060 Ti and Radeon 860M)