Skip to content

feat: expose device.minSubgroupSize and device.maxSubgroupSize on GraphicsDevice#8645

Merged
mvaligursky merged 2 commits intomainfrom
mv-max-subgroup-size
Apr 23, 2026
Merged

feat: expose device.minSubgroupSize and device.maxSubgroupSize on GraphicsDevice#8645
mvaligursky merged 2 commits intomainfrom
mv-max-subgroup-size

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

@mvaligursky mvaligursky commented Apr 23, 2026

Summary

  • Add new GraphicsDevice.minSubgroupSize and GraphicsDevice.maxSubgroupSize fields, populated by WebgpuGraphicsDevice from the adapter's corresponding limits. Both are 0 when subgroups are unsupported.
  • Lands ahead of two upcoming feature PRs (GSplat tile radix sort, global WebGPU radix sort) that both need subgroup-size info for shared-memory sizing and for gating subgroup-based algorithms. Keeping it standalone so both PRs can rebase onto it cleanly.

Why both bounds

On hardware where the subgroup size can vary at runtime (e.g. Intel, some Apple/Qualcomm), the WGSL subgroup_size builtin 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:

/** @type {number} */
device.minSubgroupSize;

/** @type {number} */
device.maxSubgroupSize;

Both tagged @ignore for now — the only consumers are engine-internal compute algorithms.

Test plan

  • Verify both fields are populated correctly on WebGPU (Chrome + Safari)
  • Verify both are 0 on WebGL and on WebGPU adapters without subgroup support

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.
@mvaligursky mvaligursky changed the title feat: expose device.maxSubgroupSize on GraphicsDevice feat: expose device.minSubgroupSize and device.maxSubgroupSize on GraphicsDevice Apr 23, 2026
@mvaligursky mvaligursky merged commit b5437a5 into main Apr 23, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-max-subgroup-size branch April 23, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant