vllm.models.deepseek_v41.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). A layer whose attention vLLM runs takes the FFN
launch instead: K2 with the attention back replaced by a push of vLLM's
unreduced wo_b output (seam.stage_push).
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:
-
build_mono_ffn–The FFN launch of a layer whose attention vLLM ran (
part: this rank's -
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
_ffn_symbol_params(key)
¶
The FFN launch's symbol parameters. The timeline flag tells a timeline build apart, as in K1's and K2's symbols. The draft's build adds its expert count, so that a profile tells the two FFN launches apart.
Source code in vllm/models/deepseek_v41/amd/mono/layer.py
_symbol_params(key)
¶
The kernel symbol's draft-only parameters (none for a target layer).
Source code in vllm/models/deepseek_v41/amd/mono/layer.py
build_mono_ffn(key)
¶
The FFN launch of a layer whose attention vLLM ran (part: this rank's
unreduced wo_b output, bf16 [S, HIDDEN]): K2's FFN half, the partial pushed
to every rank first. It takes a launch pair's epoch, as K2 does.
Source code in vllm/models/deepseek_v41/amd/mono/layer.py
989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 | |
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_v41/amd/mono/layer.py
run_ffn(key, lds, a, amb, bases, own, rank, ep, part=None, tl=None)
¶
K2's FFN half on this CTA: the FFN seam (the attention's TP partials --
part pushed to every rank's ATTN region first -- summed and folded into
the residual), the MoE and its all-reduce into a["out"], then the
launch pair's epoch moved on. tl: K2's timeline record base (a
timeline build), stamped from point K2_SEAM_POINT on.
Source code in vllm/models/deepseek_v41/amd/mono/layer.py
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 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
scratch_layout(s, tp, experts=EXPERTS, topk=TOPK, ug_groups=2)
¶
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 (DSV41MonoLayer.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. The MoE regions follow the
runner's routing and FP4 groups of an ug task: with one group a task (the
DSpark draft's runner) the ug flags take twice the room of two groups.
Source code in vllm/models/deepseek_v41/amd/mono/layer.py
store_normed(normed, 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_v41/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.