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
WGMMADescriptor
struct WGMMADescriptor[dtype: DType]
Descriptor for shared memory operands used in warp group matrix multiply operations.
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 |
| 49-51 | 3 | Matrix base offset, 0 for canonical layouts |
| 62-63 | 2 | Swizzle mode: Β Β 0: no swizzle, Β Β 1: 128B swizzle, Β Β 2: 64B swizzle, Β Β 3: 32B swizzle |
Note:
- Some bits are unused.
- Base address, LBO, and SBO ignore 4 least significant bits.
Parametersβ
- βdtype (
DType): The data type of the shared memory operand. This affects memory alignment and access patterns for the descriptor.
Fieldsβ
-
βdesc (
Int64): The 64-bit descriptor value that encodes shared memory layout information. This field stores the complete descriptor with all bit fields packed into a single 64-bit integer:- Bits 0-13: Base address in shared memory (14 bits)
- Bits 16-29: Leading dimension stride in bytes (14 bits)
- Bits 32-45: Stride dimension offset in bytes (14 bits)
- Bits 49-51: Base offset (3 bits)
- Bits 62-63: Swizzle mode for memory access pattern (2 bits)
The descriptor is used by NVIDIA Hopper architecture's warp group matrix multiply instructions to efficiently access shared memory with the appropriate layout and access patterns.
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
MMAOperandDescriptor,
Movable,
RegisterPassable,
TrivialRegisterPassable
Methodsβ
__init__β
def __init__(val: Int64) -> 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 Int64 to WGMMADescriptor.
Args:
- βval (
Int64): 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[Scalar[dtype], 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[Scalar[dtype], 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!