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

make_swizzle

def make_swizzle[num_rows: Int, row_size: Int, access_size: Int]() -> Swizzle

Create a 2D swizzle to avoid bank conflicts.

Generates a swizzle pattern for 2D memory layout to minimize bank conflicts in shared memory access.

Parameters:

  • ​num_rows (Int): Number of rows in the minimum access pattern.
  • ​row_size (Int): Size of each row in elements.
  • ​access_size (Int): Number of elements accessed at once.

Returns:

Swizzle: A Swizzle object for 2D memory access.

def make_swizzle[dtype: DType, mode: TensorMapSwizzle]() -> Swizzle

Create swizzle based on predefined swizzle modes.

Returns a swizzle pattern based on standard modes (32B, 64B, 128B, none), adjusted for data type.

Parameters:

  • ​dtype (DType): The data type of the elements.
  • ​mode (TensorMapSwizzle): The swizzle mode to use (TensorMapSwizzle enum).

Returns:

Swizzle: A Swizzle object configured by the specified mode.

Was this page helpful?