demo · v134 · graphics
WGSL Playground
Edit a WGSL compute shader that uses subgroup intrinsics — subgroupAdd, subgroupMax, subgroupBroadcast, subgroupShuffle — pick a preset, run it on this adapter, and read back the result buffer. Adapter limits exposed at top.
no adapter yet
— run to see output —
what each preset does
- subgroupAdd — every lane votes its
local_index, the intrinsic returns the sum across the subgroup. Workgroup of 64 → first 32 lanes sum to (0+1+…+31)=496, next 32 to 1488. - subgroupMax — every lane votes
(local_index * 7) % 41, intrinsic returns the max within the subgroup. Different per subgroup based on the modulus pattern. - subgroupBroadcast — lane 0 of each subgroup pushes
local_index * 100to every lane. - subgroupShuffle — lane i reads from lane (i+3) % subgroupSize.
see also
- WebGPU Subgroups — feature index
- Subgroups basics
- Reduction comparison