Skip to content

Add extension subgroup-size-control#5578

Open
Jiawei-Shao wants to merge 9 commits intogpuweb:mainfrom
Jiawei-Shao:add-subgroup-size-control
Open

Add extension subgroup-size-control#5578
Jiawei-Shao wants to merge 9 commits intogpuweb:mainfrom
Jiawei-Shao:add-subgroup-size-control

Conversation

@Jiawei-Shao
Copy link
Contributor

@Jiawei-Shao Jiawei-Shao commented Feb 27, 2026

This patch adds a new WebGPU and WGSL extension subgroup-size-control
based on subgroup-size-control.md.

Fixed: #5545

@Jiawei-Shao Jiawei-Shao marked this pull request as draft February 27, 2026 07:19
@Jiawei-Shao Jiawei-Shao marked this pull request as ready for review February 27, 2026 07:58
@github-actions
Copy link
Contributor

Previews, as seen when this build job started (85d7d06):
WebGPU webgpu.idl | Explainer | Correspondence Reference
WGSL grammar.js | wgsl.lalr.txt

@dneto0 dneto0 requested review from dneto0 February 27, 2026 14:40
Comment on lines +1985 to +1986
readonly attribute unsigned long minExplicitComputeSubgroupSize;
readonly attribute unsigned long maxExplicitComputeSubgroupSize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit awkward that there are two min/max attributes. Are there devices where subgroupMin/MaxSize do not match min/maxExplicitComputeSubgroupSize?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separately the naming conventions seem mismatched. If these are needed, maybe explicit[Compute]SubgroupMinSize and explicit[Compute]SubgroupMaxSize. Not sure including compute is helpful.


Note: To preserve privacy, the user agent may choose to not support some features or provide values
for the property which do not distinguish different devices, but are still usable
(e.g. use the default value of 4 for all devices).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this wouldn't work. The user agent can't default to 4 for all devices unless 4 is supported by all devices.

Maybe it would be better to say the user agent may choose a narrower range for min (and max) to limit distinguishing devices.


1. If {{GPUFeatureName/"subgroup-size-control"}} is supported, set
{{GPUAdapterInfo/maxComputeWorkgroupSubgroups}} to the largest supported number of
subgroups per compute workgroup with explicit subgroup size. Otherwise, set this value to 32.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 32 guaranteed supported on all devices or are implementations expected to filter out devices with less?

vulkan.gpuinfo.org seems to indicate there are devices that only support 16.

<td>Specifies the subgroup size for a compute shader invocation.

[=shader-creation error|Must=] only be applied to a [=compute shader stage|compute shader=] entry point function.
[=shader-creation error|Must not=] be applied to any other object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be removed since the previous statement says "must only".


[=shader-creation error|Must=] only be applied to a [=compute shader stage|compute shader=] entry point function.
[=shader-creation error|Must not=] be applied to any other object.
[=shader-creation error|Must=] only be used when the [=extension/subgroup_size_control=] extension is enabled.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is first attribute requiring an extension. I'd suggest a new row, "Requires".

<tr>
<td>Parameters
<td>[=shader-creation error|must=] be a [=const-expression=] or an [=override-expression=] that [=type rules|resolves=] to an [=i32=] or [=u32=].<br>
[=shader-creation error|must=] be a power of two.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs fleshed out.

Suggested change
[=shader-creation error|must=] be a power of two.
If the value is not a power of two, then:
* It is a [=shader-creation error=] if the expression is a [=const-expression=].
* It is a [=pipeline-creation error=] if the expression is an [=override-expression=].

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.

Subgroup Size Control

2 participants