For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python function
mega_ffn_combine_send
mega_ffn_combine_send()
max.nn.ep.mega_ffn_combine_send(config, buffers, grouped, route, *, n_local_experts, max_recv_tokens, gate_up_weight, gate_up_b_scales, down_weight, down_b_scales, gate_up_expert_scales, down_expert_scales, c_input_scales, estimated_total_m, activation=None)
Runs the routed experts’ FFN and sends its rows back, one launch each.
Each device runs one kernel, which replaces both grouped matmuls and
combine_start(). The down projection writes each
finished row to its source device’s receive buffer, so the FFN’s output
is never stored on its own device. combine_finish()
then waits for the rows.
-
Parameters:
-
- config (EPConfig) – The expert-parallel configuration. It must not set
use_allreduceorfused_shared_expert. - buffers (EPBuffers) – The exchange’s buffers.
- grouped (Grouped) – The NVFP4 tokens that
dispatch_finish()grouped. - route (Route) – The route that
dispatch_finish()returned. - n_local_experts (int) – The number of experts on each device, which is the first dimension of the weights.
- max_recv_tokens (int) – The most rows that a device can receive.
- gate_up_weight (Tensor) – The local experts’ gate/up weights, in the sigma-permuted layout.
- gate_up_b_scales (Tensor) – The gate/up weight scales.
- down_weight (Tensor) – The local experts’ down weights.
- down_b_scales (Tensor) – The down weight scales.
- gate_up_expert_scales (Tensor) – Each local expert’s gate/up output scale.
- down_expert_scales (Tensor) – Each local expert’s down output scale.
- c_input_scales (Tensor) – Each local expert’s inverted scale for the requantization between the two matmuls.
- estimated_total_m (Tensor) – The
uint32host scalar estimate of the routed rows per device, which selects the kernel’s tiles. - activation (GatedActivation | None) – The gated activation that the kernel fuses. Defaults to SiLU.
- config (EPConfig) – The expert-parallel configuration. It must not set
-
Raises:
-
ValueError – If
check_supported()rejectsconfig, ifconfigsetsuse_allreduceorfused_shared_expert, or ifconfigdispatches in another format than NVFP4 with one global scale. Legacy accepts per-token NVFP4 global scales here, but the kernel cannot read them, so this refusal is deliberately stricter than legacy. -
Return type:
-
None