For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo struct
ConsumerStage
struct ConsumerStage[pipeline_origin: MutOrigin, num_stages: Int, Backend: PipelineBackend = NvidiaMbarBackend[num_stages]]
Unified handle for consuming from a pipeline stage.
Works as both a linear type (direct use) and within context managers.
Lifecycle:
- Created via
pipeline.acquire_consumer()or context manager - Use
index()for consumption - Must call
release()to signal and advance (compiler-enforced)
Two exit paths:
release(): Signal consumption complete + advance (normal path)release_without_signal(): Advance only (for explicit signaling)
Parametersβ
- βpipeline_origin (
MutOrigin): Origin of the pipeline reference. - βnum_stages (
Int): Number of pipeline stages. - βBackend (
PipelineBackend): The synchronization backend (seeProducerConsumerPipeline).
Fieldsβ
- βpipeline (
Pointer[ProducerConsumerPipeline[num_stages, Backend], pipeline_origin]):
Implemented traitsβ
Methodsβ
__init__β
def __init__(out self, pipeline: Pointer[ProducerConsumerPipeline[num_stages, Backend], pipeline_origin], index: UInt32)
indexβ
mbarβ
def mbar(self) -> Backend.Handle
Get the barrier for manual signaling.
Use this for specialized signaling patterns like umma_arrive_leader_cta. For standard usage, just call release().
Returns:
Backend.Handle
arriveβ
def arrive(self)
Manually arrive on the consumer barrier.
Use for lane-guarded patterns: if lane_id() < CLUSTER_SIZE: stage.arrive() stage^.release_without_signal()
releaseβ
def release(deinit self)
Signal consumption complete and advance to next stage.
This is the standard exit path. Equivalent to: arrive() consumer_step()
release_without_signalβ
def release_without_signal(deinit self)
Advance to next stage WITHOUT signaling.
Use when you've already signaled via arrive() or specialized APIs.