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
run_producer
def run_producer[dtype: DType, layout: Layout, block_rows: Int, block_cols: Int, warp_rows: Int, warp_cols: Int, producer_warps: Int, pipeline_stages: Int, k_tile_size: Int, simd_width: Int, warps_processed_per_producer: Int, tile_count: Int, swizzle: Optional[Swizzle]](matrix: LayoutTensor[dtype, layout, MutAnyOrigin, address_space=AddressSpace.GLOBAL], mut ring_buffer: RingBuffer, warp_id: Int, block_idx_dim: Int)
Generic producer function for loading matrix tiles from global to shared memory.
Parameters:
- βdtype (
DType): Element type of the matrix being loaded. - βlayout (
Layout): Memory layout of the matrix in global memory. - βblock_rows (
Int): Number of rows in a block tile (BMfor matrix A,BNfor matrix B). - βblock_cols (
Int): Number of columns in a block tile (BK). - βwarp_rows (
Int): Number of rows per warp tile (WMfor matrix A,WNfor matrix B). - βwarp_cols (
Int): Number of columns per warp tile (WK). - βproducer_warps (
Int): Number of warps assigned to producing this matrix. - βpipeline_stages (
Int): Number of pipeline stages in the ring buffer used to overlap loads and compute. - βk_tile_size (
Int): Width of a single K tile loaded per inner-block row. - βsimd_width (
Int): SIMD vector width of the matrix element type. - βwarps_processed_per_producer (
Int): Number of warp tiles each producer warp iterates over. - βtile_count (
Int): Total number of K tiles to load along the K dimension. - βswizzle (
Optional[Swizzle]): Optional swizzle pattern applied to shared memory to avoid bank conflicts.
Args:
- βmatrix (
LayoutTensor[dtype, layout, MutAnyOrigin, address_space=AddressSpace.GLOBAL]): Global memory tensor of the matrix to load tiles from. - βring_buffer (
RingBuffer): Ring buffer coordinating producer-consumer synchronization across pipeline stages. - βwarp_id (
Int): Warp identifier of this producer warp within its producer group. - βblock_idx_dim (
Int): Block index along the matrix's leading dimension, selecting which block of tiles this block loads.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!