vllm.models.muse_spark.nvidia.specialized_decode.cutedsl.moe.pooler_gather
¶
The pooler of the Muse Spark specialized decode.
Each TP rank projects the replicated tokens onto its contiguous block of the
pooler's output columns, [b, P / tp] = x [b, H] @ W[rank block].T (the
pooler GEMM), multicasts that block into a Lamport mailbox and gathers the
full [b, P] rows from every rank straight into the expert input:
-
NVFP4 layers (
ExpertsInput):pre_expert_normand NVFP4 quantization fused into the gather::y = bf16(x * rsqrt(mean(x**2) + eps) * (weight + gain_center)) a, a_sf = nvfp4(y, global_scale, block 16)
a is uint8 [b, P / 2] (two e2m1 codes per byte, the even column in
the low nibble) and a_sf float8_e4m3fn [b, P / 16], not swizzled.
These are the bytes the stock all-gather + norm + quantize hands the routed
experts, bit for bit.
- BF16 edge layers (ExpertsInputBf16): the gathered rows, then pre_expert_norm
(expert_norm.ExpertNorm), bit for bit the stock gather + norm except for
the sign of zero: publishers store BF16 -0.0 as +0.0 (-0.0 is the mailbox
sentinel).
The pooler GEMM is vLLM's in-tree skinny GEMM (BF16 in and out, FP32
accumulation) at the launch shape POOLER_GEMM. One mailbox serves every
layer; calls must run in the same order on every rank.
Classes:
-
Pooler–The pooler for every MoE layer of one TP rank: the pooler GEMM, the
-
PoolerGemmShape–Launch shape of the pooler GEMM (the in-tree skinny GEMM):
block_size -
PoolerLayer–What the pooler reads from one stock MoE layer (views, no copies).
Functions:
-
compile_gather–The plain gather consumer. Call: (mailbox, output [m, hidden] BF16,
-
compile_norm_quant–The gather + norm + NVFP4 consumer over a ``[3, tp, capacity_m,
-
compile_pooler_gemm–The in-tree skinny GEMM
c [rows, N] = a [rows, K] @ b [N, K].T(BF16, -
cvt_e2m1x8_f32–Convert eight float32 values to eight E2M1 (4-bit) values packed into uint32.
-
cvt_f32_to_e4m3–Convert float32 to E4M3 using native cvt.rn.satfinite.e4m3x2.f32.
-
fabs_f32–Compute absolute value of float32 using PTX abs.f32.
-
fmax_f32–Compute max of two float32 values using PTX max.f32.
-
nvfp4_compute_output_scale–The NVFP4 output scale
rcp(float(sf) * rcp(global_scale)), 0 when the -
pooler_layer–The pooler of one stock MuseSpark1xMoE, checked against what the fused
-
rcp_approx_ftz–Fast reciprocal using PTX rcp.approx.ftz.f32.
Pooler
¶
The pooler for every MoE layer of one TP rank: the pooler GEMM, the publish of this rank's column block and the gather into the NVFP4 expert input (NVFP4 layers) or the normed BF16 rows (BF16 edge layers).
Construction is collective over group (the mailbox rendezvous) and
compiles every kernel; warm_up runs each form once and must run on
every rank alike. run is graph-capturable and allocates nothing; its
outputs are views of scratch the next call overwrites.
Methods:
-
gather–Consume the published blocks: the NVFP4 expert input
(a, a_sf) -
project–The pooler GEMM: this rank's
[b, P / tp]columns into scratch. -
publish–Multicast the first
brows of the projected block. -
run–xBF16 [b, H] (the pre_ffn_norm output) -> the expert input. -
warm_up–One call of each form per batch on zero rows, before capture (every
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
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 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | |
gather(layer, b)
¶
Consume the published blocks: the NVFP4 expert input (a, a_sf)
for an NVFP4 layer, the normed BF16 rows for an edge layer.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
project(layer, x)
¶
The pooler GEMM: this rank's [b, P / tp] columns into scratch.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
publish(b)
¶
Multicast the first b rows of the projected block.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
run(layer, x)
¶
x BF16 [b, H] (the pre_ffn_norm output) -> the expert input.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
warm_up()
¶
One call of each form per batch on zero rows, before capture (every rank, same order).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
PoolerGemmShape
¶
Bases: NamedTuple
Launch shape of the pooler GEMM (the in-tree skinny GEMM): block_size
threads per CTA over K, outputs_per_block columns per CTA, the K loop
unrolled k_unroll times.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
PoolerLayer
¶
Bases: NamedTuple
What the pooler reads from one stock MoE layer (views, no copies).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
_AllGatherDeviceKernel
¶
The plain column all-gather of the BF16 edge layers: one thread per 8
global columns of one row, read from the rank that owns them and stored
into output [m, hidden] BF16. Grid (m, hidden / (128 * 8)).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
compile_gather(*, hidden, tp, capacity_m, enable_pdl=True)
¶
The plain gather consumer. Call: (mailbox, output [m, hidden] BF16, stage state, m, stream) as CuTe views.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
compile_norm_quant(*, hidden, tp, capacity_m, eps, gain_center, enable_pdl=True)
¶
The gather + norm + NVFP4 consumer over a [3, tp, capacity_m,
hidden / tp] mailbox. Call: (mailbox, weight [hidden] BF16, global_scale
[1] FP32, packed [m, hidden / 2] u8, scales [m, hidden / 16] u8, stage
state, m, stream) as CuTe views.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
compile_pooler_gemm(rows, shape, *, enable_pdl=True)
¶
The in-tree skinny GEMM c [rows, N] = a [rows, K] @ b [N, K].T (BF16,
N and K dynamic), compiled as the in-tree wrapper compiles it but called
with a caller-owned output. Call: (a, b, residual, c, stream) with torch
tensors; residual is ignored (pass c).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
cvt_e2m1x8_f32(v0, v1, v2, v3, v4, v5, v6, v7, *, loc=None, ip=None)
¶
Convert eight float32 values to eight E2M1 (4-bit) values packed into uint32.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
cvt_f32_to_e4m3(a, *, loc=None, ip=None)
¶
Convert float32 to E4M3 using native cvt.rn.satfinite.e4m3x2.f32.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
fabs_f32(a, *, loc=None, ip=None)
¶
Compute absolute value of float32 using PTX abs.f32.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
fmax_f32(a, b, *, loc=None, ip=None)
¶
Compute max of two float32 values using PTX max.f32.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
nvfp4_compute_output_scale(fp8_val, global_scale, *, loc=None, ip=None)
¶
The NVFP4 output scale rcp(float(sf) * rcp(global_scale)), 0 when the
E4M3 scale is zero (the E4M3 byte widened through the hardware f16x2 path).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
pooler_layer(moe, tp, rank)
¶
The pooler of one stock MuseSpark1xMoE, checked against what the fused path assumes (the stock path's own conditions for its fused gather).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/cutedsl/moe/pooler_gather.py
rcp_approx_ftz(a, *, loc=None, ip=None)
¶
Fast reciprocal using PTX rcp.approx.ftz.f32.