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_swizzle

def block_swizzle(block_idx: IndexList[Int(2), element_type=block_idx.element_type], grid_dim: IndexList[Int(2), element_type=block_idx.element_type]) -> IndexList[Int(2), element_type=block_idx.element_type]

Remaps a linear block index into a swizzled two-dimensional block coordinate.

Applies CUTLASS-style block swizzling along the N dimension to improve L2 cache locality for tall-and-narrow matmul grids.

Args:

Returns:

IndexList[Int(2), element_type=block_idx.element_type]: The swizzled two-dimensional block coordinate.