Skip to main content

Mojo struct

ExplicitConsumeContext

struct ExplicitConsumeContext[pipeline_origin: MutOrigin, num_stages: Int]

Context manager for consuming with EXPLICIT barrier arrive.

Use this when you need lane-guarded or specialized barrier signaling.

  • enter: Waits for producer to be ready, returns ref to stage with mbar
  • exit: Only advances stage counter, does NOT arrive on barrier

The caller is responsible for calling arrive via stage.arrive() or stage.mbar(): with pipeline.consume_explicit() as stage: # ... do work ... if lane_id() < CLUSTER_SIZE: stage.arrive() # exit only calls consumer_step(), not arrive()

Fields

  • pipeline (Pointer[ProducerConsumerPipeline[num_stages], pipeline_origin]):

Implemented traits

AnyType, ImplicitlyDestructible

comptime members

__del__is_trivial

comptime __del__is_trivial = _all_trivial_del[_NoneType, ConsumerStage[pipeline_origin, num_stages]]()

Methods

__init__

__init__(out self, pipeline: Pointer[ProducerConsumerPipeline[num_stages], pipeline_origin])

__enter__

__enter__(mut self) -> ref[origin_of(*[0,0]._stage._value)] ConsumerStage[pipeline_origin, num_stages]

Wait for producer and return reference to stage with barrier access.

Returns:

ref

__exit__

__exit__(mut self)

Advance to next stage WITHOUT signaling barrier.

Was this page helpful?