vllm.models.kimi_k3.nvidia.specialized_decode.cutedsl.mla.dcp
¶
MLA decode under decode context parallelism (DCP = TP, rank d owns head block d) without collectives, three kernels per layer. Each rank's KV cache holds 1 / DCP of every context.
MlaQuery FP8 query rows [B, H, 576] (+ the KV insert where this rank owns the slot); each CTA multicasts its bytes into every rank's Lamport q mailbox [B, DCPH, 576], then polls its share until all landed tokenspeed all DCPH heads over the local KV shard -> BF16 rows + LSE (log2) DcpValue re-arms the q mailbox; rows pushed to their head owner's Lamport mailbox (peer stores); the owner LSE-merges its H heads over the DCP sources, then W_UV and the gate (padding from the global lengths)
Classes:
-
DcpBox–Model-owned DCP state over
group, Lamport mailboxes (sentinel-filled, -
DcpValue–The DCP tail of one MLA layer, one 512-thread CTA per (head, 16 requests).
Functions:
-
compile_value–DcpValue of one batch (
qrows per request);uv: the (shape, stride, -
fill_splits–Splits filling the SMs (one CTA pair each); tokenspeed caps itself at 32.
-
local_max–Longest local shard of a
max_contextsequence (block-interleaved). -
stock_decode–tokenspeed_mla_decode's FP8 path with caller-owned
outandlse(log2)
DcpBox
¶
Model-owned DCP state over group, Lamport mailboxes (sentinel-filled,
re-armed by their reader): q [2, CAP, DCP*H, 576] FP8 bytes (multicast stores),
partials [2, DCP, CAP, H, 512] BF16 and LSE [2, DCP, CAP, H] FP32 (peer stores),
and the local tokenspeed rows / LSE. Parity alternates by layer. interleave:
the KV cache's DCP interleave (global masking of spec verify rows).
Methods:
-
mc–The q mailbox multicast address of
parity.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/dcp.py
DcpValue
¶
The DCP tail of one MLA layer, one 512-thread CTA per (head, 16 requests).
Every rank re-arms this parity's q mailbox (tokenspeed has read it) and pushes all
its local tokenspeed rows (+ LSE) to their head owner's Lamport mailbox (empty
local shards: zeros, LSE -inf). Warp r then LSE-weights request t0 + r of this
head over the DCP sources (exp2(lse - max) / sum in FP32), the CTA merges the
polled rows in FP32
(one BF16 rounding, re-arming what it read) into shared memory, and W_UV (BF16
MMA, FP32 accumulation) and the sigmoid gate follow as in MlaValue: warp w owns
outputs 32 (w // 4) + 8 (w % 4) .. + 7. Rows are tokens, q per request.
Methods:
-
merge–The owner's merge of request rows t0.. of this head, then W_UV + gate.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/dcp.py
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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
merge(args, latent, scales, wb, tid)
¶
The owner's merge of request rows t0.. of this head, then W_UV + gate.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/dcp.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
compile_value(heads, size, batch, cap, uv, pitch, device, sms=148, q=1)
cached
¶
DcpValue of one batch (q rows per request); uv: the (shape, stride,
dtype) of W_UV, pitch: the projected rows' (the gate follows the 2112 query /
KV columns).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/dcp.py
fill_splits(batch, device)
¶
Splits filling the SMs (one CTA pair each); tokenspeed caps itself at 32.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/dcp.py
local_max(max_context, size)
¶
Longest local shard of a max_context sequence (block-interleaved).
stock_decode(query, cache, block_table, lengths, max_seq, scales, out, lse=None, min_split=1, pdl=True, cp=(1, 0, 1), totals=None, pack=False)
¶
tokenspeed_mla_decode's FP8 path with caller-owned out and lse (log2)
buffers and no per-call allocation: the split count follows from (B, max_seq,
min_split); lengths bound the work, empty splits are skipped by its reducer.
The q rows of a request mask causally; under DCP in global positions (cp:
world, rank, interleave; totals: the global lengths). pack: M128 tiles hold
consecutive (query row, head) rows across the q rows.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/dcp.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |