fix(shader): broadcast Wave32 readfirstlane on narrow subgroups #25660

Open
malekaifa wants to merge 6 commits from upstream-pr/25660 into main
malekaifa commented 2026-11-22 13:39:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-11-22T13:39:44Z.


What

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 0f107f9812. Rebased head: 6c99e1b164.

  • 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 #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.
  • The fail-closed shared-file branches and adjacent overlaps remain orthogonal: #7392 BDA barrier faults, #12324 Wave64 single-lane analysis, #12944 ordered GDS launch state, #23244 Wave64 workgroup splitting, #14218/#15548/#17611/#20519. The earlier overlap scan found no PR implementing this same narrow-subgroup exchange.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 5080 (subgroup 32); AMD Radeon(TM) Graphics 0x13c0 (subgroup 64); synthetic subgroup-8 target path covered by deterministic SPIR-V/code-generation and LDS-budget tests; subgroup-8 runtime ICD unavailable
  • AI-assisted: yes

Summary by CodeRabbit

  • Bug Fixes
    • 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.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5439531383 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660). Originally posted by [malekaifa](https://github.com/malekaifa) on 2026-11-22T13:39:44Z. --- ### What 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 0f107f9812dfb9d8293ee8244bb8dfca0cd932eb. Rebased head: 6c99e1b164747b3c3937f5a828d987d54e3b4d7b. - 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 #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. - The fail-closed shared-file branches and adjacent overlaps remain orthogonal: #7392 BDA barrier faults, #12324 Wave64 single-lane analysis, #12944 ordered GDS launch state, #23244 Wave64 workgroup splitting, #14218/#15548/#17611/#20519. The earlier overlap scan found no PR implementing this same narrow-subgroup exchange. ### 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 and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [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: none - [x] GPUs tested: NVIDIA GeForce RTX 5080 (subgroup 32); AMD Radeon(TM) Graphics 0x13c0 (subgroup 64); synthetic subgroup-8 target path covered by deterministic SPIR-V/code-generation and LDS-budget tests; subgroup-8 runtime ICD unavailable - [x] AI-assisted: yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
copilot-pull-request-reviewer[bot] commented 2026-11-22 13:39:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-22T13:39:53Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012530509 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6012530509). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-22T13:39:53Z. **Review:** COMMENTED --- 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 commented 2026-11-22 13:50:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T13:50:31Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012571146 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6012571146). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T13:50:31Z. **Review:** COMMENTED --- # 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 commented 2026-11-22 14:17:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T14:17:08Z.

Review: APPROVED


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.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6012678292 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6012678292). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T14:17:08Z. **Review:** APPROVED --- # 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. ## To get this to a good state Nothing is required.
mihiii1337 commented 2026-11-23 06:33:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T06:33:05Z.

Review: CHANGES_REQUESTED


The narrow-subgroup exchange needs to participate in the existing Workgroup-memory budget before it is enabled. Vulkan requires the sum of all Workgroup variables and padding in a compute module to stay within maxComputeSharedMemorySize (VUID-RuntimeSpirv-Workgroup-06530).

A supported boundary case exceeds it on this head: 128 invocations, subgroup size 8, 63 guest LDS blocks (ldsSizeDwords=8064, 32,256 bytes), and a 32,768-byte host limit. DeviceMemoryLdsBytes currently keeps that LDS in Workgroup because it budgets only bytes + 4. This exchange then declares 128 + ceil(128/32) = 132 dwords (528 bytes), for 32,784 total—16 bytes over the device limit. The guest LDS block count is accepted by ShaderInputState.cpp, and ordinary live DS access keeps the guest LDS allocation present.

Please reserve the exchange together with guest LDS (for example, make the combined budget move guest LDS to its existing device-memory path when required) and add a host regression at the boundary with both live DS access and convergent ReadFirstLane. LdsLockBudget.cpp::workgroupBytes already parses and sums all Workgroup variables. The new 45-thread fixture has ldsSizeDwords=0, so the otherwise useful subgroup-8 coverage cannot catch this coexistence case.

This is a static review of exact head a252ab14051e1700253dd4dddbaf1cc980af5212; I did not run a GPU or shader binary for this finding.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017416133 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6017416133). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T06:33:05Z. **Review:** CHANGES_REQUESTED --- The narrow-subgroup exchange needs to participate in the existing Workgroup-memory budget before it is enabled. Vulkan requires the sum of all `Workgroup` variables and padding in a compute module to stay within `maxComputeSharedMemorySize` ([VUID-RuntimeSpirv-Workgroup-06530](https://docs.vulkan.org/refpages/latest/refpages/source/RuntimeSpirv.html#VUID-RuntimeSpirv-Workgroup-06530)). A supported boundary case exceeds it on this head: 128 invocations, subgroup size 8, 63 guest LDS blocks (`ldsSizeDwords=8064`, 32,256 bytes), and a 32,768-byte host limit. `DeviceMemoryLdsBytes` currently keeps that LDS in `Workgroup` because it budgets only `bytes + 4`. This exchange then declares `128 + ceil(128/32) = 132` dwords (528 bytes), for 32,784 total—16 bytes over the device limit. The guest LDS block count is accepted by `ShaderInputState.cpp`, and ordinary live DS access keeps the guest LDS allocation present. Please reserve the exchange together with guest LDS (for example, make the combined budget move guest LDS to its existing device-memory path when required) and add a host regression at the boundary with both live DS access and convergent ReadFirstLane. `LdsLockBudget.cpp::workgroupBytes` already parses and sums all Workgroup variables. The new 45-thread fixture has `ldsSizeDwords=0`, so the otherwise useful subgroup-8 coverage cannot catch this coexistence case. This is a static review of exact head `a252ab14051e1700253dd4dddbaf1cc980af5212`; I did not run a GPU or shader binary for this finding. AI-assisted: yes.
mihiii1337 commented 2026-11-23 06:46:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T06:46:30Z.

Review: CHANGES_REQUESTED


The production budget now covers the original boundary for ordinary nonzero compute dimensions, but the new regression does not exercise the exchange whose coexistence caused the bug.

The fixture ends with v_readfirstlane_b32 s8, v1 followed immediately by s_endpgm; s8 is never consumed. SSA/DCE can remove that pure ReadFirstLane before SPIR-V emission, so SpirvAnalysis never enables narrowReadFirstLaneExchange. The new frontend reservation nevertheless scans the raw decoded opcode and moves guest LDS to device memory. Both assertions then pass: workgroupMemoryDwords reflects the raw reservation, and workgroupBytes <= limit accepts a module with no exchange at all.

Please make the RFL result live and observable after the read (with a lane-dependent source and a following DS/buffer use), then positively assert that both threshold arms contain the wave32_readfirstlane_exchange footprint—such as its named Workgroup variable / OpAtomicUMin / expected exchange byte lower bound. At the combined boundary, the test should prove guest LDS and the 528-byte exchange coexist; just below it, it should prove the exchange remains while guest LDS spills.

A secondary implementation note is that the raw-opcode reservation is intentionally a conservative superset of the live emitter gate, so dead, fault-gated, or fallback RFL instructions may spill LDS unnecessarily. Aligning the reservation with the live requirement would avoid that cost, but the blocking request here is a regression that actually pins the correctness boundary.

Static review of exact head 541e7950417c590716fd909521bbbbf3dc9426ad; no GPU or shader executable was run.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017512695 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6017512695). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T06:46:30Z. **Review:** CHANGES_REQUESTED --- The production budget now covers the original boundary for ordinary nonzero compute dimensions, but the new regression does not exercise the exchange whose coexistence caused the bug. The fixture ends with `v_readfirstlane_b32 s8, v1` followed immediately by `s_endpgm`; `s8` is never consumed. SSA/DCE can remove that pure ReadFirstLane before SPIR-V emission, so `SpirvAnalysis` never enables `narrowReadFirstLaneExchange`. The new frontend reservation nevertheless scans the raw decoded opcode and moves guest LDS to device memory. Both assertions then pass: `workgroupMemoryDwords` reflects the raw reservation, and `workgroupBytes <= limit` accepts a module with no exchange at all. Please make the RFL result live and observable after the read (with a lane-dependent source and a following DS/buffer use), then positively assert that both threshold arms contain the `wave32_readfirstlane_exchange` footprint—such as its named Workgroup variable / `OpAtomicUMin` / expected exchange byte lower bound. At the combined boundary, the test should prove guest LDS and the 528-byte exchange coexist; just below it, it should prove the exchange remains while guest LDS spills. A secondary implementation note is that the raw-opcode reservation is intentionally a conservative superset of the live emitter gate, so dead, fault-gated, or fallback RFL instructions may spill LDS unnecessarily. Aligning the reservation with the live requirement would avoid that cost, but the blocking request here is a regression that actually pins the correctness boundary. Static review of exact head `541e7950417c590716fd909521bbbbf3dc9426ad`; no GPU or shader executable was run. AI-assisted: yes.
MarcZX10 commented 2026-11-23 06:56:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T06:56:12Z.

Review: COMMENTED


Reviewed — comments

The exchange can exceed the device’s shared-memory limit for workgroups whose size differs from the compile-time estimate, so please resolve the sizing mismatch before merge.

What I ran

Reviewed head 541e7950417c590716fd909521bbbbf3dc9426ad. No commands or tests were run; the repository reader was used for targeted source reads.

Results

Check Result Note
Diff and description passed Prepared bundle reviewed
Targeted source review passed Compiler exchange and sizing paths read
Tests not run Author-reported results only

Findings

Blocking

None verified.

Non-blocking

  • Recompiler.cpp:181-184 sizes the reserved exchange from request.context.compute->numThreads, while SpirvAluEmitterMath.cpp:1807-1810 allocates it using WorkgroupLocalSize. If those values differ, the LDS spill decision can under-reserve shared memory. Please confirm they are guaranteed to match for this compilation path, or calculate both estimates from the same source.

Not verified

The full text for ShaderMemory.cpp was excluded as too large by the review bundle; the changed test section was read through the reader. The complete contents of files.json were not available through the reader. Remaining changed-file text and build/test wiring were not inspected. Tests and hardware execution were not run; results in the PR description are author-reported.

To get this to a good state

Nothing is required. Please consider clarifying or unifying the workgroup-size source used for shared-memory budgeting and exchange allocation.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017584922 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6017584922). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T06:56:12Z. **Review:** COMMENTED --- # Reviewed — comments The exchange can exceed the device’s shared-memory limit for workgroups whose size differs from the compile-time estimate, so please resolve the sizing mismatch before merge. ## What I ran Reviewed head `541e7950417c590716fd909521bbbbf3dc9426ad`. No commands or tests were run; the repository reader was used for targeted source reads. ## Results | Check | Result | Note | |---|---|---| | Diff and description | passed | Prepared bundle reviewed | | Targeted source review | passed | Compiler exchange and sizing paths read | | Tests | not run | Author-reported results only | ## Findings ### Blocking None verified. ### Non-blocking - `Recompiler.cpp:181-184` sizes the reserved exchange from `request.context.compute->numThreads`, while `SpirvAluEmitterMath.cpp:1807-1810` allocates it using `WorkgroupLocalSize`. If those values differ, the LDS spill decision can under-reserve shared memory. Please confirm they are guaranteed to match for this compilation path, or calculate both estimates from the same source. ## Not verified The full text for `ShaderMemory.cpp` was excluded as too large by the review bundle; the changed test section was read through the reader. The complete contents of `files.json` were not available through the reader. Remaining changed-file text and build/test wiring were not inspected. Tests and hardware execution were not run; results in the PR description are author-reported. ## To get this to a good state Nothing is required. Please consider clarifying or unifying the workgroup-size source used for shared-memory budgeting and exchange allocation.
throny commented 2026-11-23 07:01:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by throny on 2026-11-23T07:01:30Z.

Review: COMMENTED


GPU re-run: ✅ no new failures or validation errors on Windows / NVIDIA

Basis: built and ran · this PR's head 541e795041 merged onto main 337a948bf1 · Windows 11 Pro 26300, RTX 4080 (10de:2704, driver 610.88), WinLibs GCC 15.2.0 r7, Release

Checked

  • The agc_* tests tools/select_tests.py selects for this change: 2062 of 2063 passed, run with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer (Khronos validation layer, nightly 1.4.369, newer than the 1.4.335 minimum).
  • The loader logged Insert instance layer "VK_LAYER_KHRONOS_validation" 1895 times and never was not found but was requested by env var VK_INSTANCE_LAYERS.
  • 0 VUID- messages, the same as a full agc_* run of main 337a948bf1 on this machine with the same settings (2061 of 2062 passed there; the extra test is new in this PR).
  • The new test agc_driver_wave32_unequal_buffer_read_first_lane passes (it is not on main).
  • The failure is agc_driver_store_over_untracked, which also fails intermittently on main here (#22670), not this change.

Findings: none from this run; this is a correctness run on a GPU, not a code review or a speed measurement.

AI-assisted test run (Claude Code) · head 541e795041 · base main 337a948bf1

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017626419 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6017626419). Originally posted by [throny](https://github.com/throny) on 2026-11-23T07:01:30Z. **Review:** COMMENTED --- ### GPU re-run: ✅ no new failures or validation errors on Windows / NVIDIA **Basis:** built and ran · this PR's head `541e795041` merged onto `main` `337a948bf1` · Windows 11 Pro 26300, RTX 4080 (`10de:2704`, driver 610.88), WinLibs GCC 15.2.0 r7, Release **Checked** - The `agc_*` tests `tools/select_tests.py` selects for this change: **2062 of 2063 passed**, run with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer` (Khronos validation layer, nightly 1.4.369, newer than the 1.4.335 minimum). - The loader logged `Insert instance layer "VK_LAYER_KHRONOS_validation"` 1895 times and never `was not found but was requested by env var VK_INSTANCE_LAYERS`. - **0 `VUID-` messages**, the same as a full `agc_*` run of `main` `337a948bf1` on this machine with the same settings (2061 of 2062 passed there; the extra test is new in this PR). - The new test `agc_driver_wave32_unequal_buffer_read_first_lane` passes (it is not on `main`). - The failure is `agc_driver_store_over_untracked`, which also fails intermittently on `main` here (#22670), not this change. **Findings:** none from this run; this is a correctness run on a GPU, not a code review or a speed measurement. <sub>AI-assisted test run (Claude Code) · head `541e795041` · base `main` `337a948bf1`</sub>
mihiii1337 commented 2026-11-23 09:18:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T09:18:17Z.

Review: CHANGES_REQUESTED


Re-reviewed exact head a910b4c40f769bcf8b0c920b4b3ee69e8705117e. The new commit resolves my earlier regression-test blocker: the ReadFirstLane value is now consumed, and both budget arms positively contain the named 528-byte wave32_readfirstlane_exchange. That part no longer blocks.

A separate production sizing mismatch remains. NarrowReadFirstLaneExchangeBytes computes the reservation from raw request.context.compute->numThreads, treating zero X/Y dimensions as 1. The emitter computes the actual array from WorkgroupLocalSize, which treats zero X/Y as 2 when compute derivatives are required. Therefore the budget and emitted module can disagree.

Concrete static witness for Wave32 on a subgroup-8 host: raw {128, 0, 1} with compute derivatives is budgeted as 128 threads, so the frontend reserves (128 + 4) * 4 = 528 bytes. The emitter's effective local size is 256 threads and allocates (256 + 8) * 4 = 1056 bytes. With 31,744 bytes of guest LDS, the frontend sees 31,744 + 528 + 4 <= 32,768 and keeps it in Workgroup memory, while the emitted guest LDS plus exchange is 32,800 bytes. Please derive both decisions from the same effective local-size calculation and add this derivatives/zero-dimension boundary to LdsLockBudget.

The updated fixture uses {128,1,1} without derivatives, so its two calculations agree and it cannot catch this mismatch. The current head otherwise changes only that fixture; the production sizing paths are unchanged. The R9700 hardware report correctly notes that its subgroup 32/64 device never takes this narrow-host exchange. My check is source/arithmetic plus exact-head diff/CI inspection; I did not run a local GPU test. Hosted exact-head jobs are still queued.

The independently observed dead-ReadFirstLane reservation can cause an unnecessary LDS spill, but I treat that as a separate non-blocking performance follow-up.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6019071721 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6019071721). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T09:18:17Z. **Review:** CHANGES_REQUESTED --- Re-reviewed exact head `a910b4c40f769bcf8b0c920b4b3ee69e8705117e`. The new commit resolves my earlier regression-test blocker: the ReadFirstLane value is now consumed, and both budget arms positively contain the named 528-byte `wave32_readfirstlane_exchange`. That part no longer blocks. A separate production sizing mismatch remains. `NarrowReadFirstLaneExchangeBytes` computes the reservation from raw `request.context.compute->numThreads`, treating zero X/Y dimensions as 1. The emitter computes the actual array from `WorkgroupLocalSize`, which treats zero X/Y as 2 when compute derivatives are required. Therefore the budget and emitted module can disagree. Concrete static witness for Wave32 on a subgroup-8 host: raw `{128, 0, 1}` with compute derivatives is budgeted as 128 threads, so the frontend reserves `(128 + 4) * 4 = 528` bytes. The emitter's effective local size is 256 threads and allocates `(256 + 8) * 4 = 1056` bytes. With 31,744 bytes of guest LDS, the frontend sees `31,744 + 528 + 4 <= 32,768` and keeps it in Workgroup memory, while the emitted guest LDS plus exchange is 32,800 bytes. Please derive both decisions from the same effective local-size calculation and add this derivatives/zero-dimension boundary to `LdsLockBudget`. The updated fixture uses `{128,1,1}` without derivatives, so its two calculations agree and it cannot catch this mismatch. The current head otherwise changes only that fixture; the production sizing paths are unchanged. The R9700 hardware report correctly notes that its subgroup 32/64 device never takes this narrow-host exchange. My check is source/arithmetic plus exact-head diff/CI inspection; I did not run a local GPU test. Hosted exact-head jobs are still queued. The independently observed dead-ReadFirstLane reservation can cause an unnecessary LDS spill, but I treat that as a separate non-blocking performance follow-up. AI-assisted: yes.
mihiii1337 commented 2026-11-23 09:31:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T09:31:06Z.

Review: CHANGES_REQUESTED


Re-reviewed exact head 1b541dd5891560d81a11ce9e7139043df8bf1e2b. The new two-pass translation usefully resolves the non-blocking dead-ReadFirstLane spill: it now reserves the exchange only after a live IrOpcode::ReadFirstLane survives simplification. The prior fixture-liveness fix also remains.

The blocking dimension mismatch is unchanged. The second-pass decision still computes exchangeBytes through NarrowReadFirstLaneExchangeBytes, which treats raw zero X/Y dimensions as 1, while the eventual emitter's WorkgroupLocalSize substitutes 2 for zero X/Y when compute derivatives are required. The same concrete witness therefore skips the new retranslation entirely:

  • Wave32, subgroup 8, raw {128,0,1}, compute derivatives, guest LDS 31,744 bytes, limit 32,768;
  • frontend calculates 128 threads and 528 exchange bytes, so DeviceMemoryLdsBytes(..., 528) returns zero and the if is not entered;
  • emitter calculates 256 effective threads and allocates a 1,056-byte exchange, producing 32,800 bytes of Workgroup storage.

Please compute the reservation from the same effective local size used by the emitter (including derivative defaults/lane transforms), then add this zero-dimension derivatives boundary to LdsLockBudget. The current {128,1,1} non-derivative case still makes both calculations agree and cannot catch it.

This review is source/arithmetic on the exact delta; the relevant sizing functions are otherwise unchanged from the previous head. Fresh hosted checks are queued. I did not run a GPU test, and the reported subgroup-32/64 hardware cannot enter the narrow-host path.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6019227254 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6019227254). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T09:31:06Z. **Review:** CHANGES_REQUESTED --- Re-reviewed exact head `1b541dd5891560d81a11ce9e7139043df8bf1e2b`. The new two-pass translation usefully resolves the non-blocking dead-ReadFirstLane spill: it now reserves the exchange only after a live `IrOpcode::ReadFirstLane` survives simplification. The prior fixture-liveness fix also remains. The blocking dimension mismatch is unchanged. The second-pass decision still computes `exchangeBytes` through `NarrowReadFirstLaneExchangeBytes`, which treats raw zero X/Y dimensions as 1, while the eventual emitter's `WorkgroupLocalSize` substitutes 2 for zero X/Y when compute derivatives are required. The same concrete witness therefore skips the new retranslation entirely: - Wave32, subgroup 8, raw `{128,0,1}`, compute derivatives, guest LDS 31,744 bytes, limit 32,768; - frontend calculates 128 threads and 528 exchange bytes, so `DeviceMemoryLdsBytes(..., 528)` returns zero and the `if` is not entered; - emitter calculates 256 effective threads and allocates a 1,056-byte exchange, producing 32,800 bytes of Workgroup storage. Please compute the reservation from the same effective local size used by the emitter (including derivative defaults/lane transforms), then add this zero-dimension derivatives boundary to `LdsLockBudget`. The current `{128,1,1}` non-derivative case still makes both calculations agree and cannot catch it. This review is source/arithmetic on the exact delta; the relevant sizing functions are otherwise unchanged from the previous head. Fresh hosted checks are queued. I did not run a GPU test, and the reported subgroup-32/64 hardware cannot enter the narrow-host path. AI-assisted: yes.
MarcZX10 commented 2026-11-23 09:32:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T09:32:01Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the narrow-subgroup runtime rerun remains unverified and is an optional follow-up.

What I ran

Reviewed head 1b541dd5891560d81a11ce9e7139043df8bf1e2b. I read the prepared description, commits, diff, manifest, and all included changed files, then inspected the changed code paths and relevant callers with repo_read.py. No tests or builds were run. The full ShaderMemory.cpp text was excluded because it exceeded the review-folder size limit; the relevant changed hunk was available in the diff.

Results

Check Result Note
Source review passed Changed runtime and code-generation paths inspected
Tests and build not run No commands were available through the reader
Narrow-subgroup runtime not run Description reports no subgroup-8 Vulkan ICD

Findings

Blocking

None.

Non-blocking

  • The end-to-end unequal-input regression has not been confirmed on a subgroup-8 Vulkan device. The description reports that no such ICD was installed; the synthetic subgroup-8 SPIR-V checks cover code generation and barrier uniformity, but not runtime behavior.

Not verified

  • Runtime behavior on a host with subgroup size below 32, including the new 45-thread partial-wave fixture.
  • Full ShaderMemory.cpp contents; only the changed diff hunk was inspected.
  • Test/build execution on the exact head. Test results in the PR description are author-reported, not run in this review.
  • Excluded files listed in files.json were not available for review. The prepared manifest marks nine changed files as included; eight full files were read, and ShaderMemory.cpp was excluded by size.

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 and report the result.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6019238555 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6019238555). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T09:32:01Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the narrow-subgroup runtime rerun remains unverified and is an optional follow-up. ## What I ran Reviewed head `1b541dd5891560d81a11ce9e7139043df8bf1e2b`. I read the prepared description, commits, diff, manifest, and all included changed files, then inspected the changed code paths and relevant callers with `repo_read.py`. No tests or builds were run. The full `ShaderMemory.cpp` text was excluded because it exceeded the review-folder size limit; the relevant changed hunk was available in the diff. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Changed runtime and code-generation paths inspected | | Tests and build | not run | No commands were available through the reader | | Narrow-subgroup runtime | not run | Description reports no subgroup-8 Vulkan ICD | ## Findings ### Blocking None. ### Non-blocking - The end-to-end unequal-input regression has not been confirmed on a subgroup-8 Vulkan device. The description reports that no such ICD was installed; the synthetic subgroup-8 SPIR-V checks cover code generation and barrier uniformity, but not runtime behavior. ## Not verified - Runtime behavior on a host with subgroup size below 32, including the new 45-thread partial-wave fixture. - Full `ShaderMemory.cpp` contents; only the changed diff hunk was inspected. - Test/build execution on the exact head. Test results in the PR description are author-reported, not run in this review. - Excluded files listed in `files.json` were not available for review. The prepared manifest marks nine changed files as included; eight full files were read, and `ShaderMemory.cpp` was excluded by size. ## 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 and report the result.
mihiii1337 commented 2026-11-23 13:24:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T13:24:51Z.

Review: APPROVED


Re-reviewed exact head c0065b712b90ca51a5e2c4564ba86e81a3745fe5. This resolves my remaining sizing blocker.

After simplification, the resource pass now derives both liveness inputs from the surviving IR and calls the same WorkgroupLocalSize helper as the emitter. For the reported {128,0,1} compute-derivative case it therefore uses the effective {128,2,1} size: 256 invocations, 8 guest waves, and a 1,056-byte exchange. With 31,744 bytes of guest LDS, the combined budget selects the existing device-memory LDS path instead of emitting 32,800 bytes of Workgroup storage.

I independently compiled the exact helper/callsite and compared the sizing arms: this head reserves 1,056 bytes and spills the 31,744-byte LDS; the parent behavior and an intentional computeDerivatives=false control reserve 528 bytes and incorrectly keep it; a dead-ReadFirstLane control reserves nothing. The checked-in boundary arithmetic passes and the exact-head hosted Windows run executes agc_lds_lock_budget successfully (227/227 selected tests overall).

The checked-in derivative addition tests the shared helper and boundary arithmetic rather than recompiling a derivative shader, so an end-to-end SPIR-V assertion would make the regression stronger, but I do not consider that a remaining correctness blocker after the production-path and negative-control checks above.

My local exact target compiled and linked, but Microsoft Defender quarantined the generated AGC test executable before execution under a heuristic that has also affected other locally built AGC test binaries. I did not restore, allow, exclude, or execute it, so I am not claiming a local binary run.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6022456951 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6022456951). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T13:24:51Z. **Review:** APPROVED --- Re-reviewed exact head `c0065b712b90ca51a5e2c4564ba86e81a3745fe5`. This resolves my remaining sizing blocker. After simplification, the resource pass now derives both liveness inputs from the surviving IR and calls the same `WorkgroupLocalSize` helper as the emitter. For the reported `{128,0,1}` compute-derivative case it therefore uses the effective `{128,2,1}` size: 256 invocations, 8 guest waves, and a 1,056-byte exchange. With 31,744 bytes of guest LDS, the combined budget selects the existing device-memory LDS path instead of emitting 32,800 bytes of Workgroup storage. I independently compiled the exact helper/callsite and compared the sizing arms: this head reserves 1,056 bytes and spills the 31,744-byte LDS; the parent behavior and an intentional `computeDerivatives=false` control reserve 528 bytes and incorrectly keep it; a dead-ReadFirstLane control reserves nothing. The checked-in boundary arithmetic passes and the exact-head hosted Windows run executes `agc_lds_lock_budget` successfully (227/227 selected tests overall). The checked-in derivative addition tests the shared helper and boundary arithmetic rather than recompiling a derivative shader, so an end-to-end SPIR-V assertion would make the regression stronger, but I do not consider that a remaining correctness blocker after the production-path and negative-control checks above. My local exact target compiled and linked, but Microsoft Defender quarantined the generated AGC test executable before execution under a heuristic that has also affected other locally built AGC test binaries. I did not restore, allow, exclude, or execute it, so I am not claiming a local binary run. AI-assisted: yes.
MarcZX10 commented 2026-11-24 23:27:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-24T23:27:29Z.

Review: APPROVED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6049045875 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6049045875). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-24T23:27:29Z. **Review:** APPROVED --- # 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.
MarcZX10 commented 2026-11-30 09:17:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T09:17:38Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6109500767 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6109500767). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-30T09:17:38Z. **Review:** COMMENTED --- # 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.
coderabbitai[bot] commented 2026-11-30 09:22:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T09:22:03Z.

Review: COMMENTED


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 0f107f9812 and 6c99e1b164.

Files selected for processing: 13

  • core/libs/prx/libSceAgcDriver/tests/LdsLockBudget.cpp
  • core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
  • core/libs/prx/libSceAgcDriver/tests/execution/ReadFirstLane.cpp
  • core/libs/prx/libSceAgcDriver/tests/execution/Wave32UnequalBufferReadFirstLane.cpp
  • core/shader/recompiler/Recompiler.cpp
  • core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvAnalysis.hpp
  • core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hpp
  • core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp
  • core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp
  • core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cpp
  • core/shader/recompiler/SpirvBackend/src/SpirvAnalysis.cpp
  • core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp
  • core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6109562754 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6109562754). Originally posted by [coderabbitai[bot]](https://github.com/apps/coderabbitai) on 2026-11-30T09:22:03Z. **Review:** COMMENTED --- <!-- coderabbit-ai-generated:v1 --> **Architecture findings (1)** <details> <summary>Advisory architecture findings (1)</summary> <dl> <dd> <br> - **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. </dd> </dl> </details> <h6> <details> <summary><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Review info</summary> <dl> <dd> <br> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</summary> <dl> <dd> <br> - **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` </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 0f107f9812dfb9d8293ee8244bb8dfca0cd932eb and 6c99e1b164747b3c3937f5a828d987d54e3b4d7b. </dd> </dl> </details> <details> <summary><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 13</summary> <dl> <dd> <br> * `core/libs/prx/libSceAgcDriver/tests/LdsLockBudget.cpp` * `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` * `core/libs/prx/libSceAgcDriver/tests/execution/ReadFirstLane.cpp` * `core/libs/prx/libSceAgcDriver/tests/execution/Wave32UnequalBufferReadFirstLane.cpp` * `core/shader/recompiler/Recompiler.cpp` * `core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvAnalysis.hpp` * `core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitter.hpp` * `core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp` * `core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hpp` * `core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cpp` * `core/shader/recompiler/SpirvBackend/src/SpirvAnalysis.cpp` * `core/shader/recompiler/SpirvBackend/src/SpirvEmitter.cpp` * `core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=e8e93b12-fabc-45d4-a040-06173cb121c0 attempt=1703d3ec-5058-424c-93e1-b35941289c53 batch=1/1 -->
ligmaSec commented 2026-12-03 21:31:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:31:35Z.

Review: COMMENTED


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.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6178955740 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25660#pullrequestreview-6178955740). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T21:31:35Z. **Review:** COMMENTED --- 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. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/25660:upstream-pr/25660'
git switch 'upstream-pr/25660'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/25660'
git switch 'upstream-pr/25660'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/25660'
git switch 'upstream-pr/25660'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/25660'
git switch 'main'
git merge --squash 'upstream-pr/25660'
git switch 'main'
git merge --ff-only 'upstream-pr/25660'
git switch 'main'
git merge 'upstream-pr/25660'
git push origin 'main'
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!25660
No description provided.