HomeComputer ScienceGPU Warp Scheduling & SIMD Branch Divergence

🧵 GPU Warp Scheduling & SIMD Branch Divergence

See how a GPU warp of 32 threads executes an if/else branch together, using lane masking to handle divergent control flow and the serialization penalty that results.

Computer Science3DModerate60 FPS
gpu-warp-divergence-lab ↗ Open standalone

The simulation shows a warp of 32 threads hitting an if/else branch, visualizing the active lane mask during each serialized branch phase and the wasted, masked-off lane-cycles that result from divergence.

🔬 What It Demonstrates

The simulation shows a warp of 32 threads hitting an if/else branch, visualizing the active lane mask during each serialized branch phase and the wasted, masked-off lane-cycles that result from divergence.

🎮 How to Use

Adjust the fraction of threads taking each branch path and the relative cost of each branch, then step through execution to see the active mask change and the total serialized cycle count compared to a fully convergent warp.

💡 Did You Know?

A warp where just one thread out of 32 needs an expensive branch still forces all 32 lanes to wait through that entire branch, since the hardware cannot skip ahead for the other 31 idle lanes.

⚙ Under the hood

See how a GPU warp of 32 threads executes an if/else branch together, using lane masking to handle divergent control flow and the serialization penalty that results.

gpu-architecturesimdwarp-divergenceparallel-computingcudagpgpuperformance

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)