IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo struct

ProducerTiles

struct ProducerTiles[origin: MutOrigin, Payload: TilePayload, num_group_stages: Int, k_group_size: Int]

Context manager for producing one input pipeline stage.

Provides the same accessor interface as InputProducerStage (payload, stage, barrier, expect_bytes) but automatically releases the producer on scope exit.

Usage: with producer.acquire() as tiles: tiles.expect_bytes(num_bytes) load_tiles(tiles.payload(), tiles.stage(), tiles.barrier()) # release called automatically

Parameters​

  • ​origin (MutOrigin): Origin of the pipeline reference.
  • ​Payload (TilePayload): The tile payload type.
  • ​num_group_stages (Int): Number of synchronization stages.
  • ​k_group_size (Int): Number of tiles per synchronization stage.

Fields​

  • ​pipeline_ptr (Pointer[InputTilePipeline[Payload, num_group_stages, k_group_size], origin]):

Implemented traits​

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable, RegisterPassable, TrivialRegisterPassable

comptime members​

PipelineType​

comptime PipelineType = InputTilePipeline[Payload, num_group_stages, k_group_size]

Methods​

__init__​

def __init__(pipeline_ptr: Pointer[InputTilePipeline[Payload, num_group_stages, k_group_size], origin], stage: UInt32, barrier: UnsafePointer[SharedMemBarrier, MutUntrackedOrigin, address_space=AddressSpace.SHARED]) -> Self

payload​

def payload(self) -> Payload

Get the tile payload for direct access.

Returns:

Payload

stage​

def stage(self) -> UInt32

Get the current stage index.

Returns:

UInt32

expect_bytes​

def expect_bytes(self, num_bytes: Int)

Set expected bytes on the barrier for TMA loads.

barrier​

def barrier(self) -> MbarPtr

Get the barrier pointer for TMA multicast loads.

Returns:

MbarPtr

__enter__​

def __enter__(self) -> Self

__exit__​

def __exit__(self)

Release the producer (advances to next stage).