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

load_b_nt

def load_b_nt[mma_shape: IndexList[Int(3)], swizzle: Optional[Swizzle] = Optional()](tile: LayoutTensor[address_space=AddressSpace.SHARED, element_layout=tile.element_layout, layout_int_type=tile.layout_int_type, linear_idx_type=tile.linear_idx_type, masked=tile.masked, alignment=tile.alignment]) -> SIMD[tile.dtype, SIMDLength(8)]

Loads the b operand tile for AMD tensor core MFMA from (N, K) storage.

This function supports double-rate MFMA shapes (32x32x16, 16x16x32) with bfloat16 input. Unlike load_b_tr which expects (K, N) storage, this function works with (N, K) storage which is common when transpose_b=True and B is stored row-major.

The input tile (shape = (mma_shape[1], mma_shape[2])) is split along the K dimension into two halves of shape (MMA_N, MMA_K//2). Each half is loaded using _load_tr16_b64_warp, which performs a transposed (column-major) load from shared memory. The hardware transpose effectively converts the (N, K) storage to (K, N) format needed by MMA.

Example: For 16x16x32 MMA with B stored as (N, K) = (16, 32) in LDS:

# B tile in LDS: shape (16, 32) = (MMA_N, MMA_K)
var b_tile = smem_b.tile[16, 32](n_idx, k_idx)
var b_reg = load_b_nt[IndexList[3](16, 16, 32)](b_tile)
# b_reg now contains 8 bf16 values ready for MFMA

Parameters:

  • โ€‹mma_shape (IndexList[Int(3)]): The MMA instruction tile shape (only 32x32x16 or 16x16x32 supported).
  • โ€‹swizzle (Optional[Swizzle]): Optional swizzle pattern for bank-conflict-free LDS access.

Args:

Returns:

SIMD[tile.dtype, SIMDLength(8)]: SIMD[tile.dtype, 8]: Concatenated transposed SIMD loads from both halves of the tile.

Was this page helpful?