Skip to main content

Mojo struct

TensorMapSwizzle

@register_passable(trivial) 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, EqualityComparable, ImplicitlyCopyable, Intable, Movable, Stringable, UnknownDestructibility, Writable

Aliases

__copyinit__is_trivial

alias __copyinit__is_trivial = True

__del__is_trivial

alias __del__is_trivial = True

__moveinit__is_trivial

alias __moveinit__is_trivial = True

SWIZZLE_128B

alias SWIZZLE_128B = TensorMapSwizzle(3)

128-byte swizzle pattern.

SWIZZLE_32B

alias SWIZZLE_32B = TensorMapSwizzle(1)

32-byte swizzle pattern.

SWIZZLE_64B

alias SWIZZLE_64B = TensorMapSwizzle(2)

64-byte swizzle pattern.

SWIZZLE_NONE

alias SWIZZLE_NONE = TensorMapSwizzle(0)

No swizzling applied.

Methods

__eq__

__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__

__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__

__int__(self) -> Int

Converts the swizzle mode to an integer value.

Returns:

Int: The integer representation of the swizzle mode.

bytes

bytes(self) -> Int

Gets the swizzle size in bytes.

Returns:

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

__str__

__str__(self) -> String

Converts the swizzle mode to a string representation.

Returns:

String: A string describing the swizzle mode.

write_to

write_to(self, mut writer: T)

Writes the swizzle mode to a writer.

Args:

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

Was this page helpful?