Skip to main content

Mojo struct

ProduceContext

@register_passable(trivial) struct ProduceContext[pipeline_origin: MutOrigin, num_stages: Int]

Context for producing one pipeline stage.

  • enter: Waits for consumer to be ready, returns stage info
  • exit: Advances producer to next stage

Note: The actual production signal (mma_arrive) is kernel-specific and must be called by the user before exiting the context.

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) -> ProducerStage

Wait for consumer and return stage info.

Returns:

ProducerStage

__exit__

__exit__(self)

Advance producer to next stage.

Was this page helpful?