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

find_K_alignment_upto_16B

def find_K_alignment_upto_16B(row_bytes_arg: Int) -> Int

Find alignment among 1B, 2B, 4B, 16B based on the row's bytes.

This function determines the largest power-of-2 alignment (up to 16 bytes) that evenly divides the given row size. This is used to determine the optimal vector size for cp.async operations when K dimension alignment doesn't meet TMA requirements.

Args:

  • row_bytes_arg (Int): Number of bytes in a row (K * sizeof(element)).

Returns:

Int: Alignment in bytes (1, 2, 4, 8, or 16).