Skip to main content
Log in

Mojo function

make_swizzle

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:

A Swizzle object for 2D memory access.

make_swizzle[type: 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:

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

Returns:

A Swizzle object configured by the specified mode.