renderer: run compute groups over the host's invocation limit with 32-lane subgroups #2567
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2567
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2567"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Nawid3333 on GitHub · 2026-11-26 19:32 UTC · original
Nawid3333:fix/compute-group-host-limit→main· +81 −7 · 6 files · 3 commits · openCause
MLB The Show 23 (#2247) stops at the
EXIT_NOT_IMPLEMENTEDaftercreateComputePipelines(shaders.cpp:394in the report,shaders.cpp:453on current main) on an RX 6700 XT. The pipeline that fails is compute shader0xd3b11028b2ced580, a wave64 shader with a 16x16x6 group: 1536 threads, 24 waves of 64, with an LDS array and a barrier. Vulkan allows at mostmaxComputeWorkGroupInvocationsinvocations 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_size32, used on NVIDIA); with it this group needs 768 invocations.Change
GetComputeProgram: a wave64 group with more threads thanmaxComputeWorkGroupInvocationsis compiled withhost_subgroup_size32 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.CreatePipelineInternalrequires 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 (BuildStampin its header), so stored modules always carry the field.subgroupSizeControland fills the subgroup size fields of the render context asvulkanWindow.cppdoes, 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 ats_barrier, reads the slot of thread 1535 minus its index, and reads the thread index of lane 63 of its wave withv_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 againstmaxComputeWorkGroupInvocationsandmaxComputeWorkGroupSize[0]) and counts a skip elsewhere.shaders.cpp:453, the reporter's stop; with this change the case passes.CreatePipelineInternalchange (measured before the rebase, ona1fc5ae):thread 64 read 4130240, the value of lane 63 instead of lane 127.shader_recompiler_compute_testsrun andshader_cfg_testsgive 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); theshader_cfg_testsoutput 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
@coderabbitai[bot] on GitHub · 2026-11-26 19:38 UTC · original · edited 2026-11-26 21:00 UTC
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,artyomzabrodaChange: Bug fix
Merge Risk:
Minimal · up to
7e340This 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:
4
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
50b2e32e-af06-4dc5-a7c3-038018f6d961Reviewing files that changed from the base of the PR and between
1a31709284and7e340f39b5.tests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
@ -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});@coderabbitai[bot] on GitHub · 2026-11-26 19:38 UTC · original · edited 2026-11-26 20:57 UTC
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
maxComputeWorkGroupInvocationsof 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
CheckNativeIndirectDispatchcall sites.✅ Addressed in commit
7e340f3@coderabbitai[bot] on GitHub · 2026-11-26 19:38 UTC · original · reviewed
Actionable comments posted: 1
8df0be18-8ab5-4e0a-9ebd-bc8af52287a7Reviewing files that changed from the base of the PR and between
832d6dac19andbc49f4757a.src/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/pipeline/shaders.cppsrc/graphics/shader/recompiler/ir/Program.cppsrc/graphics/shader/recompiler/ir/Serialize.hsrc/graphics/shader/recompiler/ir/ShaderIR.htests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
bc49f4757ato1a31709284@Nawid3333 on GitHub · 2026-11-26 20:35 UTC · original
On
tests/ShaderRecompilerComputeTests.cppline 14425 (outdated):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 insideCheckNativeIndirectDispatch, 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.@coderabbitai[bot] on GitHub · 2026-11-26 20:36 UTC · original
On
tests/ShaderRecompilerComputeTests.cppline 14425 (outdated):Analysis chain
Script executed:
Length of output: 29279
Script executed:
Length of output: 14308
Script executed:
Length of output: 14097
@Nawid3333The 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
maxComputeWorkGroupInvocationsandmaxComputeWorkGroupSize[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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.