renderer: run compute groups over the host's invocation limit with 32-lane subgroups #2567

Open
github-bot wants to merge 3 commits from github-bot/gh-2567 into main AGit
Owner

@⁠Nawid3333 on GitHub · 2026-11-26 19:32 UTC · original
Nawid3333:fix/compute-group-host-limit → main · +81 −7 · 6 files · 3 commits · open

Cause

MLB The Show 23 (#2247) stops at the EXIT_NOT_IMPLEMENTED after createComputePipelines (shaders.cpp:394 in the report, shaders.cpp:453 on current main) on an RX 6700 XT. The pipeline that fails is compute shader 0xd3b11028b2ced580, a wave64 shader with a 16x16x6 group: 1536 threads, 24 waves of 64, with an LDS array and a barrier. Vulkan allows at most maxComputeWorkGroupInvocations invocations per group; AMD's driver reports 1024 (on the RDNA2 iGPU of a Ryzen 7600X here), and the reporter's RX 6700 XT refuses the 1536-invocation pipeline.

On AMD hosts Kyty compiles wave64 compute shaders for 64-wide subgroups (SupportsComputeWave64), one guest lane per invocation, so the module asks for 1536 invocations. Kyty already has a mode that runs two guest lanes per invocation on 32-wide subgroups (host_subgroup_size 32, used on NVIDIA); with it this group needs 768 invocations.

Change

  • GetComputeProgram: a wave64 group with more threads than maxComputeWorkGroupInvocations is compiled with host_subgroup_size 32 when compute subgroup size control is enabled and the device allows 32-wide subgroups. Only wave64 shaders have the two-lane mode, so other groups are left as they are. The size is part of the program key, so such a group gets its own module.
  • CompiledShaderInfo::subgroup_size (stored with the module) is the subgroup size the module was compiled for: the guest wave size, or 32 for a two-lane module. CreatePipelineInternal requires that size for compute pipelines instead of the guest wave size, since a two-lane module run on 64-wide subgroups reads the wrong lanes. The shader store drops stores of other builds (BuildStamp in its header), so stored modules always carry the field.
  • The test harness enables subgroupSizeControl and fills the subgroup size fields of the render context as vulkanWindow.cpp does, so compute pipelines in the tests request their subgroup size like the emulator.

Test

The end of CheckNativeIndirectDispatch (--native-indirect-only) runs a 16x16x6 wave64 group: each thread writes its index plus one to LDS, waits at s_barrier, reads the slot of thread 1535 minus its index, and reads the thread index of lane 63 of its wave with v_readlane. Every thread must see (1536 - i) + ((i | 63) << 16). The case runs only where the host can create the group the renderer emits for it (16x16x6, or 768x1x1 with two lanes per invocation, checked against maxComputeWorkGroupInvocations and maxComputeWorkGroupSize[0]) and counts a skip elsewhere.

  • Ryzen 7600X iGPU (RDNA2, AMD driver, maxComputeWorkGroupInvocations 1024): current main stops at shaders.cpp:453, the reporter's stop; with this change the case passes.
  • Without the CreatePipelineInternal change (measured before the rebase, on a1fc5ae): thread 64 read 4130240, the value of lane 63 instead of lane 127.
  • RX 9070 XT (RDNA4): its driver accepts the 1536-invocation pipeline although it reports a limit of 1024, and the case passes on main and with the change. The full shader_recompiler_compute_tests run and shader_cfg_tests give the same results on main and with the change: 201 cases ok and the same four failed checks in two cases that also fail on main (GpuSelectedFormattedRgba16Store, IndirectImageQueryDimensions); the shader_cfg_tests output is identical.

Local GPU runs use the harness diff of #2038 (the harness on main requires byte-granular robust buffer access, which these two GPUs do not offer).

Fork CI on this commit: run 45894740076: Windows (32 of 32 tests), Linux (16 of 16) and macOS (16 of 16) pass.

In a game

#2247, MLB The Show 23: la-ghost (RX 6700 XT) ran this change on main a1fc5ae (d24c343): the game gets past the 44th compute shader where it stopped, reaches 61 compute shaders and runs a match (comment). The main menu was not reached in that run: the install progress did not move.

Refs #2247

Written with Claude Code (AI): Claude Code wrote the change and the test and ran them; Codex and GLM reviewed the diff.

🤖 Generated with Claude Code

**@⁠Nawid3333** on GitHub · 2026-11-26 19:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2567) `Nawid3333:fix/compute-group-host-limit` → `main` · +81 −7 · 6 files · 3 commits · open ## Cause MLB The Show 23 (#2247) stops at the `EXIT_NOT_IMPLEMENTED` after `createComputePipelines` (`shaders.cpp:394` in the report, `shaders.cpp:453` on current main) on an RX 6700 XT. The pipeline that fails is compute shader `0xd3b11028b2ced580`, a wave64 shader with a 16x16x6 group: 1536 threads, 24 waves of 64, with an LDS array and a barrier. Vulkan allows at most `maxComputeWorkGroupInvocations` invocations per group; AMD's driver reports 1024 (on the RDNA2 iGPU of a Ryzen 7600X here), and the reporter's RX 6700 XT refuses the 1536-invocation pipeline. On AMD hosts Kyty compiles wave64 compute shaders for 64-wide subgroups (`SupportsComputeWave64`), one guest lane per invocation, so the module asks for 1536 invocations. Kyty already has a mode that runs two guest lanes per invocation on 32-wide subgroups (`host_subgroup_size` 32, used on NVIDIA); with it this group needs 768 invocations. ## Change - `GetComputeProgram`: a wave64 group with more threads than `maxComputeWorkGroupInvocations` is compiled with `host_subgroup_size` 32 when compute subgroup size control is enabled and the device allows 32-wide subgroups. Only wave64 shaders have the two-lane mode, so other groups are left as they are. The size is part of the program key, so such a group gets its own module. - `CompiledShaderInfo::subgroup_size` (stored with the module) is the subgroup size the module was compiled for: the guest wave size, or 32 for a two-lane module. `CreatePipelineInternal` requires that size for compute pipelines instead of the guest wave size, since a two-lane module run on 64-wide subgroups reads the wrong lanes. The shader store drops stores of other builds (`BuildStamp` in its header), so stored modules always carry the field. - The test harness enables `subgroupSizeControl` and fills the subgroup size fields of the render context as `vulkanWindow.cpp` does, so compute pipelines in the tests request their subgroup size like the emulator. ## Test The end of `CheckNativeIndirectDispatch` (`--native-indirect-only`) runs a 16x16x6 wave64 group: each thread writes its index plus one to LDS, waits at `s_barrier`, reads the slot of thread 1535 minus its index, and reads the thread index of lane 63 of its wave with `v_readlane`. Every thread must see `(1536 - i) + ((i | 63) << 16)`. The case runs only where the host can create the group the renderer emits for it (16x16x6, or 768x1x1 with two lanes per invocation, checked against `maxComputeWorkGroupInvocations` and `maxComputeWorkGroupSize[0]`) and counts a skip elsewhere. - Ryzen 7600X iGPU (RDNA2, AMD driver, maxComputeWorkGroupInvocations 1024): current main stops at `shaders.cpp:453`, the reporter's stop; with this change the case passes. - Without the `CreatePipelineInternal` change (measured before the rebase, on a1fc5ae): `thread 64 read 4130240`, the value of lane 63 instead of lane 127. - RX 9070 XT (RDNA4): its driver accepts the 1536-invocation pipeline although it reports a limit of 1024, and the case passes on main and with the change. The full `shader_recompiler_compute_tests` run and `shader_cfg_tests` give the same results on main and with the change: 201 cases ok and the same four failed checks in two cases that also fail on main (`GpuSelectedFormattedRgba16Store`, `IndirectImageQueryDimensions`); the `shader_cfg_tests` output is identical. Local GPU runs use the harness diff of #2038 (the harness on main requires byte-granular robust buffer access, which these two GPUs do not offer). Fork CI on this commit: [run 45894740076](https://github.com/Nawid3333/KytyPS5/actions/runs/45894740076/attempts/1): Windows (32 of 32 tests), Linux (16 of 16) and macOS (16 of 16) pass. ## In a game #2247, MLB The Show 23: la-ghost (RX 6700 XT) ran this change on main a1fc5ae (d24c343): the game gets past the 44th compute shader where it stopped, reaches 61 compute shaders and runs a match ([comment](https://git.gtahub.st/github/KytyPS5--KytyPS5/issues/2247)). The main menu was not reached in that run: the install progress did not move. Refs #2247 Written with Claude Code (AI): Claude Code wrote the change and the test and ran them; Codex and GLM reviewed the diff. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A wave64 compute group of up to 2048 threads exceeds maxComputeWorkGroupInvocations
(1024) on AMD hosts that default to 64-wide subgroups, so pipeline creation failed
(#2247, MLB The Show 23: 16x16x6 group, RX 6700 XT). Such groups now use the existing
two-lanes-per-invocation mode, and the pipeline requires the 32-wide subgroup the
module was compiled for instead of the guest wave size.

The test harness enables subgroup size control like the emulator does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:39:50 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-26 19:38 UTC · original · edited 2026-11-26 21:00 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Compiled shader information now stores and serializes subgroup size. Compute pipeline setup selects subgroup sizes using workgroup size and device limits, then applies the size when subgroup-size control is enabled and supported. The test context queries subgroup-size-control support, and a compute test checks barrier synchronization and LDS operations across a selected workgroup size.

Suggested reviewers: nmzik, senaxx, artyomzabroda

Change: Bug fix

Merge Risk: Minimal · up to 7e340

This change lets wave64 compute shaders run on devices with a 1024-invocation limit by compiling them for 32-wide subgroups when the device supports it. No concrete merge-blocking defect was found. The new test gates itself against the host's workgroup limits and counts a skip when the case cannot run.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: compute groups that exceed the host's maxComputeWorkGroupInvocations limit now compile for 32-lane subgroups. The changeset matches this: GetComputeProgram selects hos…
Description check Passed The description is detailed and relevant. It explains the cause (a 1536-invocation wave64 compute group fails on hosts with a 1024 invocation limit), the change to GetComputeProgram, CompiledShaderInf…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: compute groups that exceed the host's maxComputeWorkGroupInvocations limit now compile for 32-lane subgroups. The changeset matches this: GetComputeProgram selects host_subgroup_size 32 for wave64 groups over the limit, and the subgroup size is stored and used for pipeline creation. The title is concise and specific.

Full details: Description check

Explanation

The description is detailed and relevant. It explains the cause (a 1536-invocation wave64 compute group fails on hosts with a 1024 invocation limit), the change to GetComputeProgram, CompiledShaderInfo::subgroup_size, CreatePipelineInternal, and the test harness updates. It also lists test results and a linked issue.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1a31709284 and 7e340f39b5.

Files selected for processing: 1

  • tests/ShaderRecompilerComputeTests.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.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-26 19:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2567#issuecomment-7201800778) · edited 2026-11-26 21:00 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/2567?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> Compiled shader information now stores and serializes subgroup size. Compute pipeline setup selects subgroup sizes using workgroup size and device limits, then applies the size when subgroup-size control is enabled and supported. The test context queries subgroup-size-control support, and a compute test checks barrier synchronization and LDS operations across a selected workgroup size. **Suggested reviewers:** `nmzik`, `senaxx`, `artyomzabroda` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"7e340f39b5401bfc999e1c2f912909dec8c3551e" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>7e340</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `7e340` --> <!-- final_review_risk_coverage:{"sourceCommitId":"7e340f39b5401bfc999e1c2f912909dec8c3551e","coveredCommitId":"7e340f39b5401bfc999e1c2f912909dec8c3551e","kind":"reviewed"} --> This change lets wave64 compute shaders run on devices with a 1024-invocation limit by compiling them for 32-wide subgroups when the device supports it. No concrete merge-blocking defect was found. The new test gates itself against the host's workgroup limits and counts a skip when the case cannot run. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: compute groups that exceed the host's maxComputeWorkGroupInvocations limit now compile for 32-lane subgroups. The changeset matches this: GetComputeProgram selects hos… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description is detailed and relevant. It explains the cause (a 1536-invocation wave64 compute group fails on hosts with a 1024 invocation limit), the change to GetComputeProgram, CompiledShaderInf… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the main change: compute groups that exceed the host's maxComputeWorkGroupInvocations limit now compile for 32-lane subgroups. The changeset matches this: GetComputeProgram selects host_subgroup_size 32 for wave64 groups over the limit, and the subgroup size is stored and used for pipeline creation. The title is concise and specific. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description is detailed and relevant. It explains the cause (a 1536-invocation wave64 compute group fails on hosts with a 1024 invocation limit), the change to GetComputeProgram, CompiledShaderInfo::subgroup_size, CreatePipelineInternal, and the test harness updates. It also lists test results and a linked issue. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2567)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> <br> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <br> <!-- review_info_content --> <details> <summary><strong><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</strong></summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/b3d8c04844c89f6623e30044e33b570ba357b2f5/.coderabbit.yaml>) - **Commit**: [b3d8c04](<https://github.com/KytyPS5/KytyPS5/commit/b3d8c04844c89f6623e30044e33b570ba357b2f5>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `50b2e32e-af06-4dc5-a7c3-038018f6d961` </dd> </dl> </details> <details> <summary><strong><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</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between 1a31709284a822c72c934f6a0409384eb1e23ff7 and 7e340f39b5401bfc999e1c2f912909dec8c3551e. </dd> </dl> </details> <details> <summary><strong><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: 1</strong></summary> <dl> <dd> <br> * `tests/ShaderRecompilerComputeTests.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> <!-- recent_review_end -->
@ -14403,0 +14422,4 @@
shaders.SetCsShader({.data_addr = reinterpret_cast<uint64_t>(group_shader.data()),
.num_thread_x = 16, .num_thread_y = 16, .num_thread_z = 6,
.wave_size = 64, .user_sgpr = 4, .tidig_comp_cnt = 2,
.lds_size = group_threads * sizeof(u32) / 512u});
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-26 19:38 UTC · original · edited 2026-11-26 20:57 UTC

Minor · Functional Correctness · Quick win

The oversized-workgroup case can fail on devices without subgroup-size control.

The new case dispatches 1536 invocations with wave size 64 and has no guard for the device configuration. On a device with maxComputeWorkGroupInvocations of 1024, native 64-wide subgroups, and no subgroup-size control, the host subgroup stays at 64. The lowering to two lanes per invocation does not apply, and the emitted local size stays 16×16×6. Pipeline creation for that module can fail, so the compute suite fails on that device instead of completing.

The case must run only on configurations that can execute it. Gate it on the subgroup-size control path that the change selects, or on a workgroup limit of at least 1536, or skip it with a counted skip. Choose the gate that matches the intended coverage. The gate must also cover the enclosing CheckNativeIndirectDispatch call sites.

✅ Addressed in commit 7e340f3

**@⁠coderabbitai[bot]** on GitHub · 2026-11-26 19:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2567#discussion_r4712743582) · edited 2026-11-26 20:57 UTC <!-- coderabbit-ai-generated:v1 --> **<picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/amber-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minor** · **Functional Correctness** · **Quick win** **The oversized-workgroup case can fail on devices without subgroup-size control.** The new case dispatches 1536 invocations with wave size 64 and has no guard for the device configuration. On a device with `maxComputeWorkGroupInvocations` of 1024, native 64-wide subgroups, and no subgroup-size control, the host subgroup stays at 64. The lowering to two lanes per invocation does not apply, and the emitted local size stays 16×16×6. Pipeline creation for that module can fail, so the compute suite fails on that device instead of completing. The case must run only on configurations that can execute it. Gate it on the subgroup-size control path that the change selects, or on a workgroup limit of at least 1536, or skip it with a counted skip. Choose the gate that matches the intended coverage. The gate must also cover the enclosing `CheckNativeIndirectDispatch` call sites. <!-- fingerprinting:phantom:poseidon:wombat61 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:ede1433b019856a2b488f770 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Addressed in commit 7e340f3 <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-26 19:38 UTC · original · reviewed

Actionable comments posted: 1

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 832d6dac19 and bc49f4757a.

Files selected for processing: 6

  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/host_gpu/renderer/pipeline/shaders.cpp
  • src/graphics/shader/recompiler/ir/Program.cpp
  • src/graphics/shader/recompiler/ir/Serialize.h
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • tests/ShaderRecompilerComputeTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-11-26 19:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2567#pullrequestreview-6079634314) · **reviewed** <!-- coderabbit-ai-generated:v1 --> **Actionable comments posted: 1** <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**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/832d6dac19567518e0f60047d01d27cd068adf76/.coderabbit.yaml>) - **Commit**: [832d6da](<https://github.com/KytyPS5/KytyPS5/commit/832d6dac19567518e0f60047d01d27cd068adf76>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `8df0be18-8ab5-4e0a-9ebd-bc8af52287a7` </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 832d6dac19567518e0f60047d01d27cd068adf76 and bc49f4757a34b094faf43473b2b35d1ba4fef84a. </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: 6</summary> <dl> <dd> <br> * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `src/graphics/host_gpu/renderer/pipeline/shaders.cpp` * `src/graphics/shader/recompiler/ir/Program.cpp` * `src/graphics/shader/recompiler/ir/Serialize.h` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `tests/ShaderRecompilerComputeTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=cdefb39e-be2e-4003-9a11-71dd62010316 attempt=86125f5a-20de-459f-bea1-b34a1cb840c6 batch=1/1 -->
github-bot force-pushed github-bot/gh-2567 from bc49f4757a to 1a31709284 2026-11-26 20:21:24 +00:00 Compare
Author
Owner

@⁠Nawid3333 on GitHub · 2026-11-26 20:35 UTC · original
On tests/ShaderRecompilerComputeTests.cpp line 14425 (outdated):

@@ -14400,6 +14400,42 @@ class VulkanHarness {
         }
       }
       host_lds_limit = saved_lds_limit;
+
+      constexpr u32 group_threads = 16 * 16 * 6;
+      std::vector<u32> group_shader;
+      AppendVop3(&group_shader, 0x346, 3, Vgpr(2), InlineU32(4), Vgpr(1));
+      AppendVop3(&group_shader, 0x346, 3, Vgpr(3), InlineU32(4), Vgpr(0));
+      group_shader.insert(group_shader.end(), {
+          EncodeVop2(0x1a, 4, InlineU32(2), 3), EncodeVop2(0x25, 5, InlineU32(1), 3),
+          EncodeDs0(0x0d), EncodeDs1(0, 5, 4), EncodeSopp(0x0a, 0),
+          EncodeVop2(0x26, 6, 255, 3), group_threads - 1u,
+          EncodeVop2(0x1a, 6, InlineU32(2), 6),
+          EncodeDs0(0x36), EncodeDs1(7, 0, 6), EncodeSopp(0x0c, 0)});
+      AppendVop3(&group_shader, 0x360, 8, Vgpr(3), InlineU32(63));
+      AppendVop3(&group_shader, 0x346, 7, 8, InlineU32(16), Vgpr(7));
+      group_shader.insert(group_shader.end(), {EncodeMubuf0(0x1c), EncodeMubuf1(7, 0, 4)});
+      AppendEnd(&group_shader);
+      ShaderMapUserData(reinterpret_cast<uint64_t>(group_shader.data()),
+          {.type = Prospero::ShaderBinaryType::kCs,
+           .code_size_bytes = static_cast<u32>(group_shader.size() * sizeof(u32))});
+      cache.FillBuffer(lds_output, group_threads * sizeof(u32), sentinel, false);
+      shaders.SetCsShader({.data_addr = reinterpret_cast<uint64_t>(group_shader.data()),
+                           .num_thread_x = 16, .num_thread_y = 16, .num_thread_z = 6,
+                           .wave_size = 64, .user_sgpr = 4, .tidig_comp_cnt = 2,
+                           .lds_size = group_threads * sizeof(u32) / 512u});

Gated in 1a3170928. The case now runs when the group fits the host limit, when the host has no 64-lane compute (two guest lanes per invocation already), or when the 32-lane override applies; anywhere else it counts a skip. The gate sits inside CheckNativeIndirectDispatch, so all of its callers are covered. Main still fails the case on the RDNA2 iGPU here (compute pipeline creation) and the branch passes it.

**@⁠Nawid3333** on GitHub · 2026-11-26 20:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2567#discussion_r4713161331) On `tests/ShaderRecompilerComputeTests.cpp` line 14425 (outdated): ```diff @@ -14400,6 +14400,42 @@ class VulkanHarness { } } host_lds_limit = saved_lds_limit; + + constexpr u32 group_threads = 16 * 16 * 6; + std::vector<u32> group_shader; + AppendVop3(&group_shader, 0x346, 3, Vgpr(2), InlineU32(4), Vgpr(1)); + AppendVop3(&group_shader, 0x346, 3, Vgpr(3), InlineU32(4), Vgpr(0)); + group_shader.insert(group_shader.end(), { + EncodeVop2(0x1a, 4, InlineU32(2), 3), EncodeVop2(0x25, 5, InlineU32(1), 3), + EncodeDs0(0x0d), EncodeDs1(0, 5, 4), EncodeSopp(0x0a, 0), + EncodeVop2(0x26, 6, 255, 3), group_threads - 1u, + EncodeVop2(0x1a, 6, InlineU32(2), 6), + EncodeDs0(0x36), EncodeDs1(7, 0, 6), EncodeSopp(0x0c, 0)}); + AppendVop3(&group_shader, 0x360, 8, Vgpr(3), InlineU32(63)); + AppendVop3(&group_shader, 0x346, 7, 8, InlineU32(16), Vgpr(7)); + group_shader.insert(group_shader.end(), {EncodeMubuf0(0x1c), EncodeMubuf1(7, 0, 4)}); + AppendEnd(&group_shader); + ShaderMapUserData(reinterpret_cast<uint64_t>(group_shader.data()), + {.type = Prospero::ShaderBinaryType::kCs, + .code_size_bytes = static_cast<u32>(group_shader.size() * sizeof(u32))}); + cache.FillBuffer(lds_output, group_threads * sizeof(u32), sentinel, false); + shaders.SetCsShader({.data_addr = reinterpret_cast<uint64_t>(group_shader.data()), + .num_thread_x = 16, .num_thread_y = 16, .num_thread_z = 6, + .wave_size = 64, .user_sgpr = 4, .tidig_comp_cnt = 2, + .lds_size = group_threads * sizeof(u32) / 512u}); ``` Gated in 1a3170928. The case now runs when the group fits the host limit, when the host has no 64-lane compute (two guest lanes per invocation already), or when the 32-lane override applies; anywhere else it counts a skip. The gate sits inside `CheckNativeIndirectDispatch`, so all of its callers are covered. Main still fails the case on the RDNA2 iGPU here (compute pipeline creation) and the branch passes it.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-26 20:36 UTC · original
On tests/ShaderRecompilerComputeTests.cpp line 14425 (outdated):

@@ -14400,6 +14400,42 @@ class VulkanHarness {
         }
       }
       host_lds_limit = saved_lds_limit;
+
+      constexpr u32 group_threads = 16 * 16 * 6;
+      std::vector<u32> group_shader;
+      AppendVop3(&group_shader, 0x346, 3, Vgpr(2), InlineU32(4), Vgpr(1));
+      AppendVop3(&group_shader, 0x346, 3, Vgpr(3), InlineU32(4), Vgpr(0));
+      group_shader.insert(group_shader.end(), {
+          EncodeVop2(0x1a, 4, InlineU32(2), 3), EncodeVop2(0x25, 5, InlineU32(1), 3),
+          EncodeDs0(0x0d), EncodeDs1(0, 5, 4), EncodeSopp(0x0a, 0),
+          EncodeVop2(0x26, 6, 255, 3), group_threads - 1u,
+          EncodeVop2(0x1a, 6, InlineU32(2), 6),
+          EncodeDs0(0x36), EncodeDs1(7, 0, 6), EncodeSopp(0x0c, 0)});
+      AppendVop3(&group_shader, 0x360, 8, Vgpr(3), InlineU32(63));
+      AppendVop3(&group_shader, 0x346, 7, 8, InlineU32(16), Vgpr(7));
+      group_shader.insert(group_shader.end(), {EncodeMubuf0(0x1c), EncodeMubuf1(7, 0, 4)});
+      AppendEnd(&group_shader);
+      ShaderMapUserData(reinterpret_cast<uint64_t>(group_shader.data()),
+          {.type = Prospero::ShaderBinaryType::kCs,
+           .code_size_bytes = static_cast<u32>(group_shader.size() * sizeof(u32))});
+      cache.FillBuffer(lds_output, group_threads * sizeof(u32), sentinel, false);
+      shaders.SetCsShader({.data_addr = reinterpret_cast<uint64_t>(group_shader.data()),
+                           .num_thread_x = 16, .num_thread_y = 16, .num_thread_z = 6,
+                           .wave_size = 64, .user_sgpr = 4, .tidig_comp_cnt = 2,
+                           .lds_size = group_threads * sizeof(u32) / 512u});
Analysis chain

Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- revision ---'
git rev-parse HEAD
git show --stat --oneline 1a3170928 -- 2>&1 || true
printf '%s\n' '--- test outline ---'
ast-grep outline tests/ShaderRecompilerComputeTests.cpp --match 'CheckNativeIndirectDispatch|VulkanHarness' --view expanded 2>&1 | head -100
printf '%s\n' '--- test relevant matches ---'
rg -n -C 12 'group_threads|CheckNativeIndirectDispatch|subgroup_size_control|subgroupSizeControl|maxComputeWorkGroupInvocations|skipped' tests/ShaderRecompilerComputeTests.cpp | tail -360
printf '%s\n' '--- pipeline outline and selection ---'
ast-grep outline src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp --match 'GetComputeProgram|CompileModule' --view expanded 2>&1 | head -80
rg -n -C 10 'maxComputeWorkGroupInvocations|host_subgroup_size|subgroup_size' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp | head -180

Length of output: 29279


Script executed:

#!/bin/bash
printf '%s\n' '--- oversized group test and gate ---'
cat -n tests/ShaderRecompilerComputeTests.cpp | sed -n '14380,14480p'
printf '%s\n' '--- skipped count and output ---'
rg -n -C 3 'm_skipped_cases|SkippedCaseCount\(' tests/ShaderRecompilerComputeTests.cpp
printf '%s\n' '--- wave64 support definition ---'
rg -n -C 6 'SupportsComputeWave64\s*\(' src/graphics tests/ShaderRecompilerComputeTests.cpp | head -150

Length of output: 14308


Script executed:

#!/bin/bash
printf '%s\n' '--- workgroup lowering references ---'
rg -n -C 5 'host_subgroup_size|threads_num' src/graphics/shader/recompiler | head -250
printf '%s\n' '--- host thread calculations ---'
rg -n -C 5 'local_size|LocalSize|host_threads|num_lanes|lanes_per' src/graphics/shader/recompiler | head -250

Length of output: 14097


@Nawid3333 The gate covers the original 1,024-invocation case. One limit remains: the two-lane path emits a 768 × 1 × 1 host workgroup. If a device has a lower invocation limit, the gate can still run the test and pipeline creation can fail.

Please check the emitted workgroup size against both maxComputeWorkGroupInvocations and maxComputeWorkGroupSize[0], and count a skip if it does not fit. I’m not marking the finding as addressed yet. I inspected the source but did not run GPU tests.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-26 20:36 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2567#discussion_r4713170338) On `tests/ShaderRecompilerComputeTests.cpp` line 14425 (outdated): ```diff @@ -14400,6 +14400,42 @@ class VulkanHarness { } } host_lds_limit = saved_lds_limit; + + constexpr u32 group_threads = 16 * 16 * 6; + std::vector<u32> group_shader; + AppendVop3(&group_shader, 0x346, 3, Vgpr(2), InlineU32(4), Vgpr(1)); + AppendVop3(&group_shader, 0x346, 3, Vgpr(3), InlineU32(4), Vgpr(0)); + group_shader.insert(group_shader.end(), { + EncodeVop2(0x1a, 4, InlineU32(2), 3), EncodeVop2(0x25, 5, InlineU32(1), 3), + EncodeDs0(0x0d), EncodeDs1(0, 5, 4), EncodeSopp(0x0a, 0), + EncodeVop2(0x26, 6, 255, 3), group_threads - 1u, + EncodeVop2(0x1a, 6, InlineU32(2), 6), + EncodeDs0(0x36), EncodeDs1(7, 0, 6), EncodeSopp(0x0c, 0)}); + AppendVop3(&group_shader, 0x360, 8, Vgpr(3), InlineU32(63)); + AppendVop3(&group_shader, 0x346, 7, 8, InlineU32(16), Vgpr(7)); + group_shader.insert(group_shader.end(), {EncodeMubuf0(0x1c), EncodeMubuf1(7, 0, 4)}); + AppendEnd(&group_shader); + ShaderMapUserData(reinterpret_cast<uint64_t>(group_shader.data()), + {.type = Prospero::ShaderBinaryType::kCs, + .code_size_bytes = static_cast<u32>(group_shader.size() * sizeof(u32))}); + cache.FillBuffer(lds_output, group_threads * sizeof(u32), sentinel, false); + shaders.SetCsShader({.data_addr = reinterpret_cast<uint64_t>(group_shader.data()), + .num_thread_x = 16, .num_thread_y = 16, .num_thread_z = 6, + .wave_size = 64, .user_sgpr = 4, .tidig_comp_cnt = 2, + .lds_size = group_threads * sizeof(u32) / 512u}); ``` <!-- coderabbit-ai-generated:v1 --> <details> <summary>Analysis chain</summary> <dl> <dd> <br> Script executed: ```shell #!/bin/bash set -u printf '%s\n' '--- revision ---' git rev-parse HEAD git show --stat --oneline 1a3170928 -- 2>&1 || true printf '%s\n' '--- test outline ---' ast-grep outline tests/ShaderRecompilerComputeTests.cpp --match 'CheckNativeIndirectDispatch|VulkanHarness' --view expanded 2>&1 | head -100 printf '%s\n' '--- test relevant matches ---' rg -n -C 12 'group_threads|CheckNativeIndirectDispatch|subgroup_size_control|subgroupSizeControl|maxComputeWorkGroupInvocations|skipped' tests/ShaderRecompilerComputeTests.cpp | tail -360 printf '%s\n' '--- pipeline outline and selection ---' ast-grep outline src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp --match 'GetComputeProgram|CompileModule' --view expanded 2>&1 | head -80 rg -n -C 10 'maxComputeWorkGroupInvocations|host_subgroup_size|subgroup_size' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp | head -180 ``` Length of output: 29279 --- Script executed: ```shell #!/bin/bash printf '%s\n' '--- oversized group test and gate ---' cat -n tests/ShaderRecompilerComputeTests.cpp | sed -n '14380,14480p' printf '%s\n' '--- skipped count and output ---' rg -n -C 3 'm_skipped_cases|SkippedCaseCount\(' tests/ShaderRecompilerComputeTests.cpp printf '%s\n' '--- wave64 support definition ---' rg -n -C 6 'SupportsComputeWave64\s*\(' src/graphics tests/ShaderRecompilerComputeTests.cpp | head -150 ``` Length of output: 14308 --- Script executed: ```shell #!/bin/bash printf '%s\n' '--- workgroup lowering references ---' rg -n -C 5 'host_subgroup_size|threads_num' src/graphics/shader/recompiler | head -250 printf '%s\n' '--- host thread calculations ---' rg -n -C 5 'local_size|LocalSize|host_threads|num_lanes|lanes_per' src/graphics/shader/recompiler | head -250 ``` Length of output: 14097 --- </dd> </dl> </details> `@Nawid3333` The gate covers the original 1,024-invocation case. One limit remains: the two-lane path emits a **768 × 1 × 1** host workgroup. If a device has a lower invocation limit, the gate can still run the test and pipeline creation can fail. Please check the emitted workgroup size against both `maxComputeWorkGroupInvocations` and `maxComputeWorkGroupSize[0]`, and count a skip if it does not fit. I’m not marking the finding as addressed yet. I inspected the source but did not run GPU tests. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=1536-invocation%20workgroups%20can%20fail%20pipeline%20creation%20on%20some%20GPUs.%20%40coderabbitai%E2%80%99s%20fix%20gates%20the%20case%20by%20device%20capability%20and%20counts%20skips%2C%20covering%20every%20caller.%20Try%20CodeRabbit%20for%20actionable%20reviews%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F2567%23discussion_r4712743582)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> <sub><i>You are interacting with an AI system.</i></sub> <!-- This is an auto-generated reply by CodeRabbit -->
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2567/head:github-bot/gh-2567'
git switch 'github-bot/gh-2567'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2567'
git switch 'github-bot/gh-2567'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2567'
git switch 'github-bot/gh-2567'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2567'
git switch 'main'
git merge --squash 'github-bot/gh-2567'
git switch 'main'
git merge --ff-only 'github-bot/gh-2567'
git switch 'main'
git merge 'github-bot/gh-2567'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.