Wave32 pixel shaders read the wrong half of a 64-lane subgroup on AMD (agc_driver_pixel_helper_lanes fails on RDNA4) #487
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by QDarkRex on 2026-10-04T03:43:30Z.
agc_driver_pixel_helper_lanesfails on every run on an AMD GPU onmain(33a2f90). The wave64 passes succeed; the wave32 pass fails:It is deterministic (6 of 6 runs, same wave). CI skips this test because lavapipe's subgroup is narrower than 32, and NVIDIA's subgroup is 32, so a wave32 shader there fills a subgroup exactly.
Host: Windows 11, Ryzen 7 5700X, Radeon RX 9060 XT (RDNA4), AMD driver 26.9.2 (LLPC), Vulkan 1.4.355, MinGW-w64 GCC 15.2.0. The device reports
subgroupSize = 64(min 32, max 64;subgroupSizeControlandrequiredSubgroupSizeStagesinclude fragment).The failing wave, dumped with a local print in
Check()(rank =v_mbcntin EXEC, exec =s_bcnt1of EXEC, all 26 pixels read pixel 584 throughv_readfirstlane):Two lanes have rank 24 in a 24-lane EXEC. That fits the upper half of a 64-lane subgroup seeing the lower half's EXEC: its covered lanes get the lower half's first lane and count, and a rank of all 24 lower bits.
Likely cause (from reading the code, not yet confirmed by a fix): for
WaveSize() == 32,EmitBallotLaneActiveBool(SpirvBackend/src/SpirvMemory/SpirvSubgroup.cpp) reads only component 0 of the ballot, and the lane is the subgroup invocation ID. Nothing splits a 64-lane subgroup into two 32-lane waves, and norequiredSubgroupSizeis requested. The opposite case, wave64 on a 32-lane subgroup, is handled withlaneHalf. Pipeline creation also has a pairing case for wave64 on a 32-lane subgroup, but nothing for wave32 on a 64-lane one.Possible directions, none tried: request a 32-lane subgroup for wave32 stages through
VK_EXT_subgroup_size_controlwhere the device allows it, or split the subgroup into two waves aslaneHalfdoes for the opposite case.If this holds, it is not limited to the test: any wave32 pixel shader in a title that uses EXEC counts,
v_mbcntorv_readfirstlanewould see mixed lanes on AMD GPUs that run 64-wide subgroups. I can run builds or diagnostics on this card.@oneandonlydean, since the test comes from
7ed138d.Investigated with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T05:25:18Z.
Thanks for the analysis, and sorry for not replying here sooner about the test from
7ed138d.#587 (merged in
ff964224) implements the second direction you listed. For a wave32 shader on a 64-wide host subgroup it keeps guest lane IDs in 0..31, takes the ballot word of the invocation's own 32-lane half, and maps shuffle targets back to physical lanes. That covers readlane, readfirstlane, DPP, DS permute, the lane-active check and the append/consume broadcast. Itswave32_wide_subgrouptest checks 32-, 64- and 128-wide subgroups on the CPU, but nobody has run it on a 64-wide AMD subgroup yet. NVIDIA and lavapipe only exercise the lower half.Could you run this on the RX 9060 XT with
mainat109a3281or later, and post the output with the driver version?If
agc_driver_pixel_helper_lanespasses, I think this can be closed. If it still fails, the same per-wave dump as in your report would show which path is left.Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-06T12:17:47Z.
Ran the requested selection on a 64-wide AMD subgroup, on Linux with RADV:
The device line of
agc_driver_pixel_helper_lanes:mainat5895ea72, Release, GCC 13.3 (Ubuntu 24.04 container),-DBUILD_TESTING=ONSo the wave32-on-64-wide path from #587 holds on RADV. This does not cover the AMD Windows driver (LLPC) from the report. For what it is worth, #825, #826 and #827 do not reproduce on RADV either:
agc_driver_vopc_compare_table,agc_driver_lds_atomics64andagc_driver_image_sample_derivativespass here.Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-07T17:53:21Z.
Same selection on RDNA4 with RADV,
maincea1ef1(includes #587):Linux (CachyOS, kernel 7.2.9), Mesa 26.2.4, GCC 16.2.1. The full suite passes as well (399/399). In a verbose run of the GPU tests (
-R "agc_driver|wave32|shader"), 157 selected this device and none reported a skip.AI-assisted: yes (Claude Code ran the tests and wrote this; the run is on my machine).
Imported from boykopovar/AnyPS5. Originally posted by arreina on 2026-10-07T18:15:37Z.
Same selection on a 64-wide GCN 4 subgroup (Polaris) with RADV,
mainat61260bda(includes #587):Linux Mint 22.3, kernel 7.0.0, Mesa 25.2.8, Vulkan 1.4.318, GCC 13.3. The full suite passes: 359 of 359.
What the runs above don't show: on this card
agc_driver_pixel_helper_lanesfailed on builds ofmainwithout #587 (cd61f15e, 2026-10-05) and passes now. I did not bisect, so I can't attribute the change to #587 alone.AI-assisted: yes (Claude Code ran the tests and wrote this; the run is on my machine).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T08:26:08Z.
Fixed by #587 (
ff9642245). The test now passes on 64-wide subgroups on RDNA 3 (RX 7700 XT), RDNA 4 (RX 9070 XT) and Polaris (RX 580). If it still fails on your RX 9060 XT on current main, please comment with the output and it can be reopened.