-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the compute limits, adds maxComputeWorkgroupSize #1898
Conversation
Validation was incorrectly checking values were above limits instead of below limits. maxComputeWorkgroupSize is necessary because the 3rd component of workgroup_size is almost always 64 in Vulkan devices (on mobile and desktop).
Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
Thanks for the suggestions, applied all of them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why are the base limits for workgroup size and invocations higher than Vulkan? Vulkan only provides (128,128,64) for size and 128 for invocations by default.
Co-authored-by: alan-baker <alanbaker@google.com>
Co-authored-by: alan-baker <alanbaker@google.com>
It is because looking at vulkan.gpuinfo.org the only devices that don't support (256, 256, 64) are Swiftshader (which I just fixed in this CL) and a few ARM devices that correspond to very old Mali. We try to support a wide variety of Android Vulkan devices but are ok removing some percentage of them to raise WebGPU's core feature level. The others can be supported through lower-feature levels on GLES in the future. |
I'm curious whether there are any devices where We should also add some kind of guarantee that the adapter limits make sense For example, on this random phone (first one I looked at), the max is Aside: now that I've been looking at it repeatedly, "workgroup invocations" confused me, it sounds like "number of workgroup invocations" not "number of invocations in a workgroup". Should we rename to, like, |
+1 on using some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The observation that Kai makes is quite interesting. We shouldn't define limits "just in case" the future hardware comes and needs them. We should be ready to have Limits V2 at some point, anyway. Hopefully, not soon :)
@@ -1282,6 +1288,7 @@ interface GPUSupportedLimits { | |||
readonly attribute unsigned long maxInterStageShaderComponents; | |||
readonly attribute unsigned long maxComputeWorkgroupStorageSize; | |||
readonly attribute unsigned long maxComputeWorkgroupInvocations; | |||
readonly attribute GPUExtent3D maxComputeWorkgroupSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the GPUExtent3D
is a bit strange here. It's made for texture sizes specifically, hence depthOrArrayLayers
field, but the compute workgroup grid has no direct relation to the texture sizes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is readonly and described as [256, 256, 64]
above. The intent is that it is always the array version. I agree that the parallels with texture size are weird because they should be non-existent, but we're really talking about a volume here so it makes sense to use Extent3D
imho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intent is to use the array, any reason to not put sequence<GPUIntegerCoordinate>
in here?
I don't know how users are expected to deal with GPUExtent3D
coming from us. It's one thing to pass in either a list or a structure. It's another thing to not know what to do with this type when it comes to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is because WebIDL doesn't have [GPUIntegerCoordinate; 3]
to show the sequence is statically sized, while GPUExtent3D
is clearly sized. But happy to change, this doesn't really matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, no strong feelings here, we can follow-up
Editors came up with "maxComputeInvocationsPerWorkgroup" All together that would be:
|
Validation was incorrectly checking values were above limits instead of
below limits.
maxComputeWorkgroupSize is necessary because the 3rd component of
workgroup_size is almost always 64 in Vulkan devices (on mobile and
desktop).
Preview | Diff