v145 · WebGPU · Divergence Stress

Divergence stress

Run a parameterised compute shader and watch how the divergence ratio in a workgroup affects throughput. The subgroup uniformity feature unlocks ops that demand non-divergent control flow — this page shows when you stop paying for it.

controls

Press Dispatch to benchmark.

code

// Shader pseudo (the live page uses CPU fallback if WebGPU is unavailable):
@compute @workgroup_size(64) fn cs(@builtin(global_invocation_id) id: vec3u) {
  if (id.x % UNIFORM_THRESHOLD == 0u) {
    // uniform branch — subgroup ops legal here
    result[id.x] = subgroupBroadcast(result[id.x], 0);
  } else {
    result[id.x] = result[id.x] * 2;
  }
}
// Chrome 145 ships the subgroup uniformity feature so the compiler
// can prove uniformity and emit faster subgroup intrinsics.

see also