fix(shader): read quad_perm DPP lanes in pixel shaders through quad operations #6290

Merged
jackthereaper2006 merged 2 commits from upstream-pr/6290 into main 2026-11-08 09:07:53 +00:00
jackthereaper2006 commented 2026-10-15 09:13:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jackthereaper2006 on 2026-10-15T09:13:25Z.


What

In a pixel shader, a DPP quad_perm read is now emitted as OpGroupNonUniformQuadBroadcast from each lane of the quad, with the result chosen by the lane's quad_perm entry. This covers the source EXEC check of a DPP move and of a DPP write condition as well as the value. Other DPP controls, other stages and devices without VK_SUBGROUP_FEATURE_QUAD_BIT keep the subgroup shuffle and ballot.

Until now the read was a subgroup shuffle plus a ballot of EXEC. Mesa gives a fragment shader full quads only for quad group operations, or for subgroup operations when the shader requires full quads (RequireFullQuadsKHR) (nir_gather_info.c, needs_full_quad_helper_invocations). On RADV the shuffle and the ballot therefore run without helper invocations, and a DPP read from a helper lane is wrong. The derivatives that ACO builds from DPP quad_perm reads are the visible case.

The same failure shows on AMD's Windows driver (LeandroLP23's run). NVIDIA, Intel ANV Gen9 and lavapipe already keep helpers in the shuffle, so on those drivers the change only moves the read to quad operations.

The device now lists GroupNonUniformQuad when it reports VK_SUBGROUP_FEATURE_QUAD_BIT, and shader validation maps that capability to the bit.

Tested

Linux (CachyOS, kernel 7.2.9), GCC 16.2.1, Release, BUILD_TESTING=ON. Rebased on main 6ef5a1c4c; the only conflict was ShaderMemory.cpp, where verifyFmaskImageMode and verifyPixelQuadPermReads were added at the same place. Runs that name no commit were on main 0afa6a607 before the rebase.

  • PS5 OpenGL Showcase (PPSA99005, catalog release 1.0.2, sha256 37a0ef4e…d388). Its instance pixel shader takes the normal from normalize(cross(dFdx(v_world), dFdy(v_world))) (main.c:259). In the translated program 0x229255000 that becomes the only shader with DPP moves.
    • RADV on main: the 8192 instances render as a white bloom cloud with black specks.

    • RADV with this change: they render as in the author's screenshot.

    • Checks on main:

      • With APS5_SKIP_SHADER=229255000 the rest of the frame is correct.
      • On lavapipe (Mesa 26.2.4) the instances render correctly.
      • RADV_DEBUG=nodcc, nofastclears and zerovram each leave the cloud.
      • Dropping only the ballot check, so the shuffle stays, also leaves the cloud.
    • Frames (APS5_DUMP_FRAMES dumps of the title's own display buffer, 960×540):

      main, RADV main + the fix, RADV
      main, RADV fix, RADV
      main, lavapipe main, RADV, APS5_SKIP_SHADER=229255000
      main, lavapipe main, RADV, instance shader skipped

      Full-size files: https://gist.github.com/jackthereaper2006/aec623dfe08f2a6d8e5207ac3e2a209b. Reference: the author's screenshot.

  • New agc_shader_memory check:
    • With the quad capability, pixel quad_perm reads, with full and partial row masks, use OpGroupNonUniformQuadBroadcast and no shuffle.
    • Without the capability they keep the shuffle.
    • A row shift keeps the shuffle.
    • It fails without the emitter change.
  • New agc_driver_pixel_quad_perm_helpers (5e25bc870, 3dd3a9832 before the rebase): pixel quad_perm DPP reads of helper neighbours after s_wqm, with and without fi, wave64 and wave32. It passes on RADV, fails on RADV with the emitter from main (pixel 584 read 0 from quad_perm [1,0,3,2], its helper neighbour is pixel 585), and skips on lavapipe (8-lane subgroup) and without the quad capability. Whole ctest with it: 1227/1227 with Mesa patched for #5444.
  • Validation layer (on main 6ef5a1c4c, ctest -V -R 'quad|dpp|agc_shader_memory' -E audio_out with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, validation layers 1.4.363):
    • main: 11/11 pass, no VUID- errors.
    • This change: 12/12 pass (the 11 plus agc_driver_pixel_quad_perm_helpers), no VUID- errors.
    • Neither log reports was not found but was requested by env var VK_INSTANCE_LAYERS; VK_LOADER_DEBUG=layer shows the layer inserted at instance and device level.
  • Whole ctest on main 6ef5a1c4c, RADV, stock Mesa 26.2.4: 1776 pass, 32 skip and 7 fail out of 1815. The 7 failures fail the same way with this change's files reverted to main:
    • agc_driver_tessellation: the Mesa crash of #5444.
    • agc_driver_log_near_one, agc_driver_vop1_float_unary, agc_driver_fp16_overflow, agc_driver_float16_result_modifiers: they passed on 0afa6a607 on this machine (e.g. v_log_f32 of 2.0 now returns 25.0).
    • agc_driver_pixel_sample_iteration, agc_idle_publish_wait: new on main since 0afa6a607.
  • Whole ctest on main 0afa6a607:
    • RADV: 1225/1226. The failure is agc_driver_tessellation, the Mesa crash of #5444.
    • The same tests with Mesa 26.2.4 patched for #5444: 1226/1226.
    • ctest -R '^agc_' on lavapipe: 573/573.
    • The 18 skips are the 17 of main d92a8dad3 plus agc_import_watch_other_family, which is new on main and skips because this device has no other queue family.

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: PPSA99005 #6289
  • GPUs tested: AMD Radeon Graphics (RADV RENOIR, Ryzen 5 PRO 5650U iGPU, GCN 5, 0x1638), Mesa 26.2.4, CachyOS Linux 7.2.9; lavapipe, Mesa 26.2.4 (built locally), same machine
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4870932456 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290). Originally posted by [jackthereaper2006](https://github.com/jackthereaper2006) on 2026-10-15T09:13:25Z. --- ### What In a pixel shader, a DPP `quad_perm` read is now emitted as `OpGroupNonUniformQuadBroadcast` from each lane of the quad, with the result chosen by the lane's `quad_perm` entry. This covers the source EXEC check of a DPP move and of a DPP write condition as well as the value. Other DPP controls, other stages and devices without `VK_SUBGROUP_FEATURE_QUAD_BIT` keep the subgroup shuffle and ballot. Until now the read was a subgroup shuffle plus a ballot of EXEC. Mesa gives a fragment shader full quads only for quad group operations, or for subgroup operations when the shader requires full quads (`RequireFullQuadsKHR`) ([`nir_gather_info.c`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-26.2.4/src/compiler/nir/nir_gather_info.c#L915-L934), `needs_full_quad_helper_invocations`). On RADV the shuffle and the ballot therefore run without helper invocations, and a DPP read from a helper lane is wrong. The derivatives that ACO builds from DPP `quad_perm` reads are the visible case. The same failure shows on AMD's Windows driver ([LeandroLP23's run](https://github.com/boykopovar/AnyPS5/pull/6290#issuecomment-6210800506)). NVIDIA, Intel ANV Gen9 and lavapipe already keep helpers in the shuffle, so on those drivers the change only moves the read to quad operations. The device now lists `GroupNonUniformQuad` when it reports `VK_SUBGROUP_FEATURE_QUAD_BIT`, and shader validation maps that capability to the bit. ### Tested Linux (CachyOS, kernel 7.2.9), GCC 16.2.1, Release, `BUILD_TESTING=ON`. Rebased on `main` `6ef5a1c4c`; the only conflict was `ShaderMemory.cpp`, where `verifyFmaskImageMode` and `verifyPixelQuadPermReads` were added at the same place. Runs that name no commit were on `main` `0afa6a607` before the rebase. - **PS5 OpenGL Showcase** (PPSA99005, catalog release 1.0.2, sha256 `37a0ef4e…d388`). Its instance pixel shader takes the normal from `normalize(cross(dFdx(v_world), dFdy(v_world)))` ([`main.c:259`](https://github.com/blackbearreloaded/ps5-opengl/blob/v1.0.2/examples/core46-showcase/main.c#L259)). In the translated program `0x229255000` that becomes the only shader with DPP moves. - RADV on `main`: the 8192 instances render as a white bloom cloud with black specks. - RADV with this change: they render as in [the author's screenshot](https://github.com/blackbearreloaded/ps5-opengl/blob/v1.0.2/docs/images/ps5-opengl-showcase.png). - Checks on `main`: - With `APS5_SKIP_SHADER=229255000` the rest of the frame is correct. - On lavapipe (Mesa 26.2.4) the instances render correctly. - `RADV_DEBUG=nodcc`, `nofastclears` and `zerovram` each leave the cloud. - Dropping only the ballot check, so the shuffle stays, also leaves the cloud. - Frames (`APS5_DUMP_FRAMES` dumps of the title's own display buffer, 960×540): | `main`, RADV | `main` + the fix, RADV | | - | - | | ![main, RADV](https://gist.githubusercontent.com/jackthereaper2006/aec623dfe08f2a6d8e5207ac3e2a209b/raw/39b29d182c14d76d21e8a8e1814247550bc37b0d/main-d92a8dad3-radv.png) | ![fix, RADV](https://gist.githubusercontent.com/jackthereaper2006/aec623dfe08f2a6d8e5207ac3e2a209b/raw/39b29d182c14d76d21e8a8e1814247550bc37b0d/fix-891885201-radv.png) | | **`main`, lavapipe** | **`main`, RADV, `APS5_SKIP_SHADER=229255000`** | | ![main, lavapipe](https://gist.githubusercontent.com/jackthereaper2006/aec623dfe08f2a6d8e5207ac3e2a209b/raw/39b29d182c14d76d21e8a8e1814247550bc37b0d/main-d92a8dad3-lavapipe.png) | ![main, RADV, instance shader skipped](https://gist.githubusercontent.com/jackthereaper2006/aec623dfe08f2a6d8e5207ac3e2a209b/raw/39b29d182c14d76d21e8a8e1814247550bc37b0d/main-skip-229255000-radv.png) | Full-size files: https://gist.github.com/jackthereaper2006/aec623dfe08f2a6d8e5207ac3e2a209b. Reference: [the author's screenshot](https://github.com/blackbearreloaded/ps5-opengl/blob/v1.0.2/docs/images/ps5-opengl-showcase.png). - **New `agc_shader_memory` check:** - With the quad capability, pixel `quad_perm` reads, with full and partial row masks, use `OpGroupNonUniformQuadBroadcast` and no shuffle. - Without the capability they keep the shuffle. - A row shift keeps the shuffle. - It fails without the emitter change. - **New `agc_driver_pixel_quad_perm_helpers`** (5e25bc870, 3dd3a9832 before the rebase): pixel quad_perm DPP reads of helper neighbours after `s_wqm`, with and without `fi`, wave64 and wave32. It passes on RADV, fails on RADV with the emitter from `main` (`pixel 584 read 0 from quad_perm [1,0,3,2], its helper neighbour is pixel 585`), and skips on lavapipe (8-lane subgroup) and without the quad capability. Whole `ctest` with it: 1227/1227 with Mesa patched for #5444. - **Validation layer** (on `main` `6ef5a1c4c`, `ctest -V -R 'quad|dpp|agc_shader_memory' -E audio_out` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, validation layers 1.4.363): - `main`: 11/11 pass, no `VUID-` errors. - This change: 12/12 pass (the 11 plus `agc_driver_pixel_quad_perm_helpers`), no `VUID-` errors. - Neither log reports `was not found but was requested by env var VK_INSTANCE_LAYERS`; `VK_LOADER_DEBUG=layer` shows the layer inserted at instance and device level. - **Whole `ctest` on `main` `6ef5a1c4c`, RADV, stock Mesa 26.2.4:** 1776 pass, 32 skip and 7 fail out of 1815. The 7 failures fail the same way with this change's files reverted to `main`: - `agc_driver_tessellation`: the Mesa crash of #5444. - `agc_driver_log_near_one`, `agc_driver_vop1_float_unary`, `agc_driver_fp16_overflow`, `agc_driver_float16_result_modifiers`: they passed on `0afa6a607` on this machine (e.g. `v_log_f32` of 2.0 now returns 25.0). - `agc_driver_pixel_sample_iteration`, `agc_idle_publish_wait`: new on `main` since `0afa6a607`. - **Whole `ctest` on `main` `0afa6a607`:** - RADV: 1225/1226. The failure is `agc_driver_tessellation`, the Mesa crash of #5444. - The same tests with Mesa 26.2.4 patched for #5444: 1226/1226. - `ctest -R '^agc_'` on lavapipe: 573/573. - The 18 skips are the 17 of `main` `d92a8dad3` plus `agc_import_watch_other_family`, which is new on `main` and skips because this device has no other queue family. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA99005 #6289 - [x] GPUs tested: AMD Radeon Graphics (RADV RENOIR, Ryzen 5 PRO 5650U iGPU, GCN 5, `0x1638`), Mesa 26.2.4, CachyOS Linux 7.2.9; lavapipe, Mesa 26.2.4 (built locally), same machine - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
zaryabzip commented 2026-10-15 11:49:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zaryabzip on 2026-10-15T11:49:12Z.


Windows and NVIDIA run, for the "GPUs tested" line (RADV and lavapipe on Linux only). Windows 11 (26200), RTX 3060 Laptop GPU (NVIDIA 617.42), WinLibs GCC 15.2.0 r7 (UCRT), Release, BUILD_TESTING=ON. Head 891885201 merged onto main 8856f180c (clean); ANYPS5_GPU=3060, and a verbose test log shows the RTX 3060 selected. vulkaninfo lists SUBGROUP_FEATURE_QUAD_BIT for this device, with subgroupQuadOperationsInAllStages = true.

  • agc_shader_memory: passes.
  • With the five non-test files (VulkanDevice.cpp, ShaderValidation.cpp, SpirvSubgroup.hpp, SpirvSubgroup.cpp, SpirvAluEmitterMath.cpp) from main and the PR's test (2 of 2 runs), agc_shader_memory fails: a pixel quad_perm read did not go through quad operations.
  • ctest -R "agc|shader|guest_memory|write_watch" -j4: 591/591 pass with the PR, and 591/591 on main. Both skip the same 3 tests (agc_host_import_sparse, agc_driver_sparse_dma_buf_import, agc_driver_stencil_ref_export).

Not checked: which of the GPU tests above run a pixel shader with a DPP quad_perm read, so the suite result does not show that the quad path ran on NVIDIA. Not run: PS5 OpenGL Showcase, Intel.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191339802 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290#issuecomment-6191339802). Originally posted by [zaryabzip](https://github.com/zaryabzip) on 2026-10-15T11:49:12Z. --- Windows and NVIDIA run, for the "GPUs tested" line (RADV and lavapipe on Linux only). Windows 11 (26200), RTX 3060 Laptop GPU (NVIDIA 617.42), WinLibs GCC 15.2.0 r7 (UCRT), Release, `BUILD_TESTING=ON`. Head `891885201` merged onto `main` `8856f180c` (clean); `ANYPS5_GPU=3060`, and a verbose test log shows the RTX 3060 selected. `vulkaninfo` lists `SUBGROUP_FEATURE_QUAD_BIT` for this device, with `subgroupQuadOperationsInAllStages = true`. - `agc_shader_memory`: passes. - With the five non-test files (`VulkanDevice.cpp`, `ShaderValidation.cpp`, `SpirvSubgroup.hpp`, `SpirvSubgroup.cpp`, `SpirvAluEmitterMath.cpp`) from `main` and the PR's test (2 of 2 runs), `agc_shader_memory` fails: `a pixel quad_perm read did not go through quad operations`. - `ctest -R "agc|shader|guest_memory|write_watch" -j4`: 591/591 pass with the PR, and 591/591 on `main`. Both skip the same 3 tests (`agc_host_import_sparse`, `agc_driver_sparse_dma_buf_import`, `agc_driver_stencil_ref_export`). Not checked: which of the GPU tests above run a pixel shader with a DPP `quad_perm` read, so the suite result does not show that the quad path ran on NVIDIA. Not run: PS5 OpenGL Showcase, Intel. AI-assisted: yes (Claude Code)
screamm commented 2026-10-15 14:16:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-15T14:16:19Z.


Cross-validation on Windows 11 Pro 26220, NVIDIA RTX 4070 (596.21), MinGW GCC 15.2, PR head 891885201 merged on main 3ee537191:

PS5 OpenGL Showcase (PPSA99005, catalog 1.0.1), 90 s per run, ANYPS5_REQUIRE_DISPLAY=1, APS5_DUMP_FRAMES every 30 presents (960x540). The title runs until the limit in every run; no stop line and no error in download0/ps5-opengl.log.

  • Before, main 8856f180c: 379 frames (410 in a second run).
  • After, two cold runs: 228 frames (with a build running alongside) and 283.
  • After, third run back to back with the second before run: 496 frames.

The #6289 symptom (white bloom cloud with black specks over the 8192 instances, RADV) does not occur on NVIDIA main. Before and after, every dump shows the instances as shaded, faceted icosahedra and cubes, as in your fix image. The share of near-white pixels is 1.0-2.3% per dump before and 1.05-2.4% after; your RADV main image has 27.7% and your fix image 1.9%. So this run shows no regression on NVIDIA, not the fix itself. (#6289 returns 404 for me, so the symptom is taken from the PR body.)

The quad path does run here (RTX 4070, subgroup 32). I checked the cold per-run shader cache:

  • main: two of the 31 SPIR-V modules hold 15 OpGroupNonUniformShuffle each.
  • With the PR: the matching two hold 60 OpGroupNonUniformQuadBroadcast each, and no module has a shuffle.
    The 15 reads in the title take no source-EXEC check.

Tests:

  • agc_shader_memory: 3/3.
  • Negative control: with VulkanDevice.cpp, ShaderValidation.cpp, SpirvSubgroup.hpp, SpirvSubgroup.cpp and SpirvAluEmitterMath.cpp from main and your test kept, it fails 2/2 with a pixel quad_perm read did not go through quad operations.
  • DPP/quad subset (19 tests: dpp, quad, swizzle, derivatives, pixel_helper_lanes, wave_reduction, float16_dot, agc_dpp_write, agc_shader_memory), --repeat until-fail:3: 57/57.
  • ctest -R '^agc_driver_' -j1: 446/447, with 2 skipped (sparse_dma_buf_import, stencil_ref_export). The failure, agc_driver_store_over_untracked ("the first result was not stored"), also fails with your five files reverted on the same merge and passes on 8856f180c. That test changed in #5671, so it is not from this PR.
  • Non-GPU suite (825 tests, -j8): 11 failures, run on a loaded host at the same time as the GPU suite. On a serial rerun all pass except hardware_oracle_compare, which still hits its 20 s limit, as on main under load.
  • tools/check_conventions.py --base origin/main: passes. git diff origin/main --check: clean.

Review:

  • The lane mapping is unchanged from EmitDppGroupPermTargetLane (2 bits per lane). It matches ACO's dpp_quad_perm encoding (aco_builder_h.py, mesa-26.2.4). The nir_gather_info.c lines you cite say what the description says.
  • row_mask, bank_mask and bound_ctrl stay in EmitDppWriteCondition. fi returns the read. Without fi the result is 0 when the source EXEC is clear. Other DPP16 controls and DPP8 keep the shuffle.
  • Non-blocking: the source-EXEC check now reads EXEC through QuadBroadcast instead of a ballot. That is only defined while the source invocation is active (helpers count; an invocation terminated earlier would not). The title does not take that path.
  • No agc_driver_ test runs a pixel shader with a quad_perm read. The DPP execution tests are compute, and pixel_wave_reduction uses row_shr. On the GPU side only the title exercises the new path.

No other concerns.

Written with Claude Code assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6194235525 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290#issuecomment-6194235525). Originally posted by [screamm](https://github.com/screamm) on 2026-10-15T14:16:19Z. --- Cross-validation on Windows 11 Pro 26220, NVIDIA RTX 4070 (596.21), MinGW GCC 15.2, PR head 891885201 merged on main 3ee537191: **PS5 OpenGL Showcase (PPSA99005, catalog 1.0.1)**, 90 s per run, `ANYPS5_REQUIRE_DISPLAY=1`, `APS5_DUMP_FRAMES` every 30 presents (960x540). The title runs until the limit in every run; no stop line and no error in `download0/ps5-opengl.log`. - Before, `main` 8856f180c: 379 frames (410 in a second run). - After, two cold runs: 228 frames (with a build running alongside) and 283. - After, third run back to back with the second before run: 496 frames. The #6289 symptom (white bloom cloud with black specks over the 8192 instances, RADV) does not occur on NVIDIA `main`. Before and after, every dump shows the instances as shaded, faceted icosahedra and cubes, as in your fix image. The share of near-white pixels is 1.0-2.3% per dump before and 1.05-2.4% after; your RADV `main` image has 27.7% and your fix image 1.9%. So this run shows no regression on NVIDIA, not the fix itself. (#6289 returns 404 for me, so the symptom is taken from the PR body.) The quad path does run here (RTX 4070, subgroup 32). I checked the cold per-run shader cache: - `main`: two of the 31 SPIR-V modules hold 15 `OpGroupNonUniformShuffle` each. - With the PR: the matching two hold 60 `OpGroupNonUniformQuadBroadcast` each, and no module has a shuffle. The 15 reads in the title take no source-EXEC check. Tests: - `agc_shader_memory`: 3/3. - Negative control: with `VulkanDevice.cpp`, `ShaderValidation.cpp`, `SpirvSubgroup.hpp`, `SpirvSubgroup.cpp` and `SpirvAluEmitterMath.cpp` from `main` and your test kept, it fails 2/2 with `a pixel quad_perm read did not go through quad operations`. - DPP/quad subset (19 tests: `dpp`, `quad`, `swizzle`, `derivatives`, `pixel_helper_lanes`, `wave_reduction`, `float16_dot`, `agc_dpp_write`, `agc_shader_memory`), `--repeat until-fail:3`: 57/57. - `ctest -R '^agc_driver_' -j1`: 446/447, with 2 skipped (`sparse_dma_buf_import`, `stencil_ref_export`). The failure, `agc_driver_store_over_untracked` ("the first result was not stored"), also fails with your five files reverted on the same merge and passes on `8856f180c`. That test changed in #5671, so it is not from this PR. - Non-GPU suite (825 tests, `-j8`): 11 failures, run on a loaded host at the same time as the GPU suite. On a serial rerun all pass except `hardware_oracle_compare`, which still hits its 20 s limit, as on `main` under load. - `tools/check_conventions.py --base origin/main`: passes. `git diff origin/main --check`: clean. Review: - The lane mapping is unchanged from `EmitDppGroupPermTargetLane` (2 bits per lane). It matches ACO's `dpp_quad_perm` encoding (`aco_builder_h.py`, mesa-26.2.4). The `nir_gather_info.c` lines you cite say what the description says. - row_mask, bank_mask and bound_ctrl stay in `EmitDppWriteCondition`. fi returns the read. Without fi the result is 0 when the source EXEC is clear. Other DPP16 controls and DPP8 keep the shuffle. - Non-blocking: the source-EXEC check now reads EXEC through `QuadBroadcast` instead of a ballot. That is only defined while the source invocation is active (helpers count; an invocation terminated earlier would not). The title does not take that path. - No `agc_driver_` test runs a pixel shader with a quad_perm read. The DPP execution tests are compute, and `pixel_wave_reduction` uses row_shr. On the GPU side only the title exercises the new path. No other concerns. Written with Claude Code assistance.
jackthereaper2006 commented 2026-10-15 16:28:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jackthereaper2006 on 2026-10-15T16:28:38Z.


Thanks to both of you. The NVIDIA results cover the GPU I could not test. The module scan (15 shuffles → 60 OpGroupNonUniformQuadBroadcast, no shuffle left) shows the quad path runs on NVIDIA too.

@screamm on the source-EXEC point: you're right that OpGroupNonUniformQuadBroadcast is only defined while the source invocation is active, where the ballot would have reported a gone lane as inactive. In a pixel shader that has a DPP read, a lane can't leave before the read:

  • The quad pixel mask kill at entry (SpirvModuleEmitter.cpp:1212-1234) becomes OpDemoteToHelperInvocation when the program reads neighbour lanes. DppMoveU32 and DppUpdateU32 count as such reads (SpirvAnalysis.cpp:16-17). Without demote support that compile throws. A demoted lane is a helper, and helpers take part in quad operations.
  • The valid-mask and stencil-replay kills are emitted in EmitReturnTerminator (SpirvFlowEmitter.cpp:83-110), after the last instruction.
  • The remaining mid-shader OpKill is the BDA fault path (SpirvBdaFault.cpp:118). It runs after a fault has already been recorded.

On the missing GPU coverage: 3dd3a9832 adds agc_driver_pixel_quad_perm_helpers. It draws the skewed triangles of PixelWaveReduction and turns whole-quad mode on with s_wqm. Then it reads the horizontal and vertical neighbour's pixel index through v_mov_b32_dpp quad_perm:[1,0,3,2] and [2,3,0,1], with and without fi, in wave64 and wave32. Every covered pixel must read its neighbour's index, helper or not.

  • RADV with this PR: passes 3/3 runs, 4432 helper-neighbour reads per variant over 4 draws.
  • RADV with SpirvAluEmitterMath.cpp from main: fails 3/3 with pixel 584 read 0 from quad_perm [1,0,3,2], its helper neighbour is pixel 585.
  • lavapipe: skips, because its 8-lane subgroup cannot hold a wave32. It skips there like PixelHelperLanes.
  • It also skips without the quad capability.
  • Whole ctest: 1227/1227 with Mesa patched for #5444, and 1226/1227 on stock Mesa 26.2.4 (agc_driver_tessellation, #5444).

#6289 loads for me signed out (HTTP 200), so the 404 may have been a token without discussion access.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6197019973 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290#issuecomment-6197019973). Originally posted by [jackthereaper2006](https://github.com/jackthereaper2006) on 2026-10-15T16:28:38Z. --- Thanks to both of you. The NVIDIA results cover the GPU I could not test. The module scan (15 shuffles → 60 `OpGroupNonUniformQuadBroadcast`, no shuffle left) shows the quad path runs on NVIDIA too. @screamm on the source-EXEC point: you're right that `OpGroupNonUniformQuadBroadcast` is only defined while the source invocation is active, where the ballot would have reported a gone lane as inactive. In a pixel shader that has a DPP read, a lane can't leave before the read: - The quad pixel mask kill at entry ([`SpirvModuleEmitter.cpp:1212-1234`](https://github.com/boykopovar/AnyPS5/blob/891885201/core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp#L1212-L1234)) becomes `OpDemoteToHelperInvocation` when the program reads neighbour lanes. `DppMoveU32` and `DppUpdateU32` count as such reads ([`SpirvAnalysis.cpp:16-17`](https://github.com/boykopovar/AnyPS5/blob/891885201/core/shader/recompiler/SpirvBackend/src/SpirvAnalysis.cpp#L16-L17)). Without demote support that compile throws. A demoted lane is a helper, and helpers take part in quad operations. - The valid-mask and stencil-replay kills are emitted in `EmitReturnTerminator` ([`SpirvFlowEmitter.cpp:83-110`](https://github.com/boykopovar/AnyPS5/blob/891885201/core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp#L83-L110)), after the last instruction. - The remaining mid-shader `OpKill` is the BDA fault path ([`SpirvBdaFault.cpp:118`](https://github.com/boykopovar/AnyPS5/blob/891885201/core/shader/recompiler/SpirvBackend/src/SpirvBdaFault.cpp#L118)). It runs after a fault has already been recorded. On the missing GPU coverage: 3dd3a9832 adds `agc_driver_pixel_quad_perm_helpers`. It draws the skewed triangles of `PixelWaveReduction` and turns whole-quad mode on with `s_wqm`. Then it reads the horizontal and vertical neighbour's pixel index through `v_mov_b32_dpp quad_perm:[1,0,3,2]` and `[2,3,0,1]`, with and without `fi`, in wave64 and wave32. Every covered pixel must read its neighbour's index, helper or not. - RADV with this PR: passes 3/3 runs, 4432 helper-neighbour reads per variant over 4 draws. - RADV with `SpirvAluEmitterMath.cpp` from `main`: fails 3/3 with `pixel 584 read 0 from quad_perm [1,0,3,2], its helper neighbour is pixel 585`. - lavapipe: skips, because its 8-lane subgroup cannot hold a wave32. It skips there like `PixelHelperLanes`. - It also skips without the quad capability. - Whole `ctest`: 1227/1227 with Mesa patched for #5444, and 1226/1227 on stock Mesa 26.2.4 (`agc_driver_tessellation`, #5444). #6289 loads for me signed out (HTTP 200), so the 404 may have been a token without discussion access. AI-assisted: yes (Claude Code)
screamm commented 2026-10-15 22:07:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-15T22:07:15Z.


Rerun on 3dd3a9832, merged on main 44df21632 (Windows 11 Pro 26220, NVIDIA RTX 4070 596.21, MinGW GCC 15.2):

  • agc_driver_pixel_quad_perm_helpers, --repeat until-fail:3: 3 of 3 pass, not skipped. A direct run prints 4432 reads from helper neighbours over 4 draws for each of wave64, wave64 fi, wave32 and wave32 fi (the same count you report on RADV).
  • ctest -R 'quad|dpp' (11 tests, including agc_driver_quad_pixel_mask and the dpp16/dpp8 tests), -j1 --repeat until-fail:3: all pass.
  • Negative control on NVIDIA does not fail: with only SpirvAluEmitterMath.cpp taken from main (your control) the test still passes, 3 of 3 direct runs, 4432 reads per variant. With the other four source files reverted as well, it is skipped by the new capability gate. So the new test pins the quad path on RADV but cannot distinguish it from the shuffle on NVIDIA, where the shuffle already returns the neighbour's value for helper lanes. That matches the earlier title run (no #6289 symptom on NVIDIA main). I am not asking for a change, just noting what the test covers here.
  • Full build passes except agc_driver_gpu_indirect_arguments_misaligned_writer_ahead_tests, which fails on main as well here (65536 alignment, #6452/#6478).

Not rerun: the full GPU and non-GPU suites and the PPSA99005 title run on this head.

Written with Claude Code assistance (validation by a subagent, reviewed in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6203272305 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290#issuecomment-6203272305). Originally posted by [screamm](https://github.com/screamm) on 2026-10-15T22:07:15Z. --- Rerun on `3dd3a9832`, merged on main `44df21632` (Windows 11 Pro 26220, NVIDIA RTX 4070 596.21, MinGW GCC 15.2): - `agc_driver_pixel_quad_perm_helpers`, `--repeat until-fail:3`: 3 of 3 pass, not skipped. A direct run prints 4432 reads from helper neighbours over 4 draws for each of wave64, wave64 `fi`, wave32 and wave32 `fi` (the same count you report on RADV). - `ctest -R 'quad|dpp'` (11 tests, including `agc_driver_quad_pixel_mask` and the `dpp16`/`dpp8` tests), `-j1 --repeat until-fail:3`: all pass. - Negative control on NVIDIA does not fail: with only `SpirvAluEmitterMath.cpp` taken from `main` (your control) the test still passes, 3 of 3 direct runs, 4432 reads per variant. With the other four source files reverted as well, it is skipped by the new capability gate. So the new test pins the quad path on RADV but cannot distinguish it from the shuffle on NVIDIA, where the shuffle already returns the neighbour's value for helper lanes. That matches the earlier title run (no #6289 symptom on NVIDIA `main`). I am not asking for a change, just noting what the test covers here. - Full build passes except `agc_driver_gpu_indirect_arguments_misaligned_writer_ahead_tests`, which fails on `main` as well here (65536 alignment, #6452/#6478). Not rerun: the full GPU and non-GPU suites and the PPSA99005 title run on this head. Written with Claude Code assistance (validation by a subagent, reviewed in this session).
LeandroLP23 commented 2026-10-16 07:53:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-16T07:53:56Z.


Windows with AMD's own driver, the combination not covered yet: the Showcase artifact from #6289 shows up there on main too, and this change fixes it. The new test also works as a negative control on this driver.

Setup: Windows 11 Home 26300, AMD Radeon 860M (RDNA 3.5, 1002:1114, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release. Head 3dd3a9832 merged onto main 5d9dcc42d (clean merge). PS5 OpenGL Showcase, catalog 1.0.1, relinked with --windows, warm shader cache. Frame dumps use APS5_DUMP_FRAMES=5, APS5_DUMP_FRAMES_EVERY=20, from one 45 s run per build.

Title

  • On main the 8192 instances render as a white bloom band with black specks across the middle of the screen, as in the RADV image on #6289. Near-white pixels (all channels > 235) make up 21.0 / 20.8 / 21.3 / 23.9 / 39.3 % of the five dumps.
  • With this change they render as shaded icosahedra and cubes, as in the author's screenshot. Near-white pixels: 1.5 / 1.4 / 1.4 / 2.7 / 1.5 %, in line with @screamm's NVIDIA figures.
  • No change in speed: 3.60–3.68 FPS over three 60 s runs, against 3.64–3.75 on main. That cost is #6189 / #6202.

Tests

  • agc_driver_pixel_quad_perm_helpers and agc_shader_memory pass.
  • Negative control: with only SpirvAluEmitterMath.cpp taken from main, agc_driver_pixel_quad_perm_helpers fails 3 of 3 with pixel quad_perm wave64: pixel 584 read 0 from quad_perm [1,0,3,2], its helper neighbour is pixel 585. So on this driver the shuffle loses helper lanes as on RADV, and the test does tell the two paths apart here, unlike on NVIDIA.
  • ctest -R 'quad|dpp|agc_shader_memory' (12 tests): all pass except agc_driver_quad_pixel_mask, which fails on main on this GPU too and is fixed by #6255.
  • With #6255 merged on top as well, all 12 pass 3 of 3 (--repeat until-fail:3). The Showcase dumps then look the same as with this change alone. #6255 kills demoted pixels when the program returns, after the DPP reads, so the two don't interfere.

Not tested: discrete RDNA, Linux.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6210800506 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290#issuecomment-6210800506). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-16T07:53:56Z. --- Windows with AMD's own driver, the combination not covered yet: the Showcase artifact from #6289 shows up there on `main` too, and this change fixes it. The new test also works as a negative control on this driver. Setup: Windows 11 Home 26300, AMD Radeon 860M (RDNA 3.5, `1002:1114`, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release. Head `3dd3a9832` merged onto `main` `5d9dcc42d` (clean merge). PS5 OpenGL Showcase, catalog 1.0.1, relinked with `--windows`, warm shader cache. Frame dumps use `APS5_DUMP_FRAMES=5`, `APS5_DUMP_FRAMES_EVERY=20`, from one 45 s run per build. **Title** - On `main` the 8192 instances render as a white bloom band with black specks across the middle of the screen, as in the RADV image on #6289. Near-white pixels (all channels > 235) make up 21.0 / 20.8 / 21.3 / 23.9 / 39.3 % of the five dumps. - With this change they render as shaded icosahedra and cubes, as in the author's screenshot. Near-white pixels: 1.5 / 1.4 / 1.4 / 2.7 / 1.5 %, in line with @screamm's NVIDIA figures. - No change in speed: 3.60–3.68 FPS over three 60 s runs, against 3.64–3.75 on `main`. That cost is #6189 / #6202. **Tests** - `agc_driver_pixel_quad_perm_helpers` and `agc_shader_memory` pass. - Negative control: with only `SpirvAluEmitterMath.cpp` taken from `main`, `agc_driver_pixel_quad_perm_helpers` fails 3 of 3 with `pixel quad_perm wave64: pixel 584 read 0 from quad_perm [1,0,3,2], its helper neighbour is pixel 585`. So on this driver the shuffle loses helper lanes as on RADV, and the test does tell the two paths apart here, unlike on NVIDIA. - `ctest -R 'quad|dpp|agc_shader_memory'` (12 tests): all pass except `agc_driver_quad_pixel_mask`, which fails on `main` on this GPU too and is fixed by #6255. - With #6255 merged on top as well, all 12 pass 3 of 3 (`--repeat until-fail:3`). The Showcase dumps then look the same as with this change alone. #6255 kills demoted pixels when the program returns, after the DPP reads, so the two don't interfere. Not tested: discrete RDNA, Linux. AI-assisted: yes (Claude Code)
odntht commented 2026-10-16 19:59:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by odntht on 2026-10-16T19:59:54Z.


An Intel run, for the "Not run: Intel" line. It passes, but Gen9 does not show the bug on main either.

Setup: Intel HD Graphics 520 (Skylake GT2, Gen9), Mesa 25.2.8 ANV, Ubuntu 24.04 (container), kernel 6.12.111, GCC 13.3, Release. Head 3dd3a9832 merged onto main f474fb776 (clean). ANYPS5_GPU="HD Graphics 520"; the log shows it selected, subgroup=32. ANV reports SUBGROUP_FEATURE_QUAD_BIT for the fragment stage.

  • With the PR: agc_driver_pixel_quad_perm_helpers passes 3 of 3 (4432 reads from helper neighbours over 4 draws for wave64, wave64 fi, wave32 and wave32 fi). agc_shader_memory, agc_shader_quad_mask_no_demote, agc_driver_quad_pixel_mask and agc_driver_vop3_quad_sad pass 3 of 3.
  • Control 1, the PR's tests with every source file from main: the new test skips (the device has no subgroup quad operations), because main never adds GroupNonUniformQuad. agc_shader_memory fails as expected (a pixel quad_perm read did not go through quad operations).
  • Control 2, the PR's VulkanDevice.cpp and ShaderValidation.cpp with main's SpirvSubgroup.* and SpirvAluEmitterMath.cpp, so the old shuffle path runs on a device that advertises quad: agc_driver_pixel_quad_perm_helpers also passes 3 of 3, with the same 4432 reads.

So on ANV Gen9, as on lavapipe, the shuffle path already reads helper neighbours correctly, and the PR keeps it working. The test does not catch the RADV failure on this device. I could not run the PS5 OpenGL Showcase here.

AI-assisted: yes (Claude Code). The runs are on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223616785 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290#issuecomment-6223616785). Originally posted by [odntht](https://github.com/odntht) on 2026-10-16T19:59:54Z. --- An Intel run, for the "Not run: Intel" line. It passes, but Gen9 does not show the bug on `main` either. Setup: Intel HD Graphics 520 (Skylake GT2, Gen9), Mesa 25.2.8 ANV, Ubuntu 24.04 (container), kernel 6.12.111, GCC 13.3, Release. Head `3dd3a9832` merged onto `main` `f474fb776` (clean). `ANYPS5_GPU="HD Graphics 520"`; the log shows it selected, `subgroup=32`. ANV reports `SUBGROUP_FEATURE_QUAD_BIT` for the fragment stage. - With the PR: `agc_driver_pixel_quad_perm_helpers` passes 3 of 3 (`4432 reads from helper neighbours over 4 draws` for wave64, wave64 fi, wave32 and wave32 fi). `agc_shader_memory`, `agc_shader_quad_mask_no_demote`, `agc_driver_quad_pixel_mask` and `agc_driver_vop3_quad_sad` pass 3 of 3. - Control 1, the PR's tests with every source file from `main`: the new test skips (`the device has no subgroup quad operations`), because `main` never adds `GroupNonUniformQuad`. `agc_shader_memory` fails as expected (`a pixel quad_perm read did not go through quad operations`). - Control 2, the PR's `VulkanDevice.cpp` and `ShaderValidation.cpp` with `main`'s `SpirvSubgroup.*` and `SpirvAluEmitterMath.cpp`, so the old shuffle path runs on a device that advertises quad: `agc_driver_pixel_quad_perm_helpers` also passes 3 of 3, with the same 4432 reads. So on ANV Gen9, as on lavapipe, the shuffle path already reads helper neighbours correctly, and the PR keeps it working. The test does not catch the RADV failure on this device. I could not run the PS5 OpenGL Showcase here. AI-assisted: yes (Claude Code). The runs are on my machine.
klosixgaming-arch commented 2026-10-19 02:46:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-19T02:46:21Z.

Review: APPROVED


Merged head 3dd3a9832 onto current main (40393b0f9) — clean merge, builds with WinLibs GCC 15.2.0, Release, Ninja, -j 8. Windows 11, NVIDIA GeForce RTX 5090 (selected device; RTX 4090 and an AMD iGPU are also present), 32-lane subgroups.

Tests run on the merged tree:

  • agc_shader_memory — pass (includes the new pixel quad_perm check)
  • agc_driver_pixel_quad_perm_helpers — pass
  • DPP/quad regression set, all pass: agc_dpp_write, agc_driver_dpp8, agc_driver_dpp8_pk_fmac, agc_driver_dpp16_inactive_source, agc_driver_dpp16_operands, agc_driver_dpp16_row_share_xmask, agc_driver_dpp_no_form, agc_driver_quad_pixel_mask, agc_driver_vop3_quad_sad
  • Sanity: request_serializer, agc_driver_gpu_buffer_format, agc_driver_layered_volume_draw — pass

Negative control (plain main 40393b0f9 plus only this PR's test changes):

  • agc_shader_memory fails with "a pixel quad_perm read did not go through quad operations"
  • agc_driver_pixel_quad_perm_helpers skips (exit 77, "skipped, the device has no subgroup quad operations") because main does not expose GroupNonUniformQuad

Note: on NVIDIA the exec test passes even without the emitter change (NVIDIA keeps helpers in the shuffle), so on this machine the failing negative control is the agc_shader_memory check; the RADV-specific failure was already demonstrated by @jackthereaper2006 and @LeandroLP23 above.

Read through the diff: capability exposure in VulkanDevice.cpp, validation mapping in ShaderValidation.cpp, and quad-broadcast emission for pixel-stage quad_perm reads (control ≤ 0xff) covering both the DPP move value and the write-condition source EXEC check — no problems found. Not tested here: AMD, Intel, Linux, titles.

AI-assisted: yes. Written with AI assistance and reviewed by me.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5566411760 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290#pullrequestreview-5566411760). Originally posted by [klosixgaming-arch](https://github.com/klosixgaming-arch) on 2026-10-19T02:46:21Z. **Review:** APPROVED --- Merged head `3dd3a9832` onto current `main` (`40393b0f9`) — clean merge, builds with WinLibs GCC 15.2.0, Release, Ninja, `-j 8`. Windows 11, NVIDIA GeForce RTX 5090 (selected device; RTX 4090 and an AMD iGPU are also present), 32-lane subgroups. Tests run on the merged tree: - `agc_shader_memory` — pass (includes the new pixel quad_perm check) - `agc_driver_pixel_quad_perm_helpers` — pass - DPP/quad regression set, all pass: `agc_dpp_write`, `agc_driver_dpp8`, `agc_driver_dpp8_pk_fmac`, `agc_driver_dpp16_inactive_source`, `agc_driver_dpp16_operands`, `agc_driver_dpp16_row_share_xmask`, `agc_driver_dpp_no_form`, `agc_driver_quad_pixel_mask`, `agc_driver_vop3_quad_sad` - Sanity: `request_serializer`, `agc_driver_gpu_buffer_format`, `agc_driver_layered_volume_draw` — pass Negative control (plain `main` `40393b0f9` plus only this PR's test changes): - `agc_shader_memory` fails with "a pixel quad_perm read did not go through quad operations" - `agc_driver_pixel_quad_perm_helpers` skips (exit 77, "skipped, the device has no subgroup quad operations") because main does not expose `GroupNonUniformQuad` Note: on NVIDIA the exec test passes even without the emitter change (NVIDIA keeps helpers in the shuffle), so on this machine the failing negative control is the `agc_shader_memory` check; the RADV-specific failure was already demonstrated by @jackthereaper2006 and @LeandroLP23 above. Read through the diff: capability exposure in `VulkanDevice.cpp`, validation mapping in `ShaderValidation.cpp`, and quad-broadcast emission for pixel-stage quad_perm reads (control ≤ 0xff) covering both the DPP move value and the write-condition source EXEC check — no problems found. Not tested here: AMD, Intel, Linux, titles. AI-assisted: yes. Written with AI assistance and reviewed by me.
XairRrR commented 2026-11-03 22:48:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T22:48:27Z.

Review: APPROVED


Reviewed — approved

Pixel-shader DPP quad_perm reads now go through OpGroupNonUniformQuadBroadcast when the device has quad operations. The change merges cleanly and builds. The focused tests pass, and the new agc_shader_memory check fails once the production files are reverted to main.

What I ran

Head 5e25bc870e6eda3f0cb994290a53f71cac0aaf8d, main 1c8c0efc8c41314402e6966da5bef6ea3d639d10, merged tree 2c00d3afe895b0453533a9f7e4019b234ca50c7d. The machine is Debian 13 (VM, 32 vCPU Xeon Gold 6136) with GCC 14.2.0, and Vulkan runs on lavapipe (Mesa 26.1.6, LLVM 19, 8-lane subgroups).

git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...5e25bc870e6eda3f0cb994290a53f71cac0aaf8d
python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10
ctest --test-dir build -j8 --test-load 32 --output-on-failure -V -R "^(agc_driver_pixel_quad_perm_helpers|agc_shader_memory|agc_dpp_write|agc_driver_quad_pixel_mask|agc_driver_dpp16_inactive_source|agc_driver_pixel_helper_lanes|agc_shader_quad_mask_no_demote)$"
# negative control
git show 1c8c0efc8c41314402e6966da5bef6ea3d639d10:<path> > <path>   # the 5 production files
ninja -C build -j32 -l32 agc_shader_memory_tests
build/tests/agc_shader_memory_tests
git show 2c00d3afe895b0453533a9f7e4019b234ca50c7d:<path> > <path>   # restore
ninja -C build -j32 -l32 agc_shader_memory_tests agc_driver_pixel_quad_perm_helpers_tests
build/tests/agc_shader_memory_tests
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure, build, libs (script) ok
Selected tests (script, 2177 run) 0 new failures, 0 timeouts. The 7 known failures (agc_driver_division, denormal-mode tests, vector_constant_factor_tininess, an unwrap test) also fail on main
Skips (script) 117, all expected per check_skips.py
Focused ctest (7 tests) 4 pass: agc_shader_memory, agc_dpp_write, agc_driver_quad_pixel_mask, agc_shader_quad_mask_no_demote. 3 skip on lavapipe with "subgroup size 8 cannot hold a wave32": agc_driver_pixel_quad_perm_helpers, agc_driver_pixel_helper_lanes, agc_driver_dpp16_inactive_source
Validation layer (script) layer loaded in 784 of 785 tests, missing in none. The only test with VUIDs not seen on main is agc_driver_image_gather_volume (VUID-VkSamplerCreateInfo-addressMode*). That test is marked "test not run on main", so the baseline has no comparison for it. It checks sampler address modes, which this change does not touch, so I don't count it against the PR
Negative control fails as expected (see below)
Worktree after restore git status --porcelain is empty
agc_driver_pixel_quad_perm_helpers on lavapipe
1415: Selected GPU name=llvmpipe (LLVM 19.1.7, 256 bits) vendor=0x10005 device=0x0 subgroup=8
1415: skipped, subgroup size 8 cannot hold a wave32
3/7 Test #1415: agc_driver_pixel_quad_perm_helpers ...***Skipped   0.10 sec

Negative control

I restored these five production files from main:

  • VulkanDevice.cpp
  • ShaderValidation.cpp
  • SpirvSubgroup.hpp
  • SpirvSubgroup.cpp
  • SpirvAluEmitterMath.cpp

I kept the PR's tests and rebuilt agc_shader_memory_tests. It fails with:

a pixel quad_perm read did not go through quad operations

After I restored the merged files, it passes again.

The GPU execution test agc_driver_pixel_quad_perm_helpers skips on this machine, so I couldn't run a negative control for it. Others ran it in the discussion:

  • It tells the two paths apart on RADV (the author) and on AMD's Windows driver (LeandroLP23).
  • On NVIDIA (screamm) and ANV Gen9 (odntht) it passes with the shuffle path too, so it can't tell the paths apart there. I can't add anything new on that point.

Findings

Blocking

None.

Non-blocking

  • The quad read emits more code than it needs to (core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvSubgroup.cpp:317-329, used at core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cpp:1382-1386 and :196).
    • What it does now: each read emits four OpGroupNonUniformQuadBroadcast plus three selects. A move without fi emits that twice, once for the value and once for the source EXEC. That is why screamm counted 60 broadcasts where there were 15 shuffles before.
    • Why it's wasteful: control is a compile-time constant. When all four entries are the same (0x00, 0x55, 0xaa, 0xff), one OpGroupNonUniformQuadBroadcast with that index is enough. [1,0,3,2], [2,3,0,1] and [3,2,1,0] map directly to OpGroupNonUniformQuadSwap with direction 0, 1 and 2.
    • Impact: it's only code size and ALU work, not a correctness issue. LeandroLP23 measured no change in FPS. It could go in a follow-up.
  • The point that QuadBroadcast of EXEC is undefined when the source invocation is inactive was raised by screamm and answered by the author. I checked that pixel shaders keep the scalar control flow uniform here, and I have nothing new to add. Astronaut10's coverage notes on row_xmask and reconvergence are follow-up scope.

Not verified

  • The GPU execution path itself. On lavapipe, agc_driver_pixel_quad_perm_helpers skips because of the 8-lane subgroup, so I didn't run any pixel quad_perm read on a GPU here. The RADV, AMD Windows, NVIDIA and Intel results come from the discussion, not from my runs.
  • The PPSA99005 title result. I did not launch any title.
  • The validation-layer comparison for agc_driver_pixel_quad_perm_helpers. It skipped, so it reached no draw.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5760585824 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6290#pullrequestreview-5760585824). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T22:48:27Z. **Review:** APPROVED --- # Reviewed — approved Pixel-shader DPP `quad_perm` reads now go through `OpGroupNonUniformQuadBroadcast` when the device has quad operations. The change merges cleanly and builds. The focused tests pass, and the new `agc_shader_memory` check fails once the production files are reverted to `main`. ## What I ran Head `5e25bc870e6eda3f0cb994290a53f71cac0aaf8d`, `main` `1c8c0efc8c41314402e6966da5bef6ea3d639d10`, merged tree `2c00d3afe895b0453533a9f7e4019b234ca50c7d`. The machine is Debian 13 (VM, 32 vCPU Xeon Gold 6136) with GCC 14.2.0, and Vulkan runs on lavapipe (Mesa 26.1.6, LLVM 19, 8-lane subgroups). ``` git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...5e25bc870e6eda3f0cb994290a53f71cac0aaf8d python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10 ctest --test-dir build -j8 --test-load 32 --output-on-failure -V -R "^(agc_driver_pixel_quad_perm_helpers|agc_shader_memory|agc_dpp_write|agc_driver_quad_pixel_mask|agc_driver_dpp16_inactive_source|agc_driver_pixel_helper_lanes|agc_shader_quad_mask_no_demote)$" # negative control git show 1c8c0efc8c41314402e6966da5bef6ea3d639d10:<path> > <path> # the 5 production files ninja -C build -j32 -l32 agc_shader_memory_tests build/tests/agc_shader_memory_tests git show 2c00d3afe895b0453533a9f7e4019b234ca50c7d:<path> > <path> # restore ninja -C build -j32 -l32 agc_shader_memory_tests agc_driver_pixel_quad_perm_helpers_tests build/tests/agc_shader_memory_tests git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure, build, `libs` (script) | ok | | Selected tests (script, 2177 run) | 0 new failures, 0 timeouts. The 7 known failures (`agc_driver_division`, denormal-mode tests, `vector_constant_factor_tininess`, an unwrap test) also fail on `main` | | Skips (script) | 117, all expected per `check_skips.py` | | Focused ctest (7 tests) | 4 pass: `agc_shader_memory`, `agc_dpp_write`, `agc_driver_quad_pixel_mask`, `agc_shader_quad_mask_no_demote`. 3 skip on lavapipe with "subgroup size 8 cannot hold a wave32": `agc_driver_pixel_quad_perm_helpers`, `agc_driver_pixel_helper_lanes`, `agc_driver_dpp16_inactive_source` | | Validation layer (script) | layer loaded in 784 of 785 tests, missing in none. The only test with VUIDs not seen on `main` is `agc_driver_image_gather_volume` (`VUID-VkSamplerCreateInfo-addressMode*`). That test is marked "test not run on main", so the baseline has no comparison for it. It checks sampler address modes, which this change does not touch, so I don't count it against the PR | | Negative control | fails as expected (see below) | | Worktree after restore | `git status --porcelain` is empty | <details><summary>agc_driver_pixel_quad_perm_helpers on lavapipe</summary> ``` 1415: Selected GPU name=llvmpipe (LLVM 19.1.7, 256 bits) vendor=0x10005 device=0x0 subgroup=8 1415: skipped, subgroup size 8 cannot hold a wave32 3/7 Test #1415: agc_driver_pixel_quad_perm_helpers ...***Skipped 0.10 sec ``` </details> ## Negative control I restored these five production files from `main`: - `VulkanDevice.cpp` - `ShaderValidation.cpp` - `SpirvSubgroup.hpp` - `SpirvSubgroup.cpp` - `SpirvAluEmitterMath.cpp` I kept the PR's tests and rebuilt `agc_shader_memory_tests`. It fails with: ``` a pixel quad_perm read did not go through quad operations ``` After I restored the merged files, it passes again. The GPU execution test `agc_driver_pixel_quad_perm_helpers` skips on this machine, so I couldn't run a negative control for it. Others ran it in the discussion: - It tells the two paths apart on RADV (the author) and on AMD's Windows driver (LeandroLP23). - On NVIDIA (screamm) and ANV Gen9 (odntht) it passes with the shuffle path too, so it can't tell the paths apart there. I can't add anything new on that point. ## Findings ### Blocking None. ### Non-blocking - **The quad read emits more code than it needs to** (`core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvSubgroup.cpp:317-329`, used at `core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cpp:1382-1386` and `:196`). - What it does now: each read emits four `OpGroupNonUniformQuadBroadcast` plus three selects. A move without `fi` emits that twice, once for the value and once for the source EXEC. That is why screamm counted 60 broadcasts where there were 15 shuffles before. - Why it's wasteful: `control` is a compile-time constant. When all four entries are the same (0x00, 0x55, 0xaa, 0xff), one `OpGroupNonUniformQuadBroadcast` with that index is enough. `[1,0,3,2]`, `[2,3,0,1]` and `[3,2,1,0]` map directly to `OpGroupNonUniformQuadSwap` with direction 0, 1 and 2. - Impact: it's only code size and ALU work, not a correctness issue. LeandroLP23 measured no change in FPS. It could go in a follow-up. - The point that `QuadBroadcast` of EXEC is undefined when the source invocation is inactive was raised by screamm and answered by the author. I checked that pixel shaders keep the scalar control flow uniform here, and I have nothing new to add. Astronaut10's coverage notes on `row_xmask` and reconvergence are follow-up scope. ## Not verified - The GPU execution path itself. On lavapipe, `agc_driver_pixel_quad_perm_helpers` skips because of the 8-lane subgroup, so I didn't run any pixel `quad_perm` read on a GPU here. The RADV, AMD Windows, NVIDIA and Intel results come from the discussion, not from my runs. - The PPSA99005 title result. I did not launch any title. - The validation-layer comparison for `agc_driver_pixel_quad_perm_helpers`. It skipped, so it reached no draw. <!-- anyps5-bots job=3665 head=5e25bc870e6eda3f0cb994290a53f71cac0aaf8d -->
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6290
No description provided.