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
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 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 | |
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
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 | |
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.