Skip to content

vllm.model_executor.layers.fused_moe.flashinfer_moe_ep

Classes:

Functions:

FlashInferMoeEp

Methods:

_workspace()

The smallest workspace that fits the batch on every EP rank.

All ranks must use the same buffer, so without the DP-wide token counts this falls back to the default workspace.

expert_weight_views()

Kernel weight views and per-expert epilogue tensors.

kernel_weights()

Kernel-resident fc1 weight, fc1 scales, fc2 weight, fc2 scales.

Contiguous per-expert views alias the memory read by the megakernel. FP4 data and scales use uint8. Block-FP8 weights keep FP8.

_expert_major_bytes(tensor, as_bytes=True)

Contiguous storage of a per-expert kernel tensor, 1-byte dtypes as uint8 unless as_bytes is False.

The CuTeDSL kernel keeps (E, K, N) transpose views over (E, N, K) storage.

flashinfer_moe_ep_unsupported_reasons(moe, weight_key, activation_key)

Deployment constraints of the megakernel beyond the framework's checks.

activation_key is None for MXFP4 checkpoints (the kernel quantizes bf16 activations itself) but marks a W4A16 recipe for NVFP4 weights.

sm90_fp8_block_moe_ep_weights(w13, w13_scale)

Reorder block-FP8 w13 (gate rows, then up rows) for the SM90 kernel.

After the gate/up interleave a 128-row scale block holds 64 gate and 64 up rows from two checkpoint blocks. Both take the larger of the two scales and the other half is rescaled. Power-of-two scales make that an exponent shift, so only values that drop out of the E4M3 normal range round.

Parameters:

  • w13

    (Tensor) –

    (E, 2 * I, H) E4M3 weights.

  • w13_scale

    (Tensor) –

    (E, 2 * I / 128, H / 128) float32 dequantization scales.

Returns:

  • Tensor –

    The (E, 2 * I, H) weights in kernel row order and their

  • Tensor –

    (E, 2 * I / 128, H / 128) scales.

sm90_weight_format(quant_config)

Weight format for the current Hopper device, if supported.