Skip to content

WebGPURenderer: Compute Shaders - Extend max workgroups capabilities#28846

Merged
sunag merged 2 commits into
mrdoob:devfrom
RenaudRohlinger:utsubo/feat/extend-maxworkgroup
Jul 11, 2024
Merged

WebGPURenderer: Compute Shaders - Extend max workgroups capabilities#28846
sunag merged 2 commits into
mrdoob:devfrom
RenaudRohlinger:utsubo/feat/extend-maxworkgroup

Conversation

@RenaudRohlinger
Copy link
Copy Markdown
Collaborator

Description

The current implementation of dispatchWorkgroups is limited to one dimension, which equals device.limits.maxComputeWorkgroupsPerDimension and is usually around 64k (65535).

With the current implementation, the computeNode is initialized with a WorkgroupSizeX of 64, resulting in 65535 * 64 = 4,194,240.

This PR increases this limit by automatically dispatching the workgroup in the second dimension, raising the default capabilities to 65535^2 * 64 = 274,869,518,400, which I believe should handle every case. 😄

In the future, we could extend this by providing manual control of the X, Y, and Z dimensions for specific use cases, such as physics simulations. However, this should suffice for now, as using 3 dimensions or 1 dimension seems to yield the same performance output with most GPUs.

This contribution is funded by Utsubo

@RenaudRohlinger RenaudRohlinger added this to the r167 milestone Jul 11, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jul 11, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
683.5 kB (169.2 kB) 683.5 kB (169.2 kB) +0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
460.7 kB (111.1 kB) 460.7 kB (111.1 kB) +0 B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants