IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo function

block_reduce_sum_and_max

def block_reduce_sum_and_max[dtype: DType, max_warps_per_block: Int](sum_val: Scalar[dtype], max_val: Scalar[dtype]) -> Tuple[Scalar[dtype], Scalar[dtype]]

Combined block reduction for sum and max in a single barrier pass.

Performs both sum and max reductions across the block using only 2 barriers (vs 4 for separate block.sum + block.max with broadcast).

Returns:

Tuple[Scalar[dtype], Scalar[dtype]]