Skip to main content

Mojo struct

InputConsumerStage

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

Linear type handle for consumer tile access.

Compiler-enforced: must call release() to signal consumption and advance the consumer stage.

Usage (linear): var tiles = pipeline.acquire_consumer() process_tiles(tiles.payload(), tiles.stage()) tiles^.release() # Compiler enforces this call

For scoped/automatic usage, use ConsumerTiles via consumer.acquire() instead.

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, Movable

comptime members

PipelineType

comptime PipelineType = InputTilePipeline[Payload, num_group_stages, k_group_size]

Methods

__init__

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

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

release

release(deinit self)

Signal consumption and advance to next stage.

This is the only way to destroy this linear type. The compiler will error if you don't call this.

Was this page helpful?