-
Notifications
You must be signed in to change notification settings - Fork 303
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
Adjusts subgroup built-in function names to match GLSL #4528
base: main
Are you sure you want to change the base?
Conversation
Adjusts built-in function names to match GLSL.
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.
Not a big fan of the quad names, but could go either way on the others.
I will note that 2 (MSL and HLSL) use sum and product instead of add and mul so GLSL is sort of the odd one out there.
For swap directions it's a coin flip for me with a slight leaning towards shorter names.
| `fn subgroupQuadBroadcast(e : T, id : I)` | `T` must be u32, i32, f32, f16 or a vector of those types<br>`I` must be u32 or i32 | Broadcasts `e` from the quad invocation with id equal to `id`<br>`e` must be a constant-expression<sup>2</sup> | | ||
| `fn subgroupQuadSwapHorizontal(e : T)` | `T` must be u32, i32, f32, f16 or a vector of those types | Swaps `e` between invocations in the quad in the X direction | | ||
| `fn subgroupQuadSwapVertical(e : T)` | `T` must be u32, i32, f32, f16 or a vector of those types | Swaps `e` between invocations in the quad in the Y direction | | ||
| `fn subgroupQuadSwapDiagonal(e : T)` | `T` must be u32, i32, f32, f16 or a vector of those types | Swaps `e` between invocations in the quad diagnoally | |
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.
I think GLSL did the wrong thing here. Why is subgroup in the name of a quad operation?
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.
Quad operations are basically clustered subgroup operations plus a guaranteed mapping of lane indices to the coordinates of the pixel grid. So it kind of makes sense, it is just overly verbose.
I am not a fan of the GLSL naming scheme either. I personally prefer the MSL naming scheme. Anyway, from what I can tell WGSL has mostly copied the GLSL naming scheme so far. |
agree with it, why |
This PR is part of gpuweb#4528 which only changes two operations ``` subgroupSum -> subgroupAdd subgroupProduct -> subgroupMul ``` And making builtin's consistent with GLSL, WGSL atomics and wgpu.
We are already very close to the GLSL naming scheme. I don't see any good reason why we should diverge from it for just a few function names.