vllm.models.kimi_k3.nvidia.specialized_decode.cutedsl.common.twoshot
¶
Two-shot Lamport all-reduce of BF16 rows [B, width] over TP ranks.
Rank o owns columns [o W, (o + 1) W), W = width / owners. Every buffer is
Lamport-armed and only its local reader re-arms it:
push: a rank stores its 8-column chunk of rowtokeninto the owner's receive slot [rank] (a peer store; the owner'srecv[TP, cap, W]; callers with a runtime parity pass the whole [parities x TP, cap, W] and slot parity x TP + rank).reduce: the owner polls the TP slots of an owned chunk in its own memory, sums them in FP32 in rank order, rounds once and multicasts the BF16 sum into every rank's gather row [cap, width]; then re-arms the slots.- every rank then polls its gather row (one slot) and re-arms it.
Each GPU moves ~2 x B x width x 2 bytes instead of TP x B x width x 2 (one-shot), and
every rank gets the same bits. owners = 1 is a one-GPU stand-in: rank 0 owns every
column and its TP local slots play the ranks. The o-projection reduces with reduce
and re-arms at once (two parities); the MoE tail reduces in WaveMoeTail and re-arms the
previous MoE layer's rows (three parities).
Classes:
-
TwoShot–Symmetric buffers per layer parity:
recv[TP, cap, W] (this rank's owned
Functions:
-
push–Store this rank's BF16 chunk (token, column .. column + 7) in receive slot
-
reduce–Owner of (token, column): the TP slots summed in FP32 in rank order, rounded
TwoShot
¶
Symmetric buffers per layer parity: recv [TP, cap, W] (this rank's owned
columns, one slot per source rank), gather [1, cap, width] (multicast) and the
ranks' recv base addresses [parity, TP].
Methods:
-
views–(recv, peers, gather, gather multicast address) of layer parity.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/common/twoshot.py
views(parity)
¶
(recv, peers, gather, gather multicast address) of layer parity.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/common/twoshot.py
push(recv, peers, slot, token, column, words)
¶
Store this rank's BF16 chunk (token, column .. column + 7) in receive slot
slot of its owner.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/common/twoshot.py
reduce(recv, gather, gather_mc, rank, token, column)
¶
Owner of (token, column): the TP slots summed in FP32 in rank order, rounded
once (no negative zero, the sentinel), multicast to every gather row; slots
re-armed. Returns nothing; callers then poll gather like a one-slot mailbox.