feat: expose device.minSubgroupSize and device.maxSubgroupSize on GraphicsDevice#8645
Merged
mvaligursky merged 2 commits intomainfrom Apr 23, 2026
Merged
feat: expose device.minSubgroupSize and device.maxSubgroupSize on GraphicsDevice#8645mvaligursky merged 2 commits intomainfrom
mvaligursky merged 2 commits intomainfrom
Conversation
Add a new GraphicsDevice.maxSubgroupSize field populated by WebgpuGraphicsDevice from the adapter's maxSubgroupSize limit. Zero when subgroups are unsupported. Used internally by algorithms that need to size shared memory for the worst-case subgroup count.
Add the minimum counterpart to maxSubgroupSize. On hardware where the subgroup size can vary at runtime (Intel, some Apple/Qualcomm), the WGSL subgroup_size builtin may report any value in [min, max]. Shaders sizing shared memory by the number of subgroups in a workgroup need the minimum to cover the worst-case count.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GraphicsDevice.minSubgroupSizeandGraphicsDevice.maxSubgroupSizefields, populated byWebgpuGraphicsDevicefrom the adapter's corresponding limits. Both are0when subgroups are unsupported.Why both bounds
On hardware where the subgroup size can vary at runtime (e.g. Intel, some Apple/Qualcomm), the WGSL
subgroup_sizebuiltin may report any value in[minSubgroupSize, maxSubgroupSize]. Shaders that size workgroup shared memory by the number of subgroups in a workgroup need the minimum (smaller subgroups → more of them → worst case), whereas code gating a specific subgroup-size assumption typically wants the maximum.Public API changes
Two new public fields on
GraphicsDevice:Both tagged
@ignorefor now — the only consumers are engine-internal compute algorithms.Test plan
0on WebGL and on WebGPU adapters without subgroup support