vllm.models.muse_spark.nvidia.specialized_decode.cutedsl.common.mailbox
¶
Lamport mailboxes in symmetric memory.
A mailbox is [LAMPORT_GENERATIONS, tp, capacity, width] BF16 on every rank
of a TP group, mapped for NVLink multicast. A publisher multicasts its
[m, width] rows into slot [stage, rank] of every rank's copy; readers
poll their own copy in 16-byte fragments until no fragment holds BF16 negative
zero (the sentinel; publishers store -0.0 as +0.0), then re-arm what they read.
A publisher can also store rows into one rank's copy alone through peers
(the TP tail's route rows); poll_at reads slots at any fixed offsets.
Every spin is bounded: a poll that sees no data for SPIN_TIMEOUT_NS traps,
so a rank that diverges fails the launch instead of hanging the group.
Classes:
-
LamportMailbox–One TP group's
[3, tp, capacity, width]BF16 mailbox and stage state.
Functions:
-
compile_shared_only_publish–Compile the publisher that multicasts a local
[m, hidden]BF16 tensor -
fetch–Load fragment
iintovalues[i]; returns its dirty flag at biti. -
poll–countfragments at base + i * stride (elements,strideat run -
poll_at–The fragments at base + offsets[i] (elements, compile-time), polled as
-
poll_owned_fragment–Column all-gather read: wait for this token's 8 global columns
-
rearm–Store the sentinel over one 16-byte fragment.
-
spin_deadline–Call once per poll that found no data: arms the deadline on the first
LamportMailbox
¶
One TP group's [3, tp, capacity, width] BF16 mailbox and stage state.
Construction is collective over group and raises on every rank when the
buffer has no multicast mapping. peers are the ranks' buffer addresses
in rank order and multicast the multicast address of the whole buffer.
Methods:
-
compile_publish–The shared-only publisher of this mailbox (call before capture); one
-
publish–Multicast
rows[m, width] BF16 into slot [NEXT_STAGE, rank].
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
compile_publish(*, threads=128, release_before_store=False, enable_pdl=True)
¶
The shared-only publisher of this mailbox (call before capture); one compile per launch shape, shared by every mailbox of that shape.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
publish(publisher, rows)
¶
Multicast rows [m, width] BF16 into slot [NEXT_STAGE, rank].
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
_poll(base, stride, offsets, timeout_ns)
¶
Lamport-poll the 16-byte fragments at base + offsets[i] * stride
(elements) into a [len(offsets), 4] u32 register tensor. All loads issue
before any check and only dirty fragments re-poll; traps after
timeout_ns without data.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
compile_shared_only_publish(*, hidden, tp, rank, capacity_m, elements_per_thread, threads, release_before_store, enable_pdl)
¶
Compile the publisher that multicasts a local [m, hidden] BF16 tensor
into slot [NEXT_STAGE, rank] and then sets ACTIVE_STAGE.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
fetch(values, i, pointer)
¶
Load fragment i into values[i]; returns its dirty flag at bit i.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
poll(base, stride, count, timeout_ns=SPIN_TIMEOUT_NS)
¶
count fragments at base + i * stride (elements, stride at run
time), polled as _poll does: a [count, 4] u32 register tensor.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
poll_at(base, offsets, timeout_ns=SPIN_TIMEOUT_NS)
¶
The fragments at base + offsets[i] (elements, compile-time), polled as
_poll does: a [len(offsets), 4] u32 register tensor.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
poll_owned_fragment(mailbox, stage_state, packed, token, fragment, tp, capacity_m, hidden_local, release_dependents, timeout_ns=SPIN_TIMEOUT_NS)
¶
Column all-gather read: wait for this token's 8 global columns
fragment from the one rank that owns them, store the BF16x8 fragment
into packed and re-arm the slot; one thread per launch advances the
stage. Releases PDL dependents after the poll when release_dependents
(a kernel that triggers earlier passes False).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/common/mailbox.py
rearm(pointer)
¶
Store the sentinel over one 16-byte fragment.
spin_deadline(deadline, timeout_ns)
¶
Call once per poll that found no data: arms the deadline on the first call (zero means unarmed) and traps once it has passed.