Skip to main content

Mojo struct

ConsumerTiles

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

Context manager for consuming one input pipeline stage.

Provides the same accessor interface as InputConsumerStage (payload, stage, mbar) but automatically releases the consumer on scope exit.

Usage: with consumer.acquire() as tiles: process_tiles(tiles.payload(), tiles.stage()) # 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, ImplicitlyDestructible, Movable, RegisterPassable, TrivialRegisterPassable

comptime members​

PipelineType​

comptime PipelineType = InputTilePipeline[Payload, num_group_stages, k_group_size]

Methods​

__init__​

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

payload​

payload(self) -> Payload

Get the tile payload for direct access.

Returns:

Payload

stage​

stage(self) -> UInt32

Get the current stage index.

Returns:

UInt32

mbar​

mbar(self) -> MbarPtr

Get the barrier pointer.

Returns:

MbarPtr

__enter__​

__enter__(self) -> Self

__exit__​

__exit__(self)

Release the consumer (signals and advances to next stage).