Skip to main content

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, Equatable, Hashable, ImplicitlyCopyable, ImplicitlyDestructible, Intable, Movable, RegisterPassable, TrivialRegisterPassable, Writable

comptime members

SWIZZLE_128B

comptime SWIZZLE_128B = TensorMapSwizzle(SIMD(3))

128-byte swizzle pattern.

SWIZZLE_32B

comptime SWIZZLE_32B = TensorMapSwizzle(SIMD(1))

32-byte swizzle pattern.

SWIZZLE_64B

comptime SWIZZLE_64B = TensorMapSwizzle(SIMD(2))

64-byte swizzle pattern.

SWIZZLE_NONE

comptime SWIZZLE_NONE = TensorMapSwizzle(SIMD(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).

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?