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.
Classes:
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
MonoBuild
dataclass
¶
Attributes:
Source code in vllm/models/deepseek_v41/amd/mono/layer.py
tuned
property
¶
A target layer of compress ratio 2 at TP2 on gfx950: its tuned paths
are on (bit-exact against the generic ones), every other build compiles
the generic code. Its scratch layout is its own (scratch_layout).
_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
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 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 | |
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
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 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | |
scratch_layout(s, tp, experts=EXPERTS, topk=TOPK, ug_groups=2, tuned=False)
¶
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.
tuned: a tuned build's layout (MonoBuild.tuned), in a scratch of its
own.
Source code in vllm/models/deepseek_v41/amd/mono/layer.py
store_normed(normed, t, col, ys, live, wide=False)
¶
The FFN seam's norm output -> the MoE input row (bf16, device scope:
this launch reads it). wide: the 8 values as one 16-byte store (a store
each kept the publish's drain behind 24 of them).
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.