Skip to main content
Apple Metal groups 32 threads into a SIMD group (also called a warp). SIMD group operations communicate data across all 32 lanes without going through memory or barriers.

When to use SIMD group ops

  • Parallel reductions within a threadgroup (sum, min, max)
  • Prefix scan algorithms
  • Exchanging values between lanes without shared memory
All SIMD group ops are valid inside @enigma.kernel bodies.

Reductions

Each reduction takes one value per lane and returns the same result to all 32 lanes.

Example: sum reduction

Prefix scans

Prefix scans return partial results: lane i gets the reduction of lanes [0, i) (exclusive) or [0, i] (inclusive).

Example: exclusive prefix sum

Shuffle operations

Shuffle operations exchange values between specific lanes at hardware speed.

Example: butterfly reduction using shuffle_xor


Quad group operations

Quad groups are 4-thread subgroups within a SIMD group. They provide the same operations at finer granularity.

When to prefer quad ops

Quad ops are useful in texture-domain compute (2×2 pixel quads) and when you need sub-SIMD-group granularity in reduction trees.