IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

BarrierPair

struct BarrierPair[num_stages: Int]

Storage for a producer-consumer barrier pair (full + empty).

Each stage has two barriers:

  • full[i]: Producer signals when stage i is filled
  • empty[i]: Consumer signals when stage i is consumed

Parameters​

  • ​num_stages (Int): Number of pipeline stages (ring buffer depth).

Fields​

  • ​storage (BarrierPair[num_stages].Array.Storage):

Implemented traits​

AnyType, ImplicitlyDestructible

comptime members​

Array​

comptime Array = SMemArray[SharedMemBarrier, (num_stages * 2)]

Methods​

barriers​

barriers(ref[AddressSpace._value] self) -> BarrierPair[num_stages].Array

Get barrier array accessor.

Returns:

BarrierPair[num_stages].Array

ptr​

ptr(ref[AddressSpace._value] self) -> MbarPtr

Get raw barrier pointer for initialization or custom usage.

Returns:

MbarPtr

create_pipeline​

create_pipeline(ref[AddressSpace._value] self) -> ProducerConsumerPipeline[num_stages]

Create a runtime pipeline from this barrier storage.

Returns:

ProducerConsumerPipeline[num_stages]