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
NvidiaMbarBackend
struct NvidiaMbarBackend[num_stages: Int]
PipelineBackend using NVIDIA mbarrier objects.
This is the default backend and reproduces the historical, hardcoded
mbarrier behavior exactly. The ring's 2 * num_stages SharedMemBarrier
objects are laid out as full[0..num_stages) followed by
empty[0..num_stages); full points at the first, empty at the second.
Parametersβ
- βnum_stages (
Int): The number of pipeline stages (ring depth) this backend instance is configured for.
Fieldsβ
- βfull (
MbarPtr): - βempty (
MbarPtr):
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable,
PipelineBackend,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
BarrierStorageβ
comptime BarrierStorage = SharedMemBarrier
Handleβ
comptime Handle = MbarPtr
Methodsβ
__init__β
def __init__[passed_num_stages: Int](ptr: Pointer[SharedMemBarrier, MutUntrackedOrigin, address_space=AddressSpace.SHARED, _safe=False]) -> Self
Construct from the base pointer of the backing barrier array.
Parameters:
- βpassed_num_stages (
Int): The number of pipeline stages (ring depth). Must matchSelf.num_stages.
Args:
- βptr (
Pointer[SharedMemBarrier, MutUntrackedOrigin, address_space=AddressSpace.SHARED, _safe=False]): Pointer to the first of2 * num_stagesbarriers.
storage_elemsβ
init_barriersβ
def init_barriers[passed_num_stages: Int](self, producer_arrive_count: Int32, consumer_arrive_count: Int32)
wait_fullβ
def wait_full[ticks: Optional[UInt32] = None](self, stage: UInt32, phase: UInt32)
wait_emptyβ
def wait_empty[ticks: Optional[UInt32] = None](self, stage: UInt32, phase: UInt32)
try_fullβ
try_emptyβ
arrive_fullβ
def arrive_full(self, stage: UInt32)
arrive_emptyβ
def arrive_empty(self, stage: UInt32)
full_handleβ
def full_handle(self, stage: UInt32) -> Self.Handle
Returns:
Self.Handle
empty_handleβ
def empty_handle(self, stage: UInt32) -> Self.Handle
Returns:
Self.Handle
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!