IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

lane_group_max

def lane_group_max[val_type: DType, simd_width: SIMDLength, //, num_lanes: Int, stride: Int = Int(1)](val: SIMD[val_type, simd_width]) -> SIMD[val_type, simd_width]

Reduces a SIMD value to its maximum within a lane group and broadcasts to all lanes.

This function performs a parallel reduction across a group of lanes to find the maximum value. The result is broadcast to all participating lanes using optimized hardware-specific paths (AMD DPP, Blackwell redux, or butterfly shuffle pattern).

Parameters:

  • val_type (DType): The data type of the SIMD elements (e.g. float32, int32).
  • simd_width (SIMDLength): The number of elements in the SIMD vector.
  • num_lanes (Int): The number of threads participating in the reduction.
  • stride (Int): The stride between lanes participating in the reduction.

Args:

Returns:

SIMD[val_type, simd_width]: A SIMD value where all participating lanes contain the maximum value found across the lane group. Non-participating lanes (lane_id >= num_lanes) retain their original values.

Was this page helpful?