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

get_matmul_num_tasks

def get_matmul_num_tasks[a_type: DType, b_type: DType, c_type: DType, simd_size: Int, kernel_type: Bool](m: Int, n: Int, k: Int, max_num_tasks: Int) -> Int

Compute the number of tasks for parallel matmul. The max number of tasks is the thread or core count.

Parameters:

  • ​a_type (DType): The dtype of the A tensor.
  • ​b_type (DType): The dtype of the B tensor.
  • ​c_type (DType): The dtype of the C tensor.
  • ​simd_size (Int): The SIMD vector width for the target and dtype.
  • ​kernel_type (Bool): Selects between the two tuned shapes for the target.

Args:

  • ​m (Int): The M dimension of the matmul.
  • ​n (Int): The N dimension of the matmul.
  • ​k (Int): The K dimension of the matmul.
  • ​max_num_tasks (Int): Upper bound on task count (thread or core count).

Returns:

Int