Skip to main content

Mojo struct

ConsumerTiles

@register_passable(trivial) 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[ConsumerTiles[origin, Payload, num_group_stages, k_group_size].PipelineType, origin]):

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, TrivialRegisterPassable

comptime members

__copy_ctor_is_trivial

comptime __copy_ctor_is_trivial = True

__del__is_trivial

comptime __del__is_trivial = True

__move_ctor_is_trivial

comptime __move_ctor_is_trivial = True

PipelineType

comptime PipelineType = InputTilePipeline[Payload, num_group_stages, k_group_size]

Methods

__init__

__init__(pipeline_ptr: Pointer[ConsumerTiles[origin, Payload, num_group_stages, k_group_size].PipelineType, origin], stage: UInt32, mbar: LegacyUnsafePointer[SharedMemBarrier, 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).

Was this page helpful?