Skip to main content

Mojo struct

InputProducer

@register_passable(trivial) struct InputProducer[origin: MutOrigin, Payload: TilePayload, num_group_stages: Int, k_group_size: Int]

Producer view for TMA Load warp. Use acquire() to get stages.

Fields

  • pipeline_ptr (Pointer[InputProducer[origin, Payload, num_group_stages, k_group_size].PipelineType, origin]):

Implemented traits

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

comptime members

__copyinit__is_trivial

comptime __copyinit__is_trivial = True

__del__is_trivial

comptime __del__is_trivial = True

__moveinit__is_trivial

comptime __moveinit__is_trivial = True

PipelineType

comptime PipelineType = InputTilePipeline[Payload, num_group_stages, k_group_size]

Methods

__enter__

__enter__(mut self) -> Self

__exit__

__exit__(mut self)

drain

drain(mut self)

Drain pipeline to prevent CTA exit while peer is still working.

acquire

acquire(mut self) -> InputProducerStage[origin, Payload, num_group_stages, k_group_size]

Acquire next stage, waiting for slot availability.

Returns a context manager for loading tiles.

Returns:

InputProducerStage

try_acquire

try_acquire(mut self) -> Bool

Non-blocking check if next producer stage is available.

Use with acquire_if_needed() for the try-acquire pattern:

var ready = producer.try_acquire()
# ... do other work ...
with producer.acquire_if_needed(ready) as tiles:
    load_tiles()

Returns:

Bool: True if the stage is ready, False if waiting is needed.

acquire_if_needed

acquire_if_needed(mut self, already_ready: Bool) -> InputProducerStage[origin, Payload, num_group_stages, k_group_size]

Acquire stage, only waiting if not already ready.

Args:

  • already_ready (Bool): Result from try_acquire(). Skips wait if True.

Returns:

InputProducerStage: The producer stage for loading tiles.

Was this page helpful?