vllm.models.deepseek_v4.amd.mono.layer
¶
The mono decode layer's two launches (README): K1 = the attention seam
(stages.seam: slice, gate, the norm into vLLM's MXFP8) + the attention front
(attention.front); K2 = the attention back (attention.back, wo_b pushed
to every rank) + the FFN seam (the TP sum folded in) + the MoE (stages.moe,
its all-reduce in-kernel too).
Tags: K1's hand-offs carry 2 e + 1, K2's 2 e + 2 (e: the launch pair's epoch, moved on by K2's CTA 0 at its end), so K2's seam may reuse K1's seam regions. Peer regions alternate by e's parity; every rank runs the same launches, so the epochs agree across ranks.
Functions:
-
peer_half_bytes–One parity's peer regions: the attention's partials, then the MoE's.
-
publish_x8–Token t's two XRDY flags (one a wqkv K half) once its X8 / X8S landed.
-
run_ffn–K2's FFN half on this CTA: the FFN seam (the attention's TP partials
-
scratch_layout–Every region of step width s's launches -> (byte offset, bytes), disjoint:
-
store_normed–The FFN seam's norm output -> the MoE input row (bf16, device scope:
-
store_x8–The attention seam's norm output (
seam.stage_norm's 8 columns at
_variant(key)
¶
A build's variant flags past the original's, for its kernel symbol.
Source code in vllm/models/deepseek_v4/amd/mono/layer.py
peer_half_bytes(tp)
¶
One parity's peer regions: the attention's partials, then the MoE's.
publish_x8(c, t)
¶
Token t's two XRDY flags (one a wqkv K half) once its X8 / X8S landed.
Source code in vllm/models/deepseek_v4/amd/mono/layer.py
run_ffn(key, lds, a, amb, bases, own, rank, ep)
¶
K2's FFN half on this CTA: the FFN seam (the attention's TP partials
summed and folded into the residual), the MoE and its all-reduce into
a["out"], then the launch pair's epoch moved on.
Source code in vllm/models/deepseek_v4/amd/mono/layer.py
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 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
scratch_layout(s, tp, topk=0)
¶
Every region of step width s's launches -> (byte offset, bytes), disjoint:
K1's front and seam, K2's back, the MoE's regions, the normed rows and their
flags. Each width has a scratch of its own (MonoRunner.scratch):
under another width's layout a mailbox pair's tag word could be plain data,
which a poll may take for a current tag. The MoE's counters, whose slots
outlive a step width, are in the epoch buffer.
Source code in vllm/models/deepseek_v4/amd/mono/layer.py
store_normed(normed, hidden, t, col, ys, live)
¶
The FFN seam's norm output -> the MoE input row (bf16, device scope: this launch reads it).
Source code in vllm/models/deepseek_v4/amd/mono/layer.py
store_x8(c, t, col, ys, live)
¶
The attention seam's norm output (seam.stage_norm's 8 columns at
col) -> vLLM's MXFP8 of each 32 (the attention's input quant) -> the
front's X8 / X8S, plain at device scope.