Add extension `subgroup-size-control` by Jiawei-Shao · Pull Request #5578 · gpuweb/gpuweb

@Jiawei-Shao

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

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@github-actions

alan-baker

Comment on lines +1985 to +1986

readonly attribute unsigned long minExplicitComputeSubgroupSize;
readonly attribute unsigned long maxExplicitComputeSubgroupSize;

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?

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.

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?

On D3D12 we should use D3D12_FEATURE_DATA_D3D12_OPTIONS1::waveLaneCountMin and D3D12_FEATURE_DATA_D3D12_OPTIONS1::waveLaneCountMax to verify the range of the [WaveSize] attribute in compute shader, but these two values are not always used as wgpu::AdapterInfo::subgroupMinSize or wgpu::AdapterInfo::subgroupMaxSize.

For example:


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

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.

Choose a reason for hiding this comment

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

Now I all use 0 as the default values since they won't be used when subgroup-size-control is not supported.


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.

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.

Choose a reason for hiding this comment

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

Now I all use 0 as the default values since they won't be used when subgroup-size-control is not supported.

@Jiawei-Shao

@jimblandy

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao

@Jiawei-Shao