The chromium_experimental_subgroup_size_control is an experimental extension that allows the use of the subgroup_size attribute in compute shaders in WGSL. When the attribute subgroup_size is declared, the compute shader will only be executed with the specified subgroup size, and the built-in value subgroup_size will be the the value of the attribute subgroup_size. Otherwise, the compute shader may be executed with a subgroup size chosen by the GPU driver, which is unknown before the execution of the compute shader.
This extension is experimental and the syntax is being discussed. No official WebGPU specification has been written yet.
The status can be tracked at 463721943.
The usage is restricted to compute shaders.
| Backend | Implementation | Requirements |
|---|---|---|
| D3D12 | [WaveSize(<numLanes>)] in HLSL | Shader Model 6.6 |
| Vulkan | requiredSubgroupSize in VkPipelineShaderStageRequiredSubgroupSizeCreateInfo on the API side | subgroupSizeControl in VK_EXT_subgroup_size_control or Vulkan 1.3 |
| Metal | Not Supported | Not Supported |
subgroupSizeControl according to the report on GPUInfo.org.enable statement to be used. For this experimental extension it would be enable chromium_experimental_subgroup_size_control.This extension adds a new subgroup_size attribute for compute shaders.
This extension must be used together with the extension subgroups.
subgroup_size_attr :
'@' 'subgroup_size' '(' expression ',' ? ')'
i32 or u32.subgroupMinSize on the current adapter.subgroupMaxSize on the current adapter. We need to fix the D3D12 backend to report correct subgroupMaxSize on current adapter.subgroup_size.enable subgroups; enable chromium_experimental_subgroup_size_control; @subgroup_size(32) @compute @workgroup_size(64, 1, 1) fn main(@builtin(subgroup_invocation_id) sg_id : u32, @builtin(subgroup_size) sg_size : u32) { }
This extension also adds a new limit maxComputeWorkgroupSubgroups, which is required by Vulkan VK_EXT_subgroup_size_control and defined in VkPhysicalDeviceSubgroupSizeControlProperties.maxComputeWorkgroupSubgroups. Note that there is no such limitation on D3D12.
| Limit name | Type | Limit class | Default | Compatibility Mode Default |
|---|---|---|---|---|
maxComputeWorkgroupSubgroups | GPUSize32 | maximum | - | Not Supported |
workgroup_size attribute, subgroup_size attribute and maxComputeWorkgroupSubgroups limit must follow below requirement:workgroup_size.x * workgroup_size.y * workgroup_size.z <= subgroup_size * maxComputeWorkgroupSubgroups