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, ImplicitlyDeletable

comptime members​

Array​

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

Methods​

barriers​

def barriers(ref[AddressSpace._value] self) -> Self.Array

Get barrier array accessor.

Returns:

Self.Array

ptr​

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

Get raw barrier pointer for initialization or custom usage.

Returns:

MbarPtr

create_pipeline​

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

Create a runtime pipeline from this barrier storage.

Returns:

ProducerConsumerPipeline[num_stages]