gpuweb icon indicating copy to clipboard operation
gpuweb copied to clipboard

Add `subgroups-f16` feature dependency validation to subgroups proposal?

Open jiangzhaoming opened this issue 1 year ago • 3 comments

Currently in the subgroups proposal we have two WebGPU features, subgroups and subgroups-f16, to enable corresponding WGSL extensions subgroups and subgroups_f16.

Since WebGPU feature subgroups-f16 is to enable using WGSL subgroups_f16 to allow using subgroups built-in function with f16 types, it is unreasonable to require this feature when creating devices without also requiring features shader-f16 and subgroups, and the adapter should report supporting subgroups-f16 only if it also supports shader-f16 and subgroups features. The same idea also applies to the WGSL extensions, i.e. it is unreasonable to enable shader_f16 extension without also enabling f16 and subgroups.

If we are going to keep subgroups-f16 feature and WGSL extension, maybe we can add notes in the subgroups proposal to states e.g.

  • When requestDevice called with subgroups-f16 feature required, the returning promise should be rejected with a TypeError if shader-f16 or subgroups is not also required.

Such validation rule may add a new aspect of features dependency into the validation.

For WGSL shader, maybe we can add notes like

  • It is a shader-creation error if subgroups_f16 extension is enabled without also enabling f16 and subgroups.

jiangzhaoming avatar Jul 05 '24 09:07 jiangzhaoming

That certainly seems reasonable. I think this is the first instance (for WGSL at least) of dependent features.

alan-baker avatar Jul 08 '24 13:07 alan-baker

I was hoping that we won't need an extra feature for this. There are very few devices/drivers that don't support both f16 and subgroups. Metal and D3D12 won't benefit from a subgroups-f16 feature either.

https://github.com/teoxoy/gpuinfo-vulkan-query/blob/8681e0074ece1b251177865203d18b018e05d67a/subgroups.txt#L1416-L1466

We are also limited by the nr of feature/limit buckets we can expose.

teoxoy avatar Jul 26 '24 08:07 teoxoy

I agree that it would be nice to get to that point, but while the proposal lists subgroups-f16 it makes sense to make it dependent. We haven't really discussed removing the option yet to my knowledge in meeting.

alan-baker avatar Jul 26 '24 13:07 alan-baker

At the recent F2F we decided to drop the subgroups-f16 feature.

@alan-baker

dneto0 avatar Nov 21 '24 20:11 dneto0