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

copy_accum_to_gmem

def copy_accum_to_gmem[c_type: DType, c_tile_rank: Int, c_tile_shape: IndexList[c_tile_rank], c_desc_shape: IndexList[c_tile_rank], num_accum_pipeline_stages: Int, c_tensor_layout: Layout, /, *, c_smem_layout: Layout, repeat: Int, accum_type: DType, cta_group: Int, epilogue_dtype: DType, block_tile_shape: IndexList[Int(3)], mma_shape: IndexList[Int(3)], num_output_warps: Int, c_swizzle: TensorMapSwizzle = TensorMapSwizzle.SWIZZLE_128B, elementwise_compute_lambda_fn: Optional[def[dtype: DType, width: SIMDLength, *, alignment: Int = Int(1)](IndexList[Int(2)], SIMD[dtype, width]) capturing thin -> SIMD[dtype, width]] = None, register_based_epilogue: Bool = True, transpose_c: Bool = False, scale_c_coord: Bool = True](c_smem_base: Pointer[Scalar[c_type], MutAnyOrigin, address_space=AddressSpace.SHARED], c_tma_op: TMATensorTile[c_type, c_tile_rank, c_tile_shape, c_desc_shape], c: LayoutTensor[c_type, c_tensor_layout, MutAnyOrigin], mma_output_pipeline: ProducerConsumerPipeline[num_accum_pipeline_stages], mma_output_stage: UInt32, tmem_offset: UInt32, c_coord: Tuple[UInt32, UInt32], c_shape: Tuple[UInt32, UInt32], expert_scale: Float32, group_end_idx: UInt32)

Copies one accumulator stage from TMEM to global memory via shared memory.

Loads the MMA result from tensor memory, applies the per-expert scale and an optional elementwise epilogue, packs the result through stmatrix into shared memory, and stores it to global memory with TMA (or a CUDA-core fallback for unaligned tails). Handles both the transposed (transpose_c) and non-transposed output layouts.

Parameters:

Args: