Teo chased down some background here. We have the following lovely code in the [`wgpu_hal::dx12`][be] backend:
```
max_compute_workgroup_storage_size: base.max_compute_workgroup_storage_size, //TODO?
```
According to the [WebGPU correspondence doc][c]:
```
<tr>
<th>`maxComputeWorkgroupStorageSize`
<td>[#1863](https://github.com/gpuweb/gpuweb/issues/1863)
<td>`maxComputeSharedMemorySize`
<td>`Maximum total threadgroup memory allocation`
<td>[32 KiB](https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm#18.6.6%20Inter-Thread%20Data%20Sharing)
```
According to the D3D11 functional spec text linked above, this is just a fixed constant, not specific to the device:
> The hardware functionality required to address this in the DirectX11 shader model 5.0 compute shader is a predefined block of 32kB (8192 DWORDs) of register space that can be declared within a shader to be of storage class “groupShared”. Registers declared to be of this class can be shared between threads in the group.
I believe this means fixing `wgpu_hal` should be as simple as just hard-coding 32k.
[c]: https://github.com/gpuweb/gpuweb/blob/b86916a59ba76f49f69098c379b2df37b58c4333/correspondence/index.bs#L257-L262
[be]: https://github.com/gfx-rs/wgpu/blob/d09c730c02e5449b2075e88490f7c66b727157d9/wgpu-hal/src/dx12/adapter.rs#L592
Bug 1970416 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Teo chased down some background here. We have the following lovely code in the [`wgpu_hal::dx12`][be] backend:
```
max_compute_workgroup_storage_size: base.max_compute_workgroup_storage_size, //TODO?
```
According to the [WebGPU correspondence doc][c]:
```
<tr>
<th>`maxComputeWorkgroupStorageSize`
<td>[#1863](https://github.com/gpuweb/gpuweb/issues/1863)
<td>`maxComputeSharedMemorySize`
<td>`Maximum total threadgroup memory allocation`
<td>[32 KiB](https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm#18.6.6%20Inter-Thread%20Data%20Sharing)
```
According to the [D3D11 functional spec][d3] text linked above, this is just a fixed constant, not specific to the device:
> The hardware functionality required to address this in the DirectX11 shader model 5.0 compute shader is a predefined block of 32kB (8192 DWORDs) of register space that can be declared within a shader to be of storage class “groupShared”. Registers declared to be of this class can be shared between threads in the group.
I believe this means fixing `wgpu_hal` should be as simple as just hard-coding 32k.
[c]: https://github.com/gpuweb/gpuweb/blob/b86916a59ba76f49f69098c379b2df37b58c4333/correspondence/index.bs#L257-L262
[be]: https://github.com/gfx-rs/wgpu/blob/d09c730c02e5449b2075e88490f7c66b727157d9/wgpu-hal/src/dx12/adapter.rs#L592
[d3]: https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm#18.6.6%20Inter-Thread%20Data%20Sharing