vllm.models.kimi_k3.nvidia.specialized_decode.runtime.providers
¶
Per-layer attention providers (input projection, KDA/MLA core, o-projection) and
the helpers SpecializedDecode.build_providers uses.
Classes:
-
Attention–Input projection -> KDA/MLA/DSA core -> o-projection with its fused AttnRes.
-
SkinnyProjection–B1/B2 skinny GEMM; static K loads two weight tiles before the PDL wait (the
Functions:
-
dcp_box–The model's DCP mailboxes (one set for every MLA layer, one for every DSA
-
dsa_scratch–The DSA layers' shared rows (
cap: one per prepared batch row): the BF16 -
mla_balanced–The model's balanced MLA cores (one plan per step, shared by the MLA
-
pack_dsa_projection–One [q_a | kv_a | gate | wk | wv] weight for a K3.1 DSA layer; the stock
-
pack_front–[this rank's router rows (padded to 16); this rank's latent down shard].
-
projection_policies–Split-K (M tile, N tile, split, stages) per execution rows' next tested bin
-
step_cap–The most rows a specialized decode step takes: the crossover of every
-
wide_caps–Per attention layer kind, the most rows of a wide step its specialized input
Attention
¶
Input projection -> KDA/MLA/DSA core -> o-projection with its fused AttnRes.
Methods:
-
run_core–The KDA / MLA / DSA core of the projected rows into
local. -
run_wide–A wide step's attention (
x: the normalized rows of a batch in
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
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 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 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 | |
run_core(projected, local, caches, metadata, slot_mapping, q)
¶
The KDA / MLA / DSA core of the projected rows into local.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
run_wide(x, caches, metadata, slot_mapping, q)
¶
A wide step's attention (x: the normalized rows of a batch in
self.wide): the specialized input projection and core, then the stock
o_proj with its TP all-reduce, as the stock module ends. Returns its output.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
SkinnyProjection
¶
B1/B2 skinny GEMM; static K loads two weight tiles before the PDL wait (the
projections now run DecodeProjection; kept for the layer benchmarks).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
dcp_box(runtime, heads, dsa=False, flashinfer=False, partials='default')
¶
The model's DCP mailboxes (one set for every MLA layer, one for every DSA
layer: a q mailbox padded to the sparse decode's heads, BF16 for FlashMLA
sparse's 64 or 128, FP8 for FlashInfer's trtllm-gen / prims_ts query heads),
one slot per prepared batch row (at least 64). The partial rows DcpValue
exchanges: partials ("default": the layer kind's, see
mla.dcp.PARTIALS_DEFAULT).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
dsa_scratch(runtime, cap)
¶
The DSA layers' shared rows (cap: one per prepared batch row): the BF16
query (heads past the local ones stay zero), the normalized q_c, the indexer
projection, FP8 query and head weights, and FlashInfer's flat top-k rows,
their counts, latent (up to 128 heads) and LSE.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
mla_balanced(runtime, heads)
¶
The model's balanced MLA cores (one plan per step, shared by the MLA layers).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
pack_dsa_projection(attention)
¶
One [q_a | kv_a | gate | wk | wv] weight for a K3.1 DSA layer; the stock projections become views of it.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
pack_front(moe, rank, tp)
¶
[this rank's router rows (padded to 16); this rank's latent down shard].
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
projection_policies(tp, rows, batches)
¶
Split-K (M tile, N tile, split, stages) per execution rows' next tested bin (wider batches: 64-row N tiles).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
step_cap(dsa, dcp)
¶
The most rows a specialized decode step takes: the crossover of every attention layer kind of the model (K3: MLA; K3.1: MLA and DSA), within what the step's providers serve (PREPARED_MAX).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/runtime/providers.py
wide_caps(dcp, recoverssm=False)
¶
Per attention layer kind, the most rows of a wide step its specialized input
projection and core take (0: the stock attention module), at most ATTENTION_MAX.
recoverssm: the KDA layers verify with RecoverSSM records.