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 struct

TensorMapSwizzle

struct TensorMapSwizzle

Swizzle mode for TMA tensor map descriptors.

Swizzling permutes memory addresses to reduce shared memory bank conflicts on NVIDIA GPUs. Different swizzle modes apply XOR-based address transformations with different granularities (32B, 64B, or 128B).

Implemented traits

AnyType, Copyable, Deinitable, Equatable, Hashable, ImplicitlyCopyable, Intable, Movable, RegisterPassable, TrivialRegisterPassable, Writable

comptime members

SWIZZLE_128B

comptime SWIZZLE_128B = TensorMapSwizzle(Int32(3))

128-byte swizzle pattern.

SWIZZLE_32B

comptime SWIZZLE_32B = TensorMapSwizzle(Int32(1))

32-byte swizzle pattern.

SWIZZLE_64B

comptime SWIZZLE_64B = TensorMapSwizzle(Int32(2))

64-byte swizzle pattern.

SWIZZLE_NONE

comptime SWIZZLE_NONE = TensorMapSwizzle(Int32(0))

No swizzling applied.

Methods

__eq__

def __eq__(self, other: Self) -> Bool

Checks if two swizzle modes are equal.

Args:

  • other (Self): The swizzle mode to compare with.

Returns:

Bool: True if the swizzle modes are equal, False otherwise.

__ne__

def __ne__(self, other: Self) -> Bool

Checks if two swizzle modes are not equal.

Args:

  • other (Self): The swizzle mode to compare with.

Returns:

Bool: True if the swizzle modes are not equal, False otherwise.

__int__

def __int__(self) -> Int

Converts the swizzle mode to an integer value.

Returns:

Int: The integer representation of the swizzle mode.

bytes

def bytes(self) -> Int

Gets the swizzle size in bytes.

Returns:

Int: The swizzle size in bytes (0, 32, 64, or 128).

write_to

def write_to(self, mut writer: T)

Writes the swizzle mode to a writer.

Args:

  • writer (T): The writer to write to.