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

tc_reduce

def tc_reduce[in_type: DType, simd_width: Int, //, out_type: DType](val: SIMD[in_type, simd_width]) -> Scalar[out_type]

Performs tensor core based reduction on a SIMD vector.

Note: Dispatches to either scalar or vector reduction implementation based on SIMD width. Supports various input/output type combinations using tensor core operations.

Parameters:

  • ​in_type (DType): The input data type of the SIMD vector elements.
  • ​simd_width (Int): The width of the SIMD vector.
  • ​out_type (DType): The output data type for the reduced result.

Args:

Returns:

Scalar[out_type]: Scalar containing the reduced result.