For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
load_AB
def load_AB[a_type: DType, b_type: DType, a_rank: Int, a_tile_shape: IndexList[a_rank], a_desc_shape: IndexList[a_rank], b_rank: Int, b_tile_shape: IndexList[b_rank], b_desc_shape: IndexList[b_rank], a_dim0: Int, a_dim1: Int, a_num_tiles: Int, a_swizzle_bytes: Int, b_dim0: Int, b_dim1: Int, b_num_tiles: Int, b_swizzle_bytes: Int, num_pipeline_stages: Int, /, *, block_tile_shape: IndexList[Int(3)], mma_shape: IndexList[Int(3)], cta_group: Int = Int(1), k_group_size: Int = Int(1)](a_tma_op: TMATensorTile[a_type, a_rank, a_tile_shape, a_desc_shape], b_tma_op: TMATensorTile[b_type, b_rank, b_tile_shape, b_desc_shape], a_smem_tiles: SMemTileArray2D[a_type, a_dim0, a_dim1, a_num_tiles, a_swizzle_bytes], b_smem_tiles: SMemTileArray2D[b_type, b_dim0, b_dim1, b_num_tiles, b_swizzle_bytes], load_mma_pipeline: ProducerConsumerPipeline[num_pipeline_stages], peer_cta_coord: Tuple[Int, Int, Int], work_tile_coord: Tuple[Int, Int, Int], a_multicast_mask: UInt16, b_multicast_mask: UInt16, iter_idx: UInt32, elect_one_cta: Bool)
TMA producer phase that loads A and B tiles from GMEM into SMEM via multicast.
Parameters:
- βa_type (
DType): DType of the A operand elements. - βb_type (
DType): DType of the B operand elements. - βa_rank (
Int): Number of dimensions in the A TMA tensor map. - βa_tile_shape (
IndexList[a_rank]): Shape of each A tile loaded by TMA, in elements. - βa_desc_shape (
IndexList[a_rank]): Shape of the A TMA descriptor, in elements. - βb_rank (
Int): Number of dimensions in the B TMA tensor map. - βb_tile_shape (
IndexList[b_rank]): Shape of each B tile loaded by TMA, in elements. - βb_desc_shape (
IndexList[b_rank]): Shape of the B TMA descriptor, in elements. - βa_dim0 (
Int): Row extent of each A SMEM tile, in elements. - βa_dim1 (
Int): Column extent of each A SMEM tile, in elements. - βa_num_tiles (
Int): Number of A SMEM tiles in the pipeline buffer. - βa_swizzle_bytes (
Int): SMEM swizzle granularity for A tiles, in bytes. - βb_dim0 (
Int): Row extent of each B SMEM tile, in elements. - βb_dim1 (
Int): Column extent of each B SMEM tile, in elements. - βb_num_tiles (
Int): Number of B SMEM tiles in the pipeline buffer. - βb_swizzle_bytes (
Int): SMEM swizzle granularity for B tiles, in bytes. - βnum_pipeline_stages (
Int): Number of stages in the load-to-MMA pipeline. - βblock_tile_shape (
IndexList[Int(3)]): Block tile shape as (BM, BN, BK). - βmma_shape (
IndexList[Int(3)]): MMA instruction shape as (MMA_M, MMA_N, MMA_K). - βcta_group (
Int): Number of cooperating CTAs per multicast load (defaults to 1). - βk_group_size (
Int): Number of K tiles loaded per pipeline stage (defaults to 1).
Args:
- βa_tma_op (
TMATensorTile[a_type, a_rank, a_tile_shape, a_desc_shape]): TMA tensor map descriptor for the A operand. - βb_tma_op (
TMATensorTile[b_type, b_rank, b_tile_shape, b_desc_shape]): TMA tensor map descriptor for the B operand. - βa_smem_tiles (
SMemTileArray2D[a_type, a_dim0, a_dim1, a_num_tiles, a_swizzle_bytes]): Pipeline buffer of A SMEM tiles. - βb_smem_tiles (
SMemTileArray2D[b_type, b_dim0, b_dim1, b_num_tiles, b_swizzle_bytes]): Pipeline buffer of B SMEM tiles. - βload_mma_pipeline (
ProducerConsumerPipeline[num_pipeline_stages]): Producer/consumer pipeline between TMA load and MMA stages. - βpeer_cta_coord (
Tuple[Int, Int, Int]): Coordinate of the peer CTA within the cluster, used to offset GMEM read and SMEM write addresses. - βwork_tile_coord (
Tuple[Int, Int, Int]): (M, N, batch) tile coordinate assigned to this CTA by the tile scheduler. - βa_multicast_mask (
UInt16): Multicast mask selecting CTAs that receive the A tile. - βb_multicast_mask (
UInt16): Multicast mask selecting CTAs that receive the B tile. - βiter_idx (
UInt32): Current K iteration index for this pipeline stage. - βelect_one_cta (
Bool): Whether this CTA sets up the TMA barrier byte expectation.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!