You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(shader): broadcast Wave32 readfirstlane on narrow subgroups - #25660
Broadcast v_readfirstlane_b32 over the complete guest Wave32 when a compute shader runs on host subgroups narrower than 32 lanes. Each invocation publishes its source in workgroup memory, active guest lanes atomically elect the lowest lane within their own 32-lane guest wave, and all invocations read that guest-wave slot after a workgroup barrier. Separate slots keep multiple guest waves in the same workgroup independent, including a partial final wave.
The workgroup exchange is only emitted for Wave32 compute on a host subgroup below 32 lanes. The emitted module is checked with the existing barrier-uniformity analysis; if a ReadFirstLane exchange sits in per-invocation divergent control flow, compilation retries with the existing subgroup-local shuffle instead of risking an incomplete workgroup barrier. That divergent case therefore keeps the previous narrow-subgroup limitation rather than hanging. Fault-capable shaders (usesDma or usesFaultBuffer) also keep the existing subgroup-local path, so this PR does not introduce workgroup barriers into the separate barrier-safe BDA fault problem tracked by #7392.
This addresses the unequal-input V_READFIRSTLANE_B32 reproduction discussed in #25298, including the ISA lane-0 fallback when EXEC is empty. #25419 covers the separate complete-VCC-word problem; the execution fixture here intentionally stops before scalar-word-to-VCC selection so the two fixes remain independently testable. #25609 changes ReadFirstLane when a guest wave already fits inside one host subgroup and explicitly falls back to the shuffle when the guest wave is wider than the host subgroup, so the narrow-host path here is separate.
Tested
Windows 11 Education build 26200, WinLibs GCC 15.2.0, CMake/Ninja Release; rebased onto current main 0f107f9. Rebased head: 6c99e1b.
Built spanned_uniformity_tests, agc_read_lane_elimination_tests, agc_driver_read_first_lane_tests, agc_driver_wave32_unequal_buffer_read_first_lane_tests, agc_masked_select_tests, agc_lds_lock_budget_tests, agc_shader_memory_tests, and agc_driver_bda_device_tests.
Focused CTest selection passed 9/9 on NVIDIA GeForce RTX 5080 (host subgroup 32) and 9/9 on AMD Radeon(TM) Graphics 0x13c0 (host subgroup 64): spanned_uniformity, agc_read_lane_elimination, agc_driver_read_first_lane, agc_driver_wave32_unequal_buffer_read_first_lane, agc_driver_bda_device_selection_cpu, agc_lds_lock_budget, agc_masked_select, agc_shader_memory, and agc_shader_memory_coherent_atomic_loads.
VK_LAYER_KHRONOS_validation was enabled on both GPUs. Loader logs confirm instance and device layer insertion. Both full 9-test runs produced zero VUID-, SYNC-HAZARD-, or UNASSIGNED- diagnostics.
The deterministic agc_shader_memory test compiles a 45-invocation Wave32 program with synthetic host subgroup sizes 8 and 32. Subgroup 8 emits per-wave workgroup storage, OpAtomicUMin, and complete workgroup barriers with no OpGroupNonUniformShuffle; subgroup 32 retains the native shuffle path. The barrier-uniformity analyzer accepts the convergent subgroup-8 module.
agc_lds_lock_budget exercises the narrow readfirstlane exchange plus wave32/wave64 lock budgets (64, 68, and 72 words, including int64 atomics).
The Wave32 unequal-buffer runtime fixture passed on physical host subgroups 32 and 64. Those adapters do not exercise the host-subgroup-below-32 runtime branch; no subgroup-8 Vulkan ICD is installed here. The narrow-subgroup branch is covered by deterministic synthetic code-generation and LDS-budget tests, but a current-head subgroup-8 runtime A/B remains outstanding.
The agc_driver_bda_device_tests target compiled successfully, and agc_driver_bda_device_selection_cpu passed. The full agc_driver_bda_device runtime test was not included because the existing RTX 5080 anchored-read failure is tracked separately in AGC test sweep on RTX 5080 and Windows — four reproducible failures #25167.
Fault-capable shaders (usesDma or usesFaultBuffer) retain the existing subgroup-local ReadFirstLane path; no new workgroup barriers are introduced into the BDA fault path.
Improved compatibility for 32-lane compute shaders on devices with smaller subgroup sizes, including shaders that use first-lane reads.
Improved handling of shared-memory limits when these shaders require additional temporary storage, helping preserve shader execution when memory is constrained.
Tests
Expanded coverage for first-lane behavior across subgroup sizes, uneven workgroups, and shared-memory boundaries.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@MarcZX10 Could you review current head 6bfa63a2c3f53dd595754363a6d5785945d57f3b when convenient? The focused gate is 6/6 green, the synthetic subgroup-8 lowering check passes, and the 2,384-PR overlap audit was manually cleared for the reported shared-file branches. The narrow path is limited to convergent Wave32 compute on host subgroups below 32; divergent barrier placement is detected and re-emitted through the existing subgroup-local fallback.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed — comments
The narrow-subgroup exchange is guarded by the barrier uniformity check and the added code generation and execution tests cover a full and partial guest wave; subgroup-8 execution itself was not verified on hardware.
What I ran
Reviewed head 6bfa63a2c3f53dd595754363a6d5785945d57f3b and the prepared diff; no commands or tests were run in this review.
Read the changed implementation and execution test, plus the added ShaderMemory.cpp test range through repo_read.py.
Results
Check
Result
Note
Diff and targeted source review
passed
Reviewed the exchange and its fallback
Tests run in this review
not run
Author reports six passing tests
Subgroup-8 Vulkan execution
not run
No such ICD was available to the author
Findings
Blocking
None.
Non-blocking
The execution test uses the detected Vulkan subgroup size, and the reported RTX 5080 run used subgroup 32. Add or run an execution test on a subgroup-8 device when available to validate runtime behavior of the new path.
Not verified
Did not run the reported tests or independently verify the author-reported results.
No subgroup-8 Vulkan runtime execution was available in the reported environment.
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was read only at the changed test range; its remaining contents were not reviewed. No changed files were excluded by rule, but that file's full text was omitted from the review folder because it was too large.
To get this to a good state
Nothing is required. The optional subgroup-8 runtime validation above would strengthen coverage.
@MarcZX10 Updated current head to c7a6249c0005aecb6ead94bfd830e2bc2339f094 after a BDA interaction audit. The narrow workgroup exchange now fails closed for shaders using DMA/fault-buffer handling, so it does not change #7392's barrier-fault semantics. Rebasing onto current main had no changed-file overlap; the 6-test focused gate, compile-only BDA contracts, conventions, and diff check all pass on this head. Could you review this exact head when convenient?
Following up on the subgroup-8 Vulkan request. I ran an A/B on Windows against e57e2b9930b03a53d492c3caa41c8053526946a4 and GitHub's test merge 78b213a8fe667c4caf28b7ab7f5698e2163b25b5 for head c7a6249c0005aecb6ead94bfd830e2bc2339f094. The PR's 45-invocation fixture was byte-identical in both builds. Shader caching was disabled and the Khronos validation layer was loaded.
On Mesa lavapipe 26.2.6 / LLVM 23.1.4 (Vulkan subgroup 8, software), all three repetitions gave the same results:
Check
Base
PR
Raw V_READFIRSTLANE_B32 mismatches, 32 active / 13 active
24 / 5
0 / 0
Downstream VCC bit mismatches, 32 active / 13 active
24 / 5
15 / 3
First active guest lane 4, wrong scalar lanes out of 32
24
0
Empty EXEC, wrong scalar lanes out of 32
24
32
Details for the two failures:
The checked-in agc_driver_wave32_unequal_buffer_read_first_lane is still 0/3 on subgroup 8. The base stops at the scalar assertion. The PR reaches the VCC assertion. In the separate readback diagnostic, the resulting VCC selections are 0xa9a9a9a9 and 0x1393, with 0x7b36c4a9 and 0x1e93 expected.
For the masked check I used the existing ReadFirstLane shader words with the subgroup-size skip removed and both values printed. Empty EXEC returned 0x00000000 on every lane on the PR. The expected result is lane 0's 0x00000100 (AMD RDNA2 ISA §12.8, VOP1 opcode 2). The last Select in the narrow emitter is consistent with this result: it discards the already loaded lane-0 value and returns a literal zero.
All six focused cases passed on both the Intel UHD and RTX 4070 Laptop GPU, each at native subgroup 32, in three repeats per build. There were no VUID or synchronization diagnostics in the runs on any adapter.
Local lane-0 follow-up on the same test merge. Dropping the final result select and returning the already loaded value after the existing barrier makes the masked subgroup-8 test pass in all three runs. Both empty EXEC and first-active-lane 4 had zero scalar mismatches across 32 lanes per run. The downstream VCC assertion still failed with the same 15/3 bit mismatches. On Intel UHD and RTX 4070 Laptop at subgroup 32 all six cases still passed in three runs per GPU. No VUID or synchronization diagnostics appeared.
@mihiii1337@MarcZX10 Updated current head to 6425a75b0f430d2eaf51c9f35121dc9927e08b1d from the subgroup-8 A/B findings. Empty EXEC now returns guest lane 0 instead of zero; agc_driver_read_first_lane runs its Wave32 empty/first-active checks on narrow subgroups; and the 45-thread unequal-input fixture now isolates scalar ReadFirstLane instead of also asserting the separate VCC-word path owned by #25419. Rebasing onto current main had no changed-file overlap. Exact-head 6/6 focused tests, compile-only BDA contracts, conventions, and diff check pass locally. A lavapipe subgroup-8 rerun of the two ReadFirstLane tests would directly validate the corrected path.
I ran the two requested tests on Windows with GitHub's test merge 1084b0fc718b7a5d27805c25e8bee8ce0d2a3ad2 for head 6425a75b0f430d2eaf51c9f35121dc9927e08b1d.
Vulkan device
Subgroup
agc_driver_read_first_lane
agc_driver_wave32_unequal_buffer_read_first_lane
Mesa lavapipe 26.2.6 / LLVM 23.1.4 (software)
8
3/3
3/3
Intel UHD / Raptor Lake-S Mobile, 31.0.101.5081
32
3/3
3/3
RTX 4070 Laptop GPU, 621.01
32
3/3
3/3
The subgroup-8 logs contain both success markers and show no subgroup-local fallback message. The first fixture checks empty EXEC and first-active lane 4. The second checks the scalar across all 45 active lanes, along with the guard slots. Shader caching was disabled, Vulkan was required, and the Khronos validation layer was loaded for every test. No VUID or synchronization errors appeared.
For tracking the earlier VCC observation, the buffer-fed word falls through #25419's literal/user-data proof to the existing lane predicate. #25404 changes the lane index used by that predicate. The results above cover the revised scalar fixtures.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed — looks good
Nothing blocks this change based on the code reviewed; the reported runtime and compile checks were not run in this review.
What I ran
Reviewed head 6425a75b0f430d2eaf51c9f35121dc9927e08b1d using the prepared diff and pinned repository reader.
No build or test commands were run.
Results
Check
Result
Note
Changed-code review
passed
Read 10 of 11 changed files
Tests and build
not run
Author-reported checks only
Findings
Blocking
None.
Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was excluded from the review folder because it was too large; only the changed region was read through the repository reader. All other changed files listed in review/manifest.json were read.
I did not run builds, tests, the reported GPU scenarios, or verify behavior on physical console hardware. The checks in the description are author-reported.
Integration note from a local detached stack of #25660 head 6425a75b0f430d2eaf51c9f35121dc9927e08b1d plus #25419 head 321c627b0686cc494a741ea404a0b35cc60d9905 (the PRs have no changed-file overlap): the original 45-thread v_readfirstlane_b32 -> s_mov_b32 VCC_LO -> v_cndmask_b32 chain still takes #25419's fallback on a synthetic subgroup-8 target. Instrumenting resolveWave32VccUse reports word=ReadFirstLane, all_lanes=1, complete=0.
A local-only prototype that adds IrOpcode::ReadFirstLane to isCompleteWave32Mask flips that exact use to complete=1; agc_shader_memory_tests still passes. I am not adding that to this PR: doing so in #25419 alone would be unsafe while narrow-host ReadFirstLane is still subgroup-local. Once #25660's guest-wave broadcast semantics are present, this looks like a very small integration follow-up (or needs an equivalent capability/provenance gate).
So this PR remains intentionally scoped to the scalar ReadFirstLane broadcast. The downstream VCC path in the reporter's diagnostic is not yet proven fixed merely by stacking the current #25419 and #25660 heads.
Safety refinement to my integration note: a global isCompleteWave32Mask(ReadFirstLane) = true is not safe, even after #25660 lands. #25660 intentionally disables the narrow exchange for DMA/fault-buffer shaders, and it can also discover a divergent workgroup barrier only after first SPIR-V emission and then re-emit with narrowReadFirstLaneExchange=false.
The ConstantFolder VCC proof runs earlier, before either of those final backend decisions. So a correct follow-up should keep the existing early proof for inherently complete words, but defer any ReadFirstLane-dependent ResolveWave32VccLane/ResolveWave32VccZero decision until SPIR-V emission (or carry an equivalent explicit semantic marker). Then the first emission may use the complete guest-wave word when state.narrowReadFirstLaneExchange is true, while BDA/divergence fallback re-emission can safely use the existing subgroup-local predicate.
I am keeping both current PRs unchanged; this is follow-up integration work, not a reason to broaden either approved patch.
Rebased onto current main (07336cc2004f) with no overlap in the 11 changed files. Exact head: 0b4aa2f6fc39939646ee0e90016b2e83e7cc9014. Rebuilt and reran agc_driver_read_first_lane, agc_driver_wave32_unequal_buffer_read_first_lane, and wave32_wide_subgroup: 3/3 passed; conventions and diff checks pass. The requested subgroup-8 Vulkan runtime A/B was also reported as 3/3 on lavapipe by @mihiii1337 earlier in this discussion. Could you confirm the rebased head? The separate VCC proof integration with #25419 remains intentionally outside this scalar-readfirstlane PR.
Rebased again onto latest main (7dad98050511); all 11 changed-file blobs remain identical. Local conventions and diff checks pass; fresh CI is running. The subgroup-8 evidence from @mihiii1337's follow-up remains applicable: Mesa lavapipe 26.2.6 / LLVM 23.1.4 (subgroup 8), 3/3 for both checked-in tests, plus Intel UHD and RTX 4070 Laptop (subgroup 32), also 3/3, with no VUID or synchronization diagnostics. The separate VCC-proof integration remains a follow-up after #25404 and #25419; this PR stays scoped to scalar ReadFirstLane. Could you re-confirm approval on the current head once CI is green?
I independently tested commit 0b4aa2f6fc39939646ee0e90016b2e83e7cc9014 on Windows 11 with Mesa lavapipe 26.2.6 / LLVM 23.1.4 (software Vulkan, subgroupSize = 8). agc_driver_read_first_lane and agc_driver_wave32_unequal_buffer_read_first_lane each passed 3/3. wave32_wide_subgroup and the conventions check also passed. Shader caching was disabled, Khronos Validation 1.4.369 was active in all six Vulkan runs, and the logs showed no VUIDs or subgroup-local fallback messages.
My verification of the current head 81cee6a76677f4424c5cb5659ea587adaf2ab2b5 was limited to a byte comparison. All 11 changed file blobs match the tested commit. The runtime results above apply to 0b4aa2f6.
@MarcZX10 Rebased onto current main5dcb83a5528b. The upstream changes are outside the 11-file Wave32 readfirstlane diff; no topic code changed. Current head: c9eda9c28ee35609a73c46b534c4888b1eb4b18c. Please re-confirm approval on this head after CI. The optional subgroup-8 hardware run remains unavailable; the existing compile-time and subgroup-32 execution coverage is unchanged.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head c0065b712b90ca51a5e2c4564ba86e81a3745fe5 using the pinned repo_read.py tools. No build or tests were run in this environment.
Read description.md, commits.md, manifest.json, and diff.patch. Inspected the changed shader emission, LDS budgeting and fallback paths, the relevant tests, and confirmed execution tests are globbed from tests/execution/*.cpp.
Results
Check
Result
Note
Changed-code review
passed
No concrete defect found
Tests in this environment
not run
No shell or test runner available
Author-reported checks
not run
Six listed checks passed on the candidate
Findings
Blocking
None.
Non-blocking
The author reports no subgroup-8 Vulkan ICD was available, so the added narrow-host runtime fixture still needs a run on such a device.
Not verified
No tests or build were run here; reported test results are from the author’s description.
Physical-console behavior and the subgroup-8 runtime path were not verified.
Read changed lines and relevant context in all changed files, including ShaderMemory.cpp via repo_read.py; did not read unrelated portions of large files. files.json was not available as a review document; list_files showed all changed files and identified ShaderMemory.cpp as too large to include in the bundle.
To get this to a good state
Nothing is required. Optional: run agc_driver_wave32_unequal_buffer_read_first_lane on a subgroup-8 Vulkan device.
Conflict triage and rebase complete. Rebased all six commits onto latest main 0f107f9; GitHub now reports MERGEABLE. The emitter retains main's spanned-unreachable verification and the PR's narrow ReadFirstLane exchange validation as separate branches.
Local Windows 11 / GCC 15.2 validation: build succeeded; 9/9 focused tests passed on NVIDIA RTX 5080 (subgroup 32) and 9/9 on AMD Radeon(TM) Graphics 0x13c0 (subgroup 64). Khronos validation was loaded on both; zero VUID, synchronization-hazard, or unassigned diagnostics. The deterministic code-generation/LDS-budget tests cover synthetic subgroup 8. No subgroup-8 Vulkan ICD is available here, so a current-head subgroup-8 runtime A/B remains outstanding. The BDA device target compiled and its CPU-selection test passed; the separate full BDA runtime test was not run because of the known RTX 5080 anchored-read issue in #25167.
No review decisions were modified. Marc's and Mihiii's APPROVED reviews remain in the review history. Hosted checks are running on the new head.
Cross-PR integration check: a three-way git merge-tree of rebased heads #23553 (436dd13) and #25660 (6c99e1b) completed with no conflicts (tree b86c49163969). The only shared paths are ShaderMemory.cpp and SpirvEmitterHelpers.cpp; their changes are in separate hunks (depth-export serialization/runtime tests vs narrow-ReadFirstLane codegen tests, and viewport-index input vs workgroup-local-size/input additions). No dependency or merge-order constraint was found.
The SPIR-V requirements track ReadFirstLane. The emitter enables narrow exchange for eligible compute workgroups, and the workgroup-size helpers expose the sizing inputs used by that decision.
The narrow-subgroup path selects the first active lane through workgroup memory, barriers, and atomic minima. The existing ballot-and-shuffle path remains when narrow exchange is disabled.
LDS budgeting and emission fallback core/shader/recompiler/Recompiler.cpp
LDS capacity checks include reserved exchange bytes. When the exchange exceeds the limit, the recompiler retranslates with guest LDS placement. If emission rejects the exchange due to divergent barriers, it retries with the exchange disabled.
SPIR-V and LDS budget validation core/libs/prx/libSceAgcDriver/tests/LdsLockBudget.cpp, ShaderMemory.cpp
Tests check exchange allocation and LDS placement at memory boundaries. SPIR-V checks compare narrow and matching host subgroup sizes.
Execution tests check Wave32 results for unequal inputs. The existing test now runs Wave32 on smaller subgroups and runs Wave64 only when the subgroup size is at least 32.
Possibly related PRs
boykopovar/AnyPS5#25609: It changes the same ReadFirstLane lowering for guest waves that fit within a host subgroup; this PR covers the complementary narrow-subgroup case.
This change makes the Wave32 first-lane read return the correct value on hosts with narrow subgroups. It reserves workgroup memory for the exchange and falls back to the existing path when the exchange is unsupported. The reviewed code shows no remaining merge-blocking issue; the narrow-subgroup path has not been run on hardware at the exact head.
Security architecture risk: Low · up to 6c99e
The new broadcast is limited to eligible compute shaders, and the compiler keeps the old behavior when it detects unsafe synchronization. The remaining risk is that some dispatches may still need extra device memory even when the broadcast is not used.
Retained concerns
Trivial · reliability · inferred: Exchange budgeting can move guest LDS into device memory before the compiler knows whether the exchange will be emitted. Fault exclusion or a uniformity rejection can leave the shader using the old shuffle with the new device-backed LDS requirement. That preserves the synchronization fallback but not its prior resource requirements; the existing split-table dispatch guard can reject device-backed LDS if an affected shader reaches that mode.
inferred — Guest shader code and workgroup configuration influence entry into the new path. The affected scope shown by the source is eligible GPU dispatches: scratch is per workgroup, and spilled LDS uses an existing descriptor-backed buffer with separate offsets for each workgroup. No broader authority grant was established.
Trust Boundaries and Controls
observed — Guest lane activity controls election, not scratch addressing. The compiler derives the slot partition from the local invocation index and rejects a generated module when its analysis detects a barrier in divergent flow, including cases where divergent exits affect later barriers.
Hardening Proposals
proposed — When the exchange is excluded or rejected, reconsider any LDS spill caused only by exchange budgeting before publishing the final module and resource layout. Verify that the resulting fallback retains the prior dispatch compatibility.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
Cppcheck (2.22.0)
Cppcheck (2.22.0) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed — no blocking findings
Nothing blocks this change based on the code inspected; the narrow-subgroup runtime behavior remains unverified.
What I ran
Reviewed PR head 6c99e1b164747b3c3937f5a828d987d54e3b4d7b using the prepared diff and pinned repo_read.py reader. No commands or tests were run. The description reports Windows 11, GCC 15.2, and focused test runs on NVIDIA subgroup 32 and AMD subgroup 64; those are author-reported results.
Results
Check
Result
Note
Diff and changed implementation
passed
Core exchange and LDS budgeting inspected
Tests in this review
not run
No tests executed
Narrow-subgroup runtime
not run
No subgroup-8 runtime device reported
Findings
Blocking
None.
Non-blocking
Consider reporting or otherwise surfacing when divergent control flow makes the exchange unsupported. The catch at core/shader/recompiler/Recompiler.cpp:955 retries with the existing subgroup-local shuffle, which preserves the known narrow-subgroup limitation for those shaders.
Not verified
The full text of core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was excluded by the review-folder size rule; its changed hunk was inspected in diff.patch. No tests were run, and narrow-host runtime behavior was not verified. Other repository files outside the targeted implementation and test context were not inspected.
To get this to a good state
Nothing is required. Optional: make the divergent-flow fallback visible to callers or diagnostics.
The reason will be displayed to describe this comment to others. Learn more.
Architecture findings (1)
Advisory architecture findings (1)
Trivial — Exchange budgeting can move guest LDS into device memory before the compiler knows whether the exchange will be emitted. Fault exclusion or a uniformity rejection can leave the shader using the old shuffle with the new device-backed LDS requirement. That preserves the synchronization fallback but not its prior resource requirements; the existing split-table dispatch guard can reject device-backed LDS if an affected shader reaches that mode.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 951e0444-d8bf-46f6-8c30-b6ba9b924033
Commits
Reviewing files that changed from the base of the PR and between 0f107f9 and 6c99e1b.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Exact-head CI recheck (6c99e1b16474): all checks are complete; 11 succeeded and the only failure is relinker (macos-latest, clang++). The failure is the same frame_capture_minimize_replay / PermissionError from os.killpg(process.pid, 0) also seen on #28166 (and #26686's older run); this PR does not modify tools/frame_capture_minimize.py. The head is merge-tree clean against current main dd5412d54ef5, and its shared edits with #23553 are in separate hunks. I attempted a failed-job rerun, but GitHub requires repository admin rights for that action; this needs an admin rerun or a separate shared-harness fix before the check can be cleared.
Tested 6c99e1b164 merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.
Windows Server 2022 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 3 tests failed out of 7493; 99% tests passed, 2 tests failed out of 7493. 2 of the failing tests fail on main too. run
Windows Server 2025 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 100% tests passed, 0 tests failed out of 7493; 99% tests passed, 1 tests failed out of 7493. 1 of the failing tests fail on main too. run
Not covered: GPU. This pull request changes GPU code, and the GitHub-hosted runners above have no GPU, so the Vulkan and GPU tests fail there on main and on this pull request alike. This result says nothing about the changed GPU paths; they still need a run on a real GPU.
AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.
The reason will be displayed to describe this comment to others. Learn more.
The unequal-input fixture checks both guest waves in a 45-thread workgroup, including the partial final wave. Please run it on a Vulkan device that actually selects a subgroup below 32, and include the chosen subgroup width with the result. The synthetic SPIR-V and LDS-budget checks confirm emission and accounting. The listed hardware runs have subgroup sizes 32 and 64, so the narrow exchange's workgroup barriers and observed results still need runtime evidence. I queued the common tests and unequal-input fixture on lavapipe.
…32-lane hosts
A wave64 pixel program on a 32-lane host refused v_readlane_b32 of lane 63
of a half-wave scan whose keys are selected by an s_wqm_b64 mask, because the
entry-lane proof requires keys of non-helper lanes only. Such a mask still
holds no lane the wave does not launch, so lane 63 is the identity; lane 31
combines each quad's keys with quad broadcasts before the subgroup reduction,
since Vulkan may leave helper invocations out of subgroup arithmetic. Adds
are excluded (a quad combine counts keys more than once) and masks that may
hold unlaunched lanes still throw.
The open PRs boykopovar#25404, boykopovar#25660, boykopovar#25419 and boykopovar#25609 were evaluated for this
refusal; all four change Wave32 compute masks or readfirstlane on narrow
hosts and do not reach a wave64 pixel lane-63 read, so none is ported.
Seen in PPSA38500 pixel shaders 0x106ccc7000, 0x106ccdcc00, 0x106ced0c00
and 0x106cee6800 (an OR scan in a waterfall loop under WQM).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Broadcast
v_readfirstlane_b32over the complete guest Wave32 when a compute shader runs on host subgroups narrower than 32 lanes. Each invocation publishes its source in workgroup memory, active guest lanes atomically elect the lowest lane within their own 32-lane guest wave, and all invocations read that guest-wave slot after a workgroup barrier. Separate slots keep multiple guest waves in the same workgroup independent, including a partial final wave.The workgroup exchange is only emitted for Wave32 compute on a host subgroup below 32 lanes. The emitted module is checked with the existing barrier-uniformity analysis; if a
ReadFirstLaneexchange sits in per-invocation divergent control flow, compilation retries with the existing subgroup-local shuffle instead of risking an incomplete workgroup barrier. That divergent case therefore keeps the previous narrow-subgroup limitation rather than hanging. Fault-capable shaders (usesDmaorusesFaultBuffer) also keep the existing subgroup-local path, so this PR does not introduce workgroup barriers into the separate barrier-safe BDA fault problem tracked by #7392.This addresses the unequal-input
V_READFIRSTLANE_B32reproduction discussed in #25298, including the ISA lane-0 fallback whenEXECis empty. #25419 covers the separate complete-VCC-word problem; the execution fixture here intentionally stops before scalar-word-to-VCC selection so the two fixes remain independently testable. #25609 changesReadFirstLanewhen a guest wave already fits inside one host subgroup and explicitly falls back to the shuffle when the guest wave is wider than the host subgroup, so the narrow-host path here is separate.Tested
Windows 11 Education build 26200, WinLibs GCC 15.2.0, CMake/Ninja Release; rebased onto current main 0f107f9. Rebased head: 6c99e1b.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repositorySummary by CodeRabbit