Mojo struct
ExplicitConsumeContext
@register_passable(trivial)
struct ExplicitConsumeContext[pipeline_origin: MutOrigin, num_stages: Int]
Context for consuming one pipeline stage with EXPLICIT arrive.
Use this when you need lane-guarded or specialized barrier signaling.
- enter: Waits for producer to be ready, returns stage info 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,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable
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
Methods
__init__
__init__(pipeline: Pointer[ProducerConsumerPipeline[num_stages], pipeline_origin]) -> Self
__enter__
__enter__(self) -> ConsumerStage
Wait for producer and return stage info with barrier access.
Returns:
ConsumerStage
__exit__
__exit__(self)
Advance to next stage WITHOUT signaling barrier.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!