demo · v144

subgroup_id Visualiser

Pick a workgroup size and simulated subgroup size — the grid colours each invocation by the subgroup_id it would see. When WebGPU subgroups are available the demo also dispatches a real compute pass and reads back the IDs.

WebGPU + subgroups feature: checking…
ready

the WGSL

enable subgroups;

@compute @workgroup_size(64)
fn main(
  @builtin(local_invocation_index) idx: u32,
  @builtin(subgroup_id) sid: u32,
) {
  out[idx] = sid;
}

see also