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_SFA_SFB
def load_AB_SFA_SFB[a_type: DType, b_type: DType, sfa_dtype: DType, sfb_dtype: DType, sfa_tma_dtype: DType, sfb_tma_dtype: 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], sfa_rank: Int, sfa_tile_shape: IndexList[sfa_rank], sfa_desc_shape: IndexList[sfa_rank], sfb_rank: Int, sfb_tile_shape: IndexList[sfb_rank], sfb_desc_shape: IndexList[sfb_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)], num_sf_k_tiles: Int, 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], sfa_tma_op: TMATensorTile[sfa_tma_dtype, sfa_rank, sfa_tile_shape, sfa_desc_shape], sfb_tma_op: TMATensorTile[sfb_tma_dtype, sfb_rank, sfb_tile_shape, sfb_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], sfa_smem_tiles: SMemTileArrayWithLayout[sfa_dtype], sfb_smem_tiles: SMemTileArrayWithLayout[sfb_dtype], 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)
Issues multicast TMA loads for A, B, and their scale factors (SFA, SFB) into a pipeline stage of shared memory.
Parameters:
- βa_type (
DType): Element dtype of the A operand matrix (inferred). - βb_type (
DType): Element dtype of the B operand matrix (inferred). - βsfa_dtype (
DType): Element dtype of the A scale factors (inferred). - βsfb_dtype (
DType): Element dtype of the B scale factors (inferred). - βsfa_tma_dtype (
DType): Element dtype used for the SFA TMA descriptor; may differ fromsfa_dtype(for exampleuint16for 4D TMA) (inferred). - βsfb_tma_dtype (
DType): Element dtype used for the SFB TMA descriptor; may differ fromsfb_dtype(for exampleuint16for 4D TMA) (inferred). - βa_rank (
Int): Tensor rank of the A operand TMA descriptor (inferred). - βa_tile_shape (
IndexList[a_rank]): Per-tile shape of the A TMA load (inferred). - βa_desc_shape (
IndexList[a_rank]): Full descriptor shape of the A TMA load (inferred). - βb_rank (
Int): Tensor rank of the B operand TMA descriptor (inferred). - βb_tile_shape (
IndexList[b_rank]): Per-tile shape of the B TMA load (inferred). - βb_desc_shape (
IndexList[b_rank]): Full descriptor shape of the B TMA load (inferred). - βsfa_rank (
Int): Tensor rank of the SFA TMA descriptor (inferred). - βsfa_tile_shape (
IndexList[sfa_rank]): Per-tile shape of the SFA TMA load (inferred). - βsfa_desc_shape (
IndexList[sfa_rank]): Full descriptor shape of the SFA TMA load (inferred). - βsfb_rank (
Int): Tensor rank of the SFB TMA descriptor (inferred). - βsfb_tile_shape (
IndexList[sfb_rank]): Per-tile shape of the SFB TMA load (inferred). - βsfb_desc_shape (
IndexList[sfb_rank]): Full descriptor shape of the SFB TMA load (inferred). - βa_dim0 (
Int): Row count of each A SMEM tile (inferred). - βa_dim1 (
Int): Column count of each A SMEM tile (inferred). - βa_num_tiles (
Int): Total number of A SMEM tiles across all pipeline stages (inferred). - βa_swizzle_bytes (
Int): Swizzle stride in bytes for the A SMEM tiles (inferred). - βb_dim0 (
Int): Row count of each B SMEM tile (inferred). - βb_dim1 (
Int): Column count of each B SMEM tile (inferred). - βb_num_tiles (
Int): Total number of B SMEM tiles across all pipeline stages (inferred). - βb_swizzle_bytes (
Int): Swizzle stride in bytes for the B SMEM tiles (inferred). - βnum_pipeline_stages (
Int): Number of producer/consumer stages in the A/B/SFA/SFB load and MMA pipeline (inferred). - βblock_tile_shape (
IndexList[Int(3)]): Block tile shape as(BM, BN, BK)in elements. - βmma_shape (
IndexList[Int(3)]): MMA atom shape as(MMA_M, MMA_N, MMA_K)in elements. - βnum_sf_k_tiles (
Int): Number of scale-factor K-tiles loaded per K-group iteration. - βcta_group (
Int): Number of CTAs cooperating per MMA group (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 tile descriptor for loading A from global memory. - βb_tma_op (
TMATensorTile[b_type, b_rank, b_tile_shape, b_desc_shape]): TMA tensor tile descriptor for loading B from global memory. - βsfa_tma_op (
TMATensorTile[sfa_tma_dtype, sfa_rank, sfa_tile_shape, sfa_desc_shape]): TMA tensor tile descriptor for loading SFA (A scale factors) from global memory. - βsfb_tma_op (
TMATensorTile[sfb_tma_dtype, sfb_rank, sfb_tile_shape, sfb_desc_shape]): TMA tensor tile descriptor for loading SFB (B scale factors) from global memory. - βa_smem_tiles (
SMemTileArray2D[a_type, a_dim0, a_dim1, a_num_tiles, a_swizzle_bytes]): SMEM tile array holding the A operand tiles. - βb_smem_tiles (
SMemTileArray2D[b_type, b_dim0, b_dim1, b_num_tiles, b_swizzle_bytes]): SMEM tile array holding the B operand tiles. - βsfa_smem_tiles (
SMemTileArrayWithLayout[sfa_dtype]): SMEM tile array holding the A scale-factor tiles. - βsfb_smem_tiles (
SMemTileArrayWithLayout[sfb_dtype]): SMEM tile array holding the B scale-factor tiles. - βload_mma_pipeline (
ProducerConsumerPipeline[num_pipeline_stages]): Producer/consumer pipeline synchronizing A/B/SFA/SFB loads with MMA consumption. - βpeer_cta_coord (
Tuple[Int, Int, Int]):(v, m, n)coordinates of this CTA within the cluster, used to compute SMEM slice offsets for multicast distribution. - βwork_tile_coord (
Tuple[Int, Int, Int]):(M, N, batch)coordinates of the output tile being computed. - βa_multicast_mask (
UInt16): Multicast bitmask selecting which CTAs receive the A TMA load. - βb_multicast_mask (
UInt16): Multicast bitmask selecting which CTAs receive the B TMA load. - βiter_idx (
UInt32): Current K-iteration index within the tile loop, in units of individual K-tiles. - βelect_one_cta (
Bool): Whether this CTA is elected as the leader for mbarrier byte-count programming.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!