vllm.models.kimi_k3.nvidia.specialized_decode.cutedsl.moe.wide
¶
Wide MoE: the MoE layer of decode steps past the prepared batches (65 to
WIDE_ROWS rows, e.g. 13-204 DSpark verify requests of 5 tokens), at TP8/TP16.
One layer (spec engine, ROUTING "sharded"):
side stream shared expert (gate/up, SiTU, down; the stock module) -> BF16
partial [b, 7168]
front one FP32-out GEMM over this rank's router rows and latent down shard
(providers.pack_front: 1/TP of the replicated 51 MB latent down),
WidePublish multicasts both into every rank's mailbox row, then
WideRouteSharded: exact top16 from the polled logits, each pair
appended to its expert's routing list, and the polled latent row
written as the experts' MXFP8 plan
experts the listed wide grouped engine (unit windows built from the routing
lists: every touched expert streams once per 8 of its tokens) and the
routing-weighted top16 sum (Finalize); past ENGINES' spec
range the stock TRTLLM-Gen MXFP4 experts (routing inside), finalized,
behind the replicated router and latent down GEMMs
tail the latent all-reduce with the RMSNorm fused (the stock FlashInfer
kernel), this rank's up-projection columns added into its shared
partial, and the all-reduce of the hidden rows (the stock latent
MoE's column-parallel tail)
Precision is the stock path's: BF16 linears and shared expert, FP32 router logits, the latent rounded once to BF16 (as the stock GEMM epilogue), MXFP8 activations x MXFP4 experts with the MXFP8 hidden, FP32 accumulation of the BF16 top16 rows, BF16 all-reduces; only accumulation orders differ.
Classes:
-
Finalize–out[t] = sum_k w[t, k] * rows[16 t + k] (FP32, k in order, one BF16 rounding):
-
WideMoE–One MoE layer's wide provider over the stock module's weights and the layer's
-
WidePublish–This rank's sharded front rows (FP32 [b, n]: its router logit rows [0, valid),
-
WideRoute–The listed wide engine's front: CTA t routes token t (
RouteSitu's exact -
WideRouteSharded–WideRouteover the sharded front: every rank'sWidePublishleft its -
WideScratch–Model-owned wide-MoE buffers at the widest batch (shared by every layer), the
Functions:
-
engine–'spec' or 'trtllm' for
batch(defers: the stock experts would leave -
wide_batches–The wide MoE's batches among
batches: past the prepared 64, at most
Finalize
¶
out[t] = sum_k w[t, k] * rows[16 t + k] (FP32, k in order, one BF16 rounding): one CTA per token, 448 threads of 8 columns.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
WideMoE
¶
One MoE layer's wide provider over the stock module's weights and the layer's
PersistentExperts (prepared here for its wide batches).
Methods:
-
__init__–packed: this rank's [router rows; latent down shard] (``providers. -
run–[b, 7168] BF16 MoE output of the hidden rows
x(all-reduced). -
serves–Whether this layer's wide MoE is prepared for
batchrows. -
tail–Latent all-reduce + RMSNorm, this rank's up-projection columns added into
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 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 | |
__init__(module, experts, state, beta, linear_beta, packed=None)
¶
packed: this rank's [router rows; latent down shard] (providers.
pack_front, shared with the narrow front), else packed here.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 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 | |
run(x)
¶
[b, 7168] BF16 MoE output of the hidden rows x (all-reduced).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
serves(batch)
¶
tail(routed, shared)
¶
Latent all-reduce + RMSNorm, this rank's up-projection columns added into the shared expert's partial, then the all-reduce of the hidden rows.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
WidePublish
¶
This rank's sharded front rows (FP32 [b, n]: its router logit rows [0, valid), then its latent down shard [n - shard, n)) multicast into every rank's mailbox row of each token: the logits as FP32 words at columns 3584 + 2 * valid * rank, the latent shard rounded once to BF16 (as the stock BF16 GEMM epilogue) at columns shard * rank. Negative zeros become +0 (the Lamport sentinel).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
WideRoute
¶
Bases: RouteSitu
The listed wide engine's front: CTA t routes token t (RouteSitu's exact
top16 and renormalized weights) and appends its 16 (token, slot) pairs to their
experts' routing lists (relaxed GPU-scope counter claims; this call's parity is
the experts workspace's grouped-call generation & 1); CTA b + t writes token t's
MXFP8 plan row from the BF16 latent (plan_chunk: bit-identical to
ExpertsPlanKernel). The experts release at the end (late: they must not take
SMs from routing).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
WideRouteSharded
¶
Bases: WideRoute
WideRoute over the sharded front: every rank's WidePublish left its
router logits (FP32 words) and latent shard (BF16) in this rank's mailbox row of
each token. The routing CTAs poll the logits (RouteSitu's polled routing), the
plan CTAs poll the latent row and write the MXFP8 plan; both re-arm what they
read (Lamport: no dependency wait on the data).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
WideScratch
¶
Model-owned wide-MoE buffers at the widest batch (shared by every layer), the wide experts' own workspace and plan, and the side streams.
Methods:
-
reserve–Size the spec engine's expanded rows for
batch(the widest batch the
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
reserve(batch)
¶
Size the spec engine's expanded rows for batch (the widest batch the
layers' spec engines take), before any engine binds them.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
engine(batch, defers)
¶
'spec' or 'trtllm' for batch (defers: the stock experts would leave
this batch unfinalized).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/wide.py
wide_batches(batches)
¶
The wide MoE's batches among batches: past the prepared 64, at most
WIDE_ROWS.