v152 · webgpu · wgsl · shipped
WebGPU: Subgroup Size Control
The optional GPU feature "subgroup-size-control" lets a compute shader declare its subgroup size explicitly with the WGSL @subgroup_size attribute, instead of accepting whatever size the GPU driver picks. Ships in Chrome 152 on desktop, Android, and WebView, enabled by default.
There is deliberately no API to enumerate the set of subgroup sizes an adapter accepts: the WebGPU working group considered explicit limits (explicitCompute/MaxSize, maxCompute) and decided against exposing them (gpuweb#6241), because expert users know their target sizes and native limit ranges do not reliably describe what is actually requestable. In practice:
- Always feature-detect: request
"subgroup-size-control"only ifadapter.features.has("subgroup-size-control")(see examples). - Only the bounds
GPUAdapterInfo./subgroupMinSize subgroupMaxSizeare queryable; a requested size inside that range is not guaranteed to work — pipeline creation can still fail with an uncategorized error (register pressure, hardware workgroup-subgroup limits). HandlecreateComputePipelineAsync()rejection with a fallback pipeline (see error taxonomy). - Metal has no native subgroup-size control; the proposal notes browsers may expose the feature on Metal “at their own risk” — test on Apple GPUs specifically.
at a glance
| What it is | An optional GPUFeatureName, "subgroup-size-control", that enables the WGSL subgroup_size_control extension and its @subgroup_size attribute on compute shader entry points |
|---|---|
| Milestone listing | Chrome 152 — Enabled by default (milestone=152 listing, verified 2026-07-29; the listing is authoritative per gendn invariant #2) |
| Platforms | Desktop, Android, WebView — all 152 (Intent to Ship; “Will ship enabled for all users”, no about://flags entry, no Finch gate) |
| API surface added | None beyond the feature name itself — the spec records “This feature adds no optional API surfaces”. All behavior is in WGSL and pipeline validation |
| WGSL surface | enable subgroup_size_control; extension + @subgroup_size(<expr>) attribute — full contract on the attribute page |
| Spec status | Merged into the WebGPU and WGSL specifications via gpuweb/gpuweb PR #5578 (merged 2026-06-23) |
| ChromeStatus | 5077657663438848 — WebGPU: Subgroup Size Control (tracking bug 463721943) |
why it exists
Without this feature, a compute shader can only read the subgroup size the driver happened to choose (the subgroup_size built-in). On platforms whose GPUs support several subgroup sizes that creates three concrete problems, per the proposal:
- Untestable code paths — correctness requires a path per possible size, but the developer cannot force a given size to test it.
- Suboptimal performance — the driver-chosen size is not always the best for a given workload (the motivating use case is AI/compute-heavy shaders tuned per subgroup width).
- Oversized derived parameters — workgroup sizes and workgroup-memory array sizes must be sized for the largest possible subgroup, wasting resources when a smaller size would do.
The native equivalents already existed: Vulkan's VK_EXT_subgroup_size_control (or Vulkan 1.3) and HLSL's [WaveSize()] (Shader Model 6.6). This feature brings the same control to WebGPU. Metal has no equivalent.
how it works
- The page requests a device with
"subgroup-size-control"inrequiredFeatures. Per the spec, enabling this feature at device creation also enables"subgroups"on the device automatically. - A WGSL module gains
enable subgroup_size_control;— valid only when the device has the feature, and only alongsideenable subgroups;. - The compute entry point declares
@subgroup_size(N). The pipeline will run with exactly that subgroup size, and thesubgroup_sizebuilt-in always equalsN. - Validation happens at shader creation (const-expression violations) and pipeline creation (range, workgroup-divisibility, and implementability checks) — see the error taxonomy.
syntax
The feature is a string in the GPUFeatureName enum — present verbatim in the spec's feature index and in Chromium's gpu_supported_features.idl:
// GPUFeatureName (spec feature index §25.23)
"subgroup-size-control"
Feature detection and device request follow the standard WebGPU pattern:
const adapter = await navigator.gpu.requestAdapter();
const requestedFeatures = [];
if (adapter.features.has("subgroup-size-control")) {
requestedFeatures.push("subgroup-size-control");
} else {
// Use an alternate code path (driver-chosen subgroup size).
}
const device = await adapter.requestDevice({ requiredFeatures });
Source: WebGPU spec — "subgroup-size-control"; Chromium gpu_supported_features.idl; proposal — example usage
inputs
| Input | Contract |
|---|---|
adapter. | A GPUSupportedFeatures set; has("subgroup-size-control") tells whether this adapter can grant the feature. Passing an unknown string to has() returns false — safe on browsers that predate the enum value |
descriptor. | Include "subgroup-size-control" to grant it. There are no accompanying limits or descriptors — the feature has no optional API surface and exposes no new GPUAdapterInfo fields (explicit limits were considered and declined, gpuweb#6241) |
| Implicit companion | Requesting "subgroup-size-control" implicitly enables "subgroups" on the device; it does not need to be listed separately |
outputs
- A
GPUDeviceon whichdevice.featurescontains"subgroup-size-control"and"subgroups"(the latter auto-enabled). - WGSL modules created on that device may use
enable subgroup_size_control;and the@subgroup_sizeattribute (contract on the attribute page). - Queryable bounds:
adapter.info.subgroupMinSize/subgroupMaxSizedelimit the valid request range (those members belong to the"subgroups"feature; requesting subgroup-size-control makes them meaningful on the same device).
errors
| Situation | Behavior |
|---|---|
requiredFeatures contains "subgroup-size-control" but the adapter lacks it | requestDevice() rejects with a TypeError — deliberately the same error as for a feature name the browser does not know at all, “converging” unknown-name and unsupported-adapter behavior so sites must feature-detect rather than branch on error types |
Feature not requested, but WGSL uses @subgroup_size | Shader-creation error (the subgroup_size_control extension is not enabled) |
Feature requested, WGSL enables subgroup_size_control without subgroups | Shader-creation error — the two must be enabled together |
| Attribute value out of range / not a power of two / pipeline not creatable | See the attribute error taxonomy (shader-creation vs pipeline-creation vs uncategorized error, by expression kind) |
context and exposure
- Available wherever WebGPU is:
Exposed=(Window, DedicatedWorker, SharedWorker, ServiceWorker), secure contexts only (per the WebGPU spec'sGPU/navigator.gpuexposure). - Adapter-dependent: presence in
adapter.featuresvaries by GPU/driver/OS — the same browser build exposes it on one machine and not another. Metal has no native equivalent (proposal: browsers may expose it on Metal “at their own risk”). - Compute-only effect: the WGSL attribute is restricted to compute shader entry points; vertex/fragment pipelines are unaffected.
lifecycle
| Stage | What happens |
|---|---|
| 1. Query | adapter.features.has("subgroup-size-control") — static per adapter |
| 2. Grant | requestDevice({requiredFeatures: ["subgroup-size-control"]}) — one-time; the adapter is consumed; "subgroups" enabled alongside |
| 3. Shader authoring | enable subgroup_size_control; + @subgroup_size(N) on a compute entry point; const-expression values are validated at shader creation |
| 4. Pipeline creation | Range (subgroupMinSize..subgroupMaxSize), power-of-two (override-expressions), workgroup-divisibility, and implementability are validated; failures surface as pipeline-creation errors (or uncategorized errors for hardware limits) |
| 5. Dispatch | The pipeline always runs at subgroup size N; the subgroup_size built-in equals N. The choice is immutable for the pipeline's lifetime — a different size means a new pipeline |
examples
Feature-detect, request, and use (JS + WGSL, per the proposal):
const adapter = await navigator.gpu.requestAdapter();
const requestedFeatures = [];
if (adapter.features.has("subgroup-size-control")) {
requestedFeatures.push("subgroup-size-control");
} else {
// Fall back to a driver-sized variant of the shader.
}
const device = await adapter.requestDevice({ requiredFeatures });
enable subgroups;
enable subgroup_size_control;
@compute @workgroup_size(64, 1, 1) @subgroup_size(32)
fn main(@builtin(subgroup_invocation_id) sg_id : u32,
@builtin(subgroup_size) sg_size : u32) {
// sg_size is guaranteed to be 32 in this pipeline.
}
tests
WebGPU conformance lives in the gpuweb/cts test suite rather than upstream WPT directories. A search of the CTS operation, shader-execution, and validation trees found no dedicated subgroup-size-control tests at fetch time (2026-07-29); the Intent to Ship does not record a WPT/CTS row beyond the standard process. Treat behavior as spec-defined but conformance-unverified in public test suites.
Source: gpuweb/cts repository (operation/execution/validation trees searched 2026-07-29); Intent to Shipbrowser compatibility
Interim table. BCD has no entry for this feature — api/GPUSupportedFeatures.json carries feature_subgroups but no feature_subgroup-size-control key, and there is no @subgroup_size WGSL entry (verified 2026-07-29). Rows below are compiled from the linked primary sources, not from BCD.
| Browser | Support | Evidence |
|---|---|---|
| Chrome | Enabled by default from 152 (desktop, Android, WebView) | milestone=152 listing; Intent to Ship; gpu_supported_features.idl (enum value present at trunk) |
| Edge | Mirrors Chrome (Chromium) | Chromium-based; no separate record |
| Firefox | Standards position positive; shipped support not recorded in public data | Intent thread — “Gecko: Positive … Feedback indicated via WebGPU standardization process”. BCD records Firefox 141 for the related subgroupMinSize/subgroupMaxSize queries, not for this feature |
| Safari | Standards position positive; shipped support not recorded in public data | Intent thread — “WebKit: Positive … Specification approval constitutes a positive signal”. BCD records Safari as not supporting the subgroup size queries at all (2026-07-29) |
security and privacy
- No new query surface — the working group deliberately declined new adapter limits (gpuweb#6241), so the feature adds no adapter-info fields. The pre-existing
subgroupMinSize/subgroupMaxSizequeries (part of"subgroups") already reveal the hardware's subgroup-size bounds. - Pipeline-creation oracle (minor) — because supported sizes are not enumerable, a page can only probe implementability by attempting pipeline creation and observing success/uncategorized-error. This is a slow, coarse signal of GPU capability, comparable in kind to the existing bounds queries; no spec mitigation is defined.
- No new shader capabilities — the attribute constrains scheduling geometry; it grants no additional memory access, precision, or instruction surface beyond what
"subgroups"already provides. - Availability variance — like every optional GPU feature, presence/absence contributes to adapter fingerprinting entropy already inherent in
adapter.features.
specifications
| Document | Status |
|---|---|
| WebGPU — feature index, "subgroup-size-control" | Merged (PR #5578, 2026-06-23): enables the WGSL attribute; auto-enables "subgroups"; no optional API surfaces |
| WGSL — subgroup_size_control enable extension + @subgroup_size attribute | Merged (same PR): grammar, parameter contract, and the full error taxonomy — detailed on the attribute page |
| subgroup-size-control proposal | Status “Merged”; motivation, native-API mapping (Vulkan/HLSL/Metal), behavior notes. The proposal text says “not been approved by the working group yet” — superseded by the merged spec; noted for provenance |
| Vulkan VK_EXT_subgroup_size_control · HLSL WaveSize (SM 6.6) | Native equivalents the design maps to (Metal: no equivalent) |
see also
@subgroup_sizeattribute reference — the WGSL grammar, parameters, and error taxonomy (this feature's real surface)- Chrome Platform Status — WebGPU: Subgroup Size Control (API record)
- blink-dev — Intent to Ship: WebGPU: Subgroup Size Control
- MDN — GPUAdapterInfo: subgroupMaxSize (the query side, which MDN covers; MDN has no page for this feature — verified 2026-07-29)
- webstatus.dev — WebGPU subgroups (related; Baseline limited)
- Chrome Platform Showcase — interactive demos for this feature