vllm.models.deepseek_v41.amd.mono.common.sync
¶
The tagged mailbox: hand-offs between the CTAs of one GPU (device scope) and
between GPUs (system scope), every address a named region (Addr).
Classes:
-
Addr–A mailbox region's address: the region's name and space, and the traced
-
Mailbox–Tagged-pair hand-off between CTAs (device scope) and GPUs (system scope).
Functions:
-
preg–Peer-symmetric region
regionat byteoffsetof a rank's buffer -
publish–This CTA's plain stores made readable by every CTA, then (thread
who) -
sreg–Scratch region
regionat byteoffsetofbase.
Addr
dataclass
¶
A mailbox region's address: the region's name and space, and the traced address. The space sets the hand-off's scope: device for SCRATCH, system for PEER.
Source code in vllm/models/deepseek_v41/amd/mono/common/sync.py
Mailbox
¶
Tagged-pair hand-off between CTAs (device scope) and GPUs (system scope).
Every 32-bit value is stored next to this launch's tag; a consumer
polls the payload until all tags match, so a hand-off costs one round trip
(no store drain, no separate flag). The mono layer's launches tag their
hand-offs with their epoch (layer.py), so a pair from an earlier step
never carries a live tag. Every address is an Addr: its space picks the
scope.
Methods:
-
poll–Batched poll of pairs
specs= [(Addr, pair index, npairs in {1, 2})], -
put_bf–Elements i .. i+len(vs) (2 or 4, i aligned) as packed bf16 pairs, one
-
put_words–Raw 32-bit words (1 or 2) at pairs i.. as (word, tag). Integer payloads
Source code in vllm/models/deepseek_v41/amd/mono/common/sync.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
poll(specs, batch=POLL_MAX)
¶
Batched poll of pairs specs = [(Addr, pair index, npairs in {1, 2})],
all of one space.
All pairs are re-loaded together while any tag is stale, so a batch costs one round trip after its last producer lands. Returns the value words.
Source code in vllm/models/deepseek_v41/amd/mono/common/sync.py
put_bf(a, i, vs)
¶
Elements i .. i+len(vs) (2 or 4, i aligned) as packed bf16 pairs, one store.
Source code in vllm/models/deepseek_v41/amd/mono/common/sync.py
put_words(a, i, words)
¶
Raw 32-bit words (1 or 2) at pairs i.. as (word, tag). Integer payloads (fp8 words) must come this way: through an f32 value a NaN bit pattern is not kept.
Source code in vllm/models/deepseek_v41/amd/mono/common/sync.py
_spin(load_all, pending)
¶
Re-issue load_all until pending clears; a side-effecting op in the
loop keeps the loads from being hoisted.
Source code in vllm/models/deepseek_v41/amd/mono/common/sync.py
preg(base, offset, region)
¶
Peer-symmetric region region at byte offset of a rank's buffer
base.
publish(put, a, i, v, who)
¶
This CTA's plain stores made readable by every CTA, then (thread who)
the mailbox pair (a, i) := v. The stores are drained first: a flag may
not overtake the data it announces, and a workgroup-scope release fence does
not wait for them (LLVM's AMDGPU memory model omits vmcnt outside tgsplit
mode: the workgroup's waves share one CU, the readers here do not).