For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo struct
ConsumeContext
struct ConsumeContext[pipeline_origin: MutOrigin, num_stages: Int, Backend: PipelineBackend = NvidiaMbarBackend[num_stages]]
Context manager for consuming one pipeline stage.
- enter: Waits for producer to be ready, returns ref to stage
- exit: Releases the stage (signals consumption + advances)
Parametersβ
- βpipeline_origin (
MutOrigin): Origin of the pipeline reference. - βnum_stages (
Int): Number of pipeline stages. - βBackend (
PipelineBackend): Pipeline synchronization backend (defaults toNvidiaMbarBackend).
Fieldsβ
- βpipeline (
Pointer[ProducerConsumerPipeline[num_stages, Backend], pipeline_origin, _safe=True]):
Implemented traitsβ
Methodsβ
__init__β
def __init__(out self, pipeline: Pointer[ProducerConsumerPipeline[num_stages, Backend], pipeline_origin, _safe=True])
__del__β
def __del__(deinit self)
__enter__β
def __enter__(mut self) -> ref[self._stage._value] ConsumerStage[pipeline_origin, num_stages, Backend]
Wait for producer and return reference to stage.
Returns:
ref[self._stage._value] ConsumerStage[pipeline_origin, num_stages, Backend]
__exit__β
def __exit__(mut self)
Release the stage (signals consumption + advances).
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!