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
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
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 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 | |
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)
¶
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.
Source code in vllm/models/deepseek_v41/amd/mono/layer.py
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 | |
scratch_layout(s, tp)
¶
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.
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.