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 function

wgmma_canonical_strides

def wgmma_canonical_strides[dtype: DType, layout_t: TensorLayout, is_k_major: Bool, swizzle_mode: TensorMapSwizzle]() -> Tuple[Int, Int, Int]

Returns the canonical descriptor layout's two sub-strides, in elements.

The canonical layout an operand descriptor describes is the operand tile tiled by (8, 16 B) along K. For a K-major operand that layout follows from the tile geometry and the swizzle mode alone; for an MN-major operand it is the operand tile's own layout. wgmma_desc_sbo_lbo turns these into the WGMMA descriptor's 16 B units and applies WGMMA's majorness swap; the SM100 descriptor builders take them in elements and do their own swap.

Constraints:

An MN-major operand needs two sub-modes per mode, the nesting the descriptor reads its sub-strides from.

Parameters:

  • ​dtype (DType): Element data type of the tensor.
  • ​layout_t (TensorLayout): Type of the operand tile's layout, with mode 0 the MN extent and mode 1 the K extent.
  • ​is_k_major (Bool): Whether the operand is K-major (True) or MN-major (False).
  • ​swizzle_mode (TensorMapSwizzle): Memory access pattern swizzling mode.

Returns:

Tuple[Int, Int, Int]: The canonical mode-0 shape, its second sub-stride and the mode-1 second sub-stride.

Was this page helpful?