Adjusts subgroup built-in function names to match GLSL#4528
Adjusts subgroup built-in function names to match GLSL#4528Lichtso wants to merge 1 commit intogpuweb:mainfrom
Conversation
Adjusts built-in function names to match GLSL.
alan-baker
left a comment
There was a problem hiding this comment.
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.
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.
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.
This PR is part of #4528 which only changes two operations ``` subgroupSum -> subgroupAdd subgroupProduct -> subgroupMul ``` And making builtin's consistent with GLSL, WGSL atomics and wgpu.
WGSL 2024-06-04 Minutes
|
|
Thank you for the proposal, though! |
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.