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
MMASmemDescriptor
struct MMASmemDescriptor
Descriptor for shared memory operands tcgen05 mma instructions.
This struct represents a descriptor that encodes information about shared memory layout and access patterns for warp group matrix multiply operations. The descriptor contains the following bit fields:
| Bit field | Size | Description |
|---|---|---|
| 0-13 | 14 | Base address in shared memory |
| 16-29 | 14 | LBO: leading dim byte offset |
| 32-45 | 14 | SBO: stride dim byte offset |
| 46-48 | 3 | Fixed constant value: 0b001 |
| 49-51 | 3 | Matrix base offset, 0 for canonical layouts |
| 52 | 1 | Leading dimension stride mode: ย ย 0: byte offset relative ย ย 1: byte address absolute (only used for 48B K tile) |
| 53-60 | 8 | Fixed constant value: 0 |
| 61-63 | 3 | Swizzle mode: ย ย 0: No swizzling ย ย 1: 128-Byte with 32B atomic swizzling ย ย 2: 128-Byte swizzling ย ย 4: 64-Byte swizzling ย ย 6: 32-Byte swizzling |
Note:
- Some bits are unused.
- Base address, LBO, and SBO ignore 4 least significant bits.
See https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#tcgen05-shared-memory-desc-layout
Fieldsโ
- โdesc (
UInt64): The 64-bit descriptor encodes shared memory operand information.
Implemented traitsโ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
MMAOperandDescriptor,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersโ
mask_14_bitsโ
comptime mask_14_bits = Int(16383)
Mask with the lower 14 bits set.
Methodsโ
__init__โ
def __init__(val: UInt64) -> Self
Initialize descriptor with raw 64-bit value.
This constructor allows creating a descriptor directly from a 64-bit integer that already contains the properly formatted bit fields for the descriptor.
The implicit attribute enables automatic conversion from UInt64 to MMASmemDescriptor.
Args:
- โval (
UInt64): A 64-bit integer containing the complete descriptor bit layout.
__add__โ
def __add__(self, offset: Int) -> Self
Add offset to descriptor's base address.
Args:
- โoffset (
Int): Byte offset to add to base address.
Returns:
Self: New descriptor with updated base address.
__iadd__โ
def __iadd__(mut self, offset: Int)
Add offset to descriptor's base address in-place.
Args:
- โoffset (
Int): Byte offset to add to base address.
createโ
static def create[stride_byte_offset: Int, leading_byte_offset: Int, swizzle_mode: TensorMapSwizzle = TensorMapSwizzle.SWIZZLE_NONE](smem_ptr: Pointer[address_space=AddressSpace.SHARED, _safe=True]) -> Self
Create a descriptor for shared memory operand.
Parameters:
- โstride_byte_offset (
Int): Stride dimension offset in bytes. - โleading_byte_offset (
Int): Leading dimension stride in bytes. - โswizzle_mode (
TensorMapSwizzle): Memory access pattern mode.
Args:
- โsmem_ptr (
Pointer[address_space=AddressSpace.SHARED, _safe=True]): Pointer to shared memory operand.
Returns:
Self: Initialized descriptor for the shared memory operand.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!