Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f17c4e8
Add extension `subgroup-size-control`
Jiawei-Shao Feb 27, 2026
a6d6e7a
Move `subgroup-size-control` and `subgroup_size` to the last
Jiawei-Shao Feb 27, 2026
5f91fdd
Fix a typo
Jiawei-Shao Feb 27, 2026
7837e6d
Simply some statements
Jiawei-Shao Feb 27, 2026
d38045f
Fix build error
Jiawei-Shao Feb 27, 2026
502846a
More fixes
Jiawei-Shao Feb 27, 2026
7aaed3a
More fix
Jiawei-Shao Feb 27, 2026
0243e09
More fix
Jiawei-Shao Feb 27, 2026
85d7d06
More fix
Jiawei-Shao Feb 27, 2026
39d36da
Address reviewer's comments
Jiawei-Shao Mar 4, 2026
0d7ecc5
Merge branch 'main' into add-subgroup-size-control
Jiawei-Shao Mar 12, 2026
a36b76f
Update correspondence reference
Jiawei-Shao Mar 12, 2026
a78a7e3
Fix build error
Jiawei-Shao Mar 12, 2026
a02d357
More fix
Jiawei-Shao Mar 12, 2026
07a258e
Merge branch 'main' into add-subgroup-size-control
Jiawei-Shao Mar 17, 2026
22e75bf
Merge branch 'main' into add-subgroup-size-control
Jiawei-Shao Mar 30, 2026
61f89aa
Address reviewer's comments and remove all the added attributes
Jiawei-Shao Apr 9, 2026
c870637
Update `correspondence/index.bs`
Jiawei-Shao Apr 9, 2026
07934d0
Address reviewer's comments
Jiawei-Shao Apr 16, 2026
ed4d294
Enable `subgroups` automatically with `subgroup-size-control`
Jiawei-Shao Apr 30, 2026
3192a9f
Merge branch 'main' into add-subgroup-size-control
Jiawei-Shao May 12, 2026
a963977
Address reviewer's comments
Jiawei-Shao May 13, 2026
6d584e2
Merge branch 'main' into add-subgroup-size-control
Jiawei-Shao May 13, 2026
994434e
Merge branch 'main' into add-subgroup-size-control
Jiawei-Shao May 14, 2026
ac04c31
Require `subgroups` when enabling `subgroup_size_control` in WGSL
Jiawei-Shao May 14, 2026
b3741fc
Merge branch 'main' into add-subgroup-size-control
Jiawei-Shao May 22, 2026
34971e2
Address reviewer's comments
Jiawei-Shao May 22, 2026
09f8c12
Fix typo
Jiawei-Shao May 22, 2026
7ae8740
Fix build error
Jiawei-Shao May 22, 2026
f7741c6
Merge branch 'main' into add-subgroup-size-control
Jiawei-Shao Jun 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions correspondence/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,15 @@ User agents are not required to use these formulas and may expose whatever they
<td>`viewportBoundsRange[0]` (= -2 &times; `max(maxViewportDimensions[0..1])`)
<td><p class=issue>*No documented limit?*
<td>-32768 = `D3D12_VIEWPORT_BOUNDS_MIN`

Note: equal to -2 &times; `maxTextureDimension2D`
<tr>
<th>Max Viewport Bounds (implied)
<td>[#373](https://github.com/gpuweb/gpuweb/issues/373)
<td>`viewportBoundsRange[1]` (= 2 &times; `max(maxViewportDimensions[0..1])` - 1)
<td><p class=issue>*No documented limit?*
<td>32767 = `D3D12_VIEWPORT_BOUNDS_MAX`

Note: equal to 2 &times; `maxTextureDimension2D` - 1
</table>

Expand All @@ -325,3 +325,32 @@ Warning:
[Imagination](https://github.com/gpuweb/gpuweb/issues/3631#issuecomment-1498747606) drivers.
On these drivers, the combined limit may need to be ignored.
</p>

## `subgroup-size-control` ## {#subgroup-size-control}

The `subgroup-size-control` feature allows the use of the WGSL `subgroup_size` attribute
in compute shaders to request a specific subgroup size for pipeline creation.

No explicit limits (such as min/max subgroup size or max workgroup subgroup count) are exposed
on `GPUAdapterInfo` for this feature
([#6241](https://github.com/gpuweb/gpuweb/issues/6241)).
Instead, if the implementation cannot create a pipeline with the requested subgroup size,
it results in an uncategorized error during pipeline creation.
At least one power-of-two subgroup size between `subgroupMinSize` and `subgroupMaxSize` must
be supported.

Note:
The native APIs do expose limits related to explicit subgroup size control:
- Vulkan: `VkPhysicalDeviceSubgroupSizeControlProperties::{minSubgroupSize, maxSubgroupSize, maxComputeWorkgroupSubgroups}`
- D3D12: `D3D12_FEATURE_DATA_D3D12_OPTIONS1::{waveLaneCountMin, waveLaneCountMax}`

These are not surfaced in WebGPU because:
- The D3D12 `waveLaneCountMax` is not reliable according to [DirectXShaderCompiler Wiki](https://github.com/microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics/#caps-flags).
- The D3D12 `waveLaneCountMin` may differ from the actual minimum subgroup sizes used in fragment shaders on some Intel GPUs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Continuing a conversation from gpuweb/cts#4641 (comment) @Jiawei-Shao @jrprice:

I understand that if we set subgroupMinSize to 8 (because of fragment) then it's not going to be valid for compute on this device. I guess what I'm saying is if this AdapterInfo isn't going to provide enough information about the hardware to actually use the API, it seems bad.

  • IF it would otherwise be the case that all values between subgroupMinSize and subgroupMaxSize are valid for trivial pipelines, I really would like to try to maintain that invariant and test it. The test (now removed) suggested this would be true, by arbitrarily choosing subgroupMaxSize as the value to test, for all devices except these Intel ones.

    The options I see for doing that are:

    • Redefine subgroupMinSize so it only applies to compute - assuming this is a non-starter since it's used for more than just subgroup-size-control
    • Separate the compute and fragment subgroupMinSize/subgroupMaxSize
    • Implementation artificially increases subgroupMinSize to 16 even for fragment by using subgroup size control to prevent 8 from actually being used in fragment - no clue if this is possible
  • IF NOT, it doesn't really matter and we can leave the spec as is. The test (when we re-add it) should be changed to keep trying different subgroup sizes until it find one that works. We can use the vendor/architecture to choose the order in which we try different subgroup sizes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The test (now removed) suggested this would be true, by arbitrarily choosing subgroupMaxSize as the value to test, for all devices except these Intel ones.

I've put this test in another PR 4643.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess what I'm saying is if this AdapterInfo isn't going to provide enough information about the hardware to actually use the API, it seems bad.

Part of the argument I made in this comment (discussed more in these meeting minutes) was that the value of this limit alone often isn't enough to use the feature either. Knowing that the minimum possible subgroup size is 8 vs 16 vs ... doesn't tell you enough about the memory hierarchy or other hardware properties to decide how your shader should operate. Middleware will want to know if it's Intel vs NVIDIA vs AMD vs ..., and potentially different generations of these architectures, in order to decide how to tile data through memory and registers (for example). At this point they have likely already decided what subgroup size they want based on the architecture, and they won't be considering using 8 on Intel regardless of what the limit says.

I agree that it'd be nice if every value between the limits was reliable usable for a trivial pipeline. My understanding is that over time that will increasingly be true, as it is just this one generation of Intel GPUs that has this issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure, real applications have more complex requirements. But the issue with this Intel generation seems very specific, just that there's one value that's valid for fragment that's not valid for compute? That seems like something to try to paper over, not something to expose as a wart.

For CTS, there's two reasons I would like to aspirationally test that all values in the range work for a trivial pipeline: (1) so applications can (at least mostly) not worry about that particular detail, (2) so that we can check that the values the implementation exposes are actually the correct ones for the device. The latter is quite valuable IMO.

@kainino0x kainino0x Jun 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Implementation artificially increases subgroupMinSize to 16 even for fragment by using subgroup size control to prevent 8 from actually being used in fragment - no clue if this is possible

James clarified to me offline that my idea to paper over the difference by using the backend's subgroup size control to prevent fragment shaders from ever selecting 8 (even if it would be allowed) won't work, because subgroup size control is compute-only. So seems like papering over is probably not feasible and the only two reasonable options are internal error (the current proposal) or adding a new limit.

The current option does have me somewhat questioning the value of subgroupMinSize/subgroupMaxSize in the first place if sometimes there will be values in that range that just don't work at all. But I guess that ship has sailed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Redefine subgroupMinSize so it only applies to compute - assuming this is a non-starter since it's used for more than just subgroup-size-control

Maybe this is still feasible? If subgroupMinSize/subgroupMaxSize is going to have very limited use anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jrprice @dneto0 What do you think about Kai's comment?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would be a breaking change to the API. I don't know how frequently these properties are used for fragment shaders but I'm not sure that we could change them at this stage.

- `maxComputeWorkgroupSubgroups` only exists on Vulkan and has no D3D12 equivalent.

Metal does not natively support explicit subgroup size control. According to the
[Metal documentation](https://developer.apple.com/documentation/apple-silicon/porting-your-metal-code-to-apple-silicon#Determine-the-SIMD-Group-Size-at-Runtime):
"The size of a SIMD group varies between different GPUs, particularly Mac GPUs. Don't assume the size of SIMD groups."
Browsers may choose to expose the feature on Metal+Apple Silicon with a single constant subgroup
size, but they do so at their own risk since the SIMD width is not guaranteed.
41 changes: 10 additions & 31 deletions proposals/subgroup-size-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,25 @@ This feature has not been approved by the working group yet.
| Metal | Not Supported | According to [Metal document](https://developer.apple.com/documentation/apple-silicon/porting-your-metal-code-to-apple-silicon#Determine-the-SIMD-Group-Size-at-Runtime): <br>"The size of a SIMD group varies between different GPUs, particularly Mac GPUs. Don't assume the size of SIMD groups." |


Note that on Vulkan we need `computeFullSubgroups == VK_TRUE` because we should set `VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT` when creating the compute pipelien to ensure the subgroup sizes must be launched with all invocations active in the compute stage.
Note that
* On Vulkan we need `computeFullSubgroups == VK_TRUE` because we should set `VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT` when creating the compute pipeline to ensure the subgroup sizes must be launched with all invocations active in the compute stage.
* Metal does not natively support controlling subgroup size, but the browsers may choose to expose the feature on Metal at their own risk.

TODO: Shall we support this extension on the newer Apple silicons with a single acceptable subgroup size?
2. No additional explicit limits are exposed on `GPUAdapterInfo`.

2. Three new limitations for the WGSL attribute `subgroup_size`.
Previously, three limits were proposed (`explicitComputeSubgroupMinSize`, `explicitComputeSubgroupMaxSize`, `maxComputeWorkgroupSubgroups`) to expose the range of valid subgroup sizes and workgroup subgroup counts. The working group decided not to expose them ([#6241](https://github.com/gpuweb/gpuweb/issues/6241)). The reasons:
* Most users of this feature are expert developers coding for a specific architecture who already know which subgroup sizes to use.
* The native API limits do not always accurately represent the range of usable sizes (e.g. on Intel Gen12, `waveLaneCountMin` is 8 but the minimum requestable compute subgroup size is 16; on D3D12, `waveLaneCountMax` is not reliable).
* `maxComputeWorkgroupSubgroups` only exists on Vulkan and has no D3D12 equivalent.

(1) `minExplicitComputeSubgroupSize` specifies the minimum value that can be used as the attribute `subgroup_size`.

| Platform | Implementation |
|----------|------|
|Vulkan|`VkPhysicalDeviceSubgroupSizeControlPropertiesEXT::minSubgroupSize` |
|D3D12|`D3D12_FEATURE_DATA_D3D12_OPTIONS1::waveLaneCountMin` |

(2) `maxExplicitComputeSubgroupSize` specifies the maximum value that can be used as the attribute `subgroup_size`.

| Platform | Implementation |
|----------|------|
|Vulkan|`VkPhysicalDeviceSubgroupSizeControlPropertiesEXT::maxSubgroupSize` |
|D3D12|`D3D12_FEATURE_DATA_D3D12_OPTIONS1::waveLaneCountMax` |

(3) `maxComputeWorkgroupSubgroups` limits the total workgroup size when the attribute `subgroup_size` is used.

| Platform | Implementation |
|----------|------|
|Vulkan|`VkPhysicalDeviceSubgroupSizeControlProperties.maxComputeWorkgroupSubgroups` |
|D3D12| Not supported |

Note that we need new limitations instead of the existing `subgroupMinSize` and `subgroupMaxSize` is because:
1. D3D12 runtime validates `[WaveSize]` with `waveLaneCountMin` and `waveLaneCountMax`
2. On D3D12 we don't always use `waveLaneCountMin` as `subgroupMinSize` because on some Intel GPUs, it is possible to run some pixel shaders with wave lane count 8, while on that platform `waveLaneCountMin` is 16, meaning in compute shaders the wave lane count will always be at least 16.
3. On D3D12 we don't always use `waveLaneCountMax` as `subgroupMaxSize` because in [D3D12 document](https://github.com/Microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics#:~:text=UINT%20WaveLaneCountMax) "the WaveLaneCountMax queried from D3D12 API is not reliable and the meaning is unclear.
Instead, if the implementation cannot create a pipeline with the requested subgroup size (e.g. due to the size being outside the supported range, register pressure, or hardware-specific workgroup subgroup count limits), it results in an **uncategorized error** during pipeline creation. The implementation must support at least one power-of-two subgroup size between `subgroupMinSize` and `subgroupMaxSize` (from `GPUAdapterInfo`).


# Behavior
* The attribute `subgroup_size` is restricted to `compute` shaders (in HLSL `[WaveSize()]` is [only supported in compute shaders](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html#hlsl-attribute)).
* The parameter must be a const-expression or an override-expression that resolves to an `i32` or `u32`.
* The parameter must be must be a power-of-two (required by [D3D12](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html#allowed-wave-sizes)).
* The parameter must be greater than or equal to the `minExplicitComputeSubgroupSize` on the current adapter (required by [D3D12](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html#runtime-validation)).
* The parameter must be less than or equal to the `maxExplicitComputeSubgroupSize` on the current adapter (required by [D3D12](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html#runtime-validation)).
* The total workgroup size (`workgroupSize.x * workgroupsize.y * workgroupsize.z`) must be less than or equal to the product of the attribute `subgroup_size` and `maxComputeWorkgroupSubgroups` (required by [Vulkan](https://docs.vulkan.org/refpages/latest/refpages/source/VkPipelineShaderStageCreateInfo.html#VUID-VkPipelineShaderStageCreateInfo-pNext-02756)).
* If the implementation cannot create a pipeline with the requested subgroup size (e.g. due to the size being outside the supported range, register pressure, or hardware-specific workgroup subgroup count limits), it results in an uncategorized error during pipeline creation. The implementation must support at least one power-of-two subgroup size between `subgroupMinSize` and `subgroupMaxSize`.
* `workgroupSize.x` must be a multiple of the attribute `subgroup_size` (required by [Vulkan](https://docs.vulkan.org/refpages/latest/refpages/source/VkPipelineShaderStageCreateInfo.html#VUID-VkPipelineShaderStageCreateInfo-pNext-02757)).

# WGSL Specification
Expand Down
19 changes: 19 additions & 0 deletions spec/index.bs
Comment thread
Kangz marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ spec: WGSL; urlPrefix: https://gpuweb.github.io/gpuweb/wgsl/#
text: dual_source_blending; url: extension-dual_source_blending
text: subgroups; url: extension-subgroups
text: primitive_index; url: extension-primitive_index
text: subgroup_size_control; url: extension-subgroup_size_control
for: attribute
text: subgroup_size; url: subgroup-size-attr
for: language-extension
text: readonly_and_readwrite_storage_textures; url: language_extension-readonly_and_readwrite_storage_textures
text: packed_4x8_integer_dot_product; url: language_extension-packed_4x8_integer_dot_product
Expand Down Expand Up @@ -3059,6 +3062,7 @@ enum GPUFeatureName {
"texture-formats-tier2",
"primitive-index",
"texture-component-swizzle",
"subgroup-size-control",
};
</script>

Expand Down Expand Up @@ -17449,6 +17453,8 @@ This feature adds the following [=optional API surfaces=]:

Allows the use of the subgroup and quad operations in WGSL.

Note: This feature is automatically enabled by {{GPUFeatureName/"subgroup-size-control"}}.

This feature adds no [=optional API surfaces=], but the following entries of {{GPUAdapterInfo}}
expose real values whenever the feature is available on the adapter:
- {{GPUAdapterInfo/subgroupMinSize}}
Expand Down Expand Up @@ -17554,6 +17560,19 @@ This feature adds the following [=optional API surfaces=]:
- New {{GPUTextureViewDescriptor}} dictionary members:
- {{GPUTextureViewDescriptor/swizzle}}

<h3 id=dom-gpufeaturename-subgroup-size-control data-dfn-type=enum-value data-dfn-for=GPUFeatureName>`"subgroup-size-control"`
</h3>

Allows the use of the [=attribute/subgroup_size=] attribute in WGSL to control compute pipeline subgroup size.

Enabling {{GPUFeatureName/"subgroup-size-control"}} at device creation will enable
{{GPUFeatureName/"subgroups"}}.

This feature adds no [=optional API surfaces=].

- New WGSL extensions:
- [=extension/subgroup_size_control=]

# Appendices # {#appendices}

## Texture Format Capabilities ## {#texture-format-caps}
Expand Down
49 changes: 49 additions & 0 deletions wgsl/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ spec: WebGPU; urlPrefix: https://gpuweb.github.io/gpuweb/#
type: enum-value
for: GPUFeatureName
text: "primitive-index"; url: dom-gpufeaturename-primitive-index
text: "subgroup-size-control"; url: dom-gpufeaturename-subgroup-size-control
</pre>

# Introduction # {#intro}
Expand Down Expand Up @@ -1410,6 +1411,7 @@ The [=syntax/attribute=] names are:
* <a for=attribute lt=size>`'size'`</a>
* <a for=attribute lt=vertex>`'vertex'`</a>
* <a for=attribute lt=workgroup_size>`'workgroup_size'`</a>
* <a for=attribute lt=subgroup_size>`'subgroup_size'`</a>

### Built-in Value Names ### {#builtin-value-names}

Expand Down Expand Up @@ -1488,6 +1490,7 @@ The [=enable-extension=] names are:
* <a for=extension lt=dual_source_blending>`'dual_source_blending'`</a>
* <a for=extension lt=subgroups>`'subgroups'`</a>
* <a for=extension lt=primitive_index>`'primitive_index'`</a>
* <a for=extension lt=subgroup_size_control>`'subgroup_size_control'`</a>

The valid [=language extension=] names are listed in [[#language-extensions-sec]] but in general have the same form as an [=identifier=]:

Expand Down Expand Up @@ -1864,6 +1867,12 @@ The valid [=enable-extensions=] are listed in the following table.
<td>The built-in variable [=built-in values/primitive_index=] is valid to use in the WGSL
module. Otherwise, using [=built-in values/primitive_index=] will result in a
[=shader-creation error=].
<tr><td><dfn noexport dfn-for="extension">`subgroup_size_control`</dfn>
<td>{{GPUFeatureName/"subgroup-size-control"}}
<td>The attribute [=attribute/subgroup_size=] is valid to use in the WGSL module.
Otherwise, using [=attribute/subgroup_size=] will result in a [=shader-creation error=].
[=shader-creation error|Must=] be enabled together with the [=extension/subgroups=] extension.
Otherwise, enabling [=extension/subgroup_size_control=] will result in a [=shader-creation error=].
</table>

<div class='example wgsl using extensions expect-error' heading="Using hypothetical enable-extensions">
Expand Down Expand Up @@ -8518,6 +8527,7 @@ The [=return type=], if specified, [=shader-creation error|must=] be [=construct
WGSL defines the following attributes that can be applied to function declarations:
* the [=shader stage attributes=]: [=attribute/vertex=], [=attribute/fragment=], and [=attribute/compute=]
* [=attribute/workgroup_size=]
* [=attribute/subgroup_size=]

WGSL defines the following attributes that can be applied to function
parameters and return types:
Expand Down Expand Up @@ -9215,6 +9225,41 @@ path: syntax/size_attr.syntax.bs.include

</table>

## `subgroup_size` ## {#subgroup-size-attr}
Comment thread
Jiawei-Shao marked this conversation as resolved.

<pre class=include>
path: syntax/subgroup_size_attr.syntax.bs.include
</pre>

<table class='data builtin'>
<caption><dfn noexport dfn-for="attribute">`subgroup_size`</dfn> Attribute</caption>
<tr>
<td style="width:10%">Description
<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.

<tr>
<td>Requires
<td>[=shader-creation error|Must=] only be used when the [=extension/subgroup_size_control=] extension is enabled.

<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>

If the value is not a power of two, then:
Comment thread
Jiawei-Shao marked this conversation as resolved.
* 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=].

A [=pipeline-creation error=] results if the x-dimension of the entry point's
`workgroup_size` is not a multiple of the `subgroup_size` value.

Pipeline creation may result in an [=uncategorized error=] due to register pressure
or specific hardware limitations even when the value is between
{{GPUAdapterInfo/subgroupMinSize}} and {{GPUAdapterInfo/subgroupMaxSize}}.

</table>

## `workgroup_size` ## {#workgroup-size-attr}

<pre class=include>
Expand Down Expand Up @@ -9385,6 +9430,7 @@ It will stabilize in a finite number of steps.
WGSL defines the following attributes that can be applied to entry point declarations:
* the [=shader stage attributes=]: [=attribute/vertex=], [=attribute/fragment=], and [=attribute/compute=]
* [=attribute/workgroup_size=]
* [=attribute/subgroup_size=]

<div class='example wgsl global-scope' heading='workgroup_size Attribute'>
<xmp highlight=wgsl>
Expand Down Expand Up @@ -10119,6 +10165,9 @@ Each is described in detail in subsequent sections.
<tr><td style="width:10%">Description
<td>
The [=subgroup size=] of current invocation's subgroup.

For compute shaders with a [=attribute/subgroup_size=] attribute, this value
is equal to the specified attribute value.
</table>

##### `subgroup_id` ##### {#subgroup-id-builtin-value}
Expand Down
5 changes: 5 additions & 0 deletions wgsl/syntax.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ workgroup_size_attr :
| '@' 'workgroup_size' '(' expression ',' expression ',' expression ',' ? ')'
;

subgroup_size_attr :
'@' 'subgroup_size' '(' expression ',' ? ')'
;

vertex_attr :
'@' 'vertex'
;
Expand Down Expand Up @@ -202,6 +206,7 @@ attribute :
| must_use_attr
| size_attr
| workgroup_size_attr
| subgroup_size_attr
| vertex_attr
| fragment_attr
| compute_attr
Expand Down
2 changes: 2 additions & 0 deletions wgsl/syntax/attribute.syntax.bs.include
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

<span class="choice">|</span> [=syntax/workgroup_size_attr=]

<span class="choice">|</span> [=syntax/subgroup_size_attr=]

<span class="choice">|</span> [=syntax/vertex_attr=]

<span class="choice">|</span> [=syntax/fragment_attr=]
Expand Down
5 changes: 5 additions & 0 deletions wgsl/syntax/subgroup_size_attr.syntax.bs.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class='syntax' noexport='true'>
<dfn for=syntax>subgroup_size_attr</dfn> :

<span class="choice"></span> <a for=syntax_sym lt=attr>`'@'`</a> `'subgroup_size'` <a for=syntax_sym lt=paren_left>`'('`</a> [=syntax/expression=] <a for=syntax_sym lt=comma>`','`</a> ? <a for=syntax_sym lt=paren_right>`')'`</a>
</div>
2 changes: 2 additions & 0 deletions wgsl/wgsl.recursive.bs.include
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
| `'@'` `'location'` `'('` [=recursive descent syntax/expression=] `','` ? `')'`

| `'@'` `'size'` `'('` [=recursive descent syntax/expression=] `','` ? `')'`

| `'@'` `'subgroup_size'` `'('` [=recursive descent syntax/expression=] `','` ? `')'`
</div>

<div class='syntax' noexport='true'>
Expand Down
Loading