vllm.models.muse_spark.nvidia.specialized_decode.runtime.providers
¶
The provider surface of the specialized decode and the seams between providers.
One decode step is: the stock embedding, then per layer the input boundary
(gather + dual norm into the attention), the attention (QKV front, attention
core, o_proj partial), the attention boundary (all-reduce + dual norm into the
MoE) and the MoE (router, routing, pooler, routed experts, tail, unpooler), then
the final boundary (the last boundary with the final norm). Each block after the
embedding is implemented by a provider; LAYOUTS picks the provider of every
block per TP size.
Shapes below use b rows (b <= PREPARED_MAX), H = HIDDEN and P = POOLED. Every
provider launches on the current stream; one that forks a side stream joins it
before run returns.
Classes:
-
AttentionBoundaryProvider–The attention boundary: all-reduce of
partial(bf16 [b, H]), -
AttentionProvider–The attention: QKV front (QKV GEMM, QK norm, RoPE, KV insert), the
-
BoundaryProvider–The input and final boundaries: all-gather of the MoE's unpooler column
-
BuildContext–What
Provider.buildreceives, once, after the weights are loaded. -
ExpertsInput–The NVFP4 expert input the stock layer hands the routed experts op.
-
MoEProvider–The MoE: router (fp32 GateLinear [b, H] -> [b, NUM_EXPERTS]), routing
-
Provider–buildruns once after load, before KV binding and CUDA graph capture: -
QkvAttention–The attention: the QKV front (the CuTe kernel of
-
RoutedExpertsOps–The two public routed expert ops the stock layer calls and the TP16
-
RoutedMoE–The MoE: the stock router (GateLinear, asserted on a vLLM-native tier), the
-
RoutedTopk–Exactly the pair the stock layer hands the routed experts op: global
-
Step–A planned step (host state only, the same on every rank).
Functions:
-
router_tier–Why the stock GateLinear would not run a vLLM-native kernel for the decode
AttentionBoundaryProvider
¶
The attention boundary: all-reduce of partial (bf16 [b, H]),
post_attn_norm, the gated add into stream (fp32 [b, H], in place) and
pre_ffn_norm into out (bf16 [b, H]).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
AttentionProvider
¶
The attention: QKV front (QKV GEMM, QK norm, RoPE, KV insert), the
attention core with o-norm and sigmoid gate, and o_proj. x bf16 [b, H]
in; returns the bf16 [b, H] tensor holding this rank's row-parallel o_proj
partial (before the all-reduce).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
BoundaryProvider
¶
The input and final boundaries: all-gather of the MoE's unpooler column
blocks from slot, then post_ffn_norm, the gated add into stream (fp32
[b, H], in place) and the next pre-norm (the next layer's pre_qkv_proj_norm;
model.norm for the final boundary) into out (bf16 [b, H]). aux (fp32
[b, H]) receives the updated stream when the next layer is an aux layer.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
BuildContext
¶
Bases: NamedTuple
What Provider.build receives, once, after the weights are loaded.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
ExpertsInput
¶
Bases: NamedTuple
The NVFP4 expert input the stock layer hands the routed experts op.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
MoEProvider
¶
The MoE: router (fp32 GateLinear [b, H] -> [b, NUM_EXPERTS]), routing
(RoutedTopk), pooler GEMM and gather + pre_expert_norm + quant
(ExpertsInput), the routed experts (RoutedExpertsOps ->
UnfinalizedExperts), the tail (post_expert_norm, weighted sum, EP
combine) and the unpooler GEMM, whose [b, H / tp] column block is published,
zero-copy, into the mailbox of the next boundary (bound at build).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
Provider
¶
Bases: Protocol
build runs once after load, before KV binding and CUDA graph capture:
every rendezvous, weight view, compile, warm-up and constant happens there.
run is graph-capturable, allocates nothing and takes no per-step constant.
Methods:
-
prepare_kv–Called for every bound KV cache (the profiling cache, then the real one).
-
unsupported–A deployment requirement of this provider that fails, or None.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
QkvAttention
¶
The attention: the QKV front (the CuTe kernel of
cutedsl/attention/qkv_front.py: QKV + o-gate GEMM, QK norm, RoPE and the
K/V insert), attn2 (the CuTe kernel of cutedsl/attention/attn2.py: paged
attention of the 8-token verify step with the o-norm and sigmoid gate) and
the o_proj partial (OProjection: cuBLAS; at TP8 the package GEMM, which
also publishes the partial into the attention boundary's mailbox).
Methods:
-
front_call–(kv_cache, slot_mapping) of this layer's QKV front call on
x
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
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 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 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | |
front_call(step, x)
¶
(kv_cache, slot_mapping) of this layer's QKV front call on x
(the step's attention input) into its qkv rows in the current forward
context, or None if the kernel does not take the call. Host state
only: shapes, dtypes, strides and alignment, the same on every rank
(prepare_kv holds every rank's KV cache to the aligned layout).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
RoutedExpertsOps
¶
Bases: Protocol
The two public routed expert ops the stock layer calls and the TP16 all-reduce wrapper, behind the one runtime module allowed to name their library.
Methods:
-
build–Asserts and one warm-up call per op at b = 8; raises where an op is not
-
nvfp4_plan–Host only: how the NVFP4 call for these inputs runs from routing
-
routed_experts_bf16–The BF16 op routes inside, from the fp32 [b, NUM_EXPERTS] router
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
build(group, layers)
¶
Asserts and one warm-up call per op at b = 8; raises where an op is not allowed (all_reduce off TP16).
nvfp4_plan(layer, inputs, topk)
¶
Host only: how the NVFP4 call for these inputs runs from routing
metadata (its metadata is what the routing writes), or None.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
routed_experts_bf16(layer, x, router_logits)
¶
The BF16 op routes inside, from the fp32 [b, NUM_EXPERTS] router logits, as the stock BF16 layers do.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
RoutedMoE
¶
The MoE: the stock router (GateLinear, asserted on a vLLM-native tier), the
routing short tail (RoutedTopk; the BF16 edge layers route inside the
experts op), the pooler (ExpertsInput or ExpertsInputBf16), the routed
experts (RoutedExpertsOps -> UnfinalizedExperts), the tail and the
unpooler GEMM, which publishes this rank's column block zero-copy into the
next boundary's mailbox.
With the short tail, the router and the routing run on an aux stream while the
pooler runs on the current one, joined before the routed experts. The fork and
join are issued directly, not through maybe_execute_in_parallel, which runs
both sides in series under this model's breakable CUDA graph capture. The BF16
edge layers stay in series: their router logits feed the experts op on the
current stream.
Methods:
-
build–mailbox: the LamportMailbox of the boundary after this layer. -
warm_up–One eager pass, before capture, of the NVFP4 experts path a captured
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | |
build(ctx, layer, *, ops, pooler, pooler_index, tail, mailbox)
classmethod
¶
mailbox: the LamportMailbox of the boundary after this layer.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
warm_up()
¶
One eager pass, before capture, of the NVFP4 experts path a captured step runs: the plan, the routing, the experts and the tail, so that every first launch and first-use compile happens before capture. The routes spread over all experts, so every EP rank runs its GEMMs. Collective (the tail): every rank warms the same layers in the same order.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
RoutedTopk
¶
Bases: NamedTuple
Exactly the pair the stock layer hands the routed experts op: global expert ids and their renormalized, scaled weights, as fused_musespark1x_routing returns them.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
Step
¶
Bases: NamedTuple
A planned step (host state only, the same on every rank).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
_scratch(ctx, name, shape, dtype)
¶
An executor buffer shared by every layer (allocated once, at build).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/providers.py
router_tier(router)
¶
Why the stock GateLinear would not run a vLLM-native kernel for the decode batch (its last tier is F.linear, which follows --linear-backend), or None.