vllm.model_executor.layers.fused_moe.experts.rocm_aiter_moe
¶
Classes:
-
AiterExperts– -
AiterFp8BlockExperts–128x128 block-quantized weight scale, 128-grouped dynamic
-
AiterFp8ChannelExperts–Per-output-channel static weight scale, per-token dynamic
-
AiterFp8TensorExperts–Per-tensor static weight scale, either per-tensor static or
-
AiterMxfp4Experts–MXFP4-quantized weights, with either unquantized (bf16/fp16) or
-
AiterQuantType–Mirror of
aiter.QuantType, usable without importing AITER. -
AiterUnquantizedExperts–Unquantized (bf16/fp16) weights and activations.
Functions:
-
aiter_moe_pads–Round the padding deltas to what AITER's MoE dispatch expects.
-
derive_aiter_quant_type–AiterExperts._AITER_QUANT_TYPEfor callers that bypass the subclasses. -
inject_shared_expert_weights–Merge routed topk results with the shared expert buffer and inject
-
mxfp4_w4a16_extra_kwargs–AiterMxfp4Experts._extra_fused_moe_kwargsfor callers that bypass it. -
rocm_aiter_fused_experts–ROCm AITER fused MoE expert computation.
AiterExperts
¶
Bases: FusedMoEExpertsModular
_extra_fused_moe_kwargs()
¶
Leaf-specific extra kwargs for rocm_aiter_fused_experts.
AiterFp8BlockExperts
¶
AiterFp8ChannelExperts
¶
AiterFp8TensorExperts
¶
Bases: AiterExperts
Per-tensor static weight scale, either per-tensor static or per-tensor dynamic activation scale.
AiterMxfp4Experts
¶
Bases: AiterExperts
MXFP4-quantized weights, with either unquantized (bf16/fp16) or MXFP4-quantized dynamic activations. gfx950-only (not gfx1250), except for Kimi-K3's MXFP4 experts requantized to packed int4 at load on gfx942.
AiterUnquantizedExperts
¶
_resolve_aiter_activation(activation)
¶
Map a vLLM activation to AITER's activation_method, plus a gate/up interleave hint (only SWIGLUOAI_UNINTERLEAVE sets it).
aiter_moe_pads(hidden_pad, intermediate_pad, activation, use_mxfp4_w4a4, use_mxfp4_w4a16, tp_size)
¶
Round the padding deltas to what AITER's MoE dispatch expects.
SITU's A16W4 FlyDSL kernel pads per gate/up half, so its pads pass through unrounded. Otherwise the pads are rounded to AITER's CK/FlyDSL tile granularity, and at tp_size == 1 the intermediate pad is doubled for the fused gate/up weight. The W4A4 SiLU and W4A16 paths double it inside AITER, so it is passed undoubled; doubling it here as well masks live intermediate rows.
Where AITER doubles it (v0.1.28.post1):
- CK-Tile stage 1, aiter/fused_moe.py:
n_pad_zeros=intermediate_pad // 64 * 64 * (2 if use_g1u1 else 1).
- FlyDSL stage 1 takes inter_dim_pad unchanged and doubles it in the
kernel, aiter/ops/flydsl/kernels/mixed_moe_gemm_2stage_common.py:
inter_dim_pad_total = 2 * inter_dim_pad is subtracted from the fused
gate/up width. Stage 2 skips the padded K tail with the undoubled value
(pad_ku_skip_s2 = min(k_unroll, inter_dim_pad // K_per_ku_s2)).
So both stage 1 kernels expect the undoubled pad. Recheck these lines on an
AITER bump.
derive_aiter_quant_type(quant_config)
¶
AiterExperts._AITER_QUANT_TYPE for callers that bypass the subclasses.
inject_shared_expert_weights(topk_weights, topk_ids, topk, num_fused_shared_experts, shared_expert_weights=None)
¶
Merge routed topk results with the shared expert buffer and inject dynamic per-token shared expert gate values for AITER fusion.
For routers that already return the combined buffer (e.g. GroupedTopKRouter via rocm_aiter_grouped_topk), only the dynamic weight injection is needed. For routers that return only routed slots (e.g. FusedTopKRouter), this also copies the routed results into the pre-allocated combined buffer.
mxfp4_w4a16_extra_kwargs(quant_config, moe_config)
¶
AiterMxfp4Experts._extra_fused_moe_kwargs for callers that bypass it.
rocm_aiter_fused_experts(hidden_states, w1, w2, topk_weights, topk_ids, moe_config, quant_type, activation=MoEActivation.SILU, apply_router_weight_on_input=False, expert_mask=None, quant_config=None, a1q_scale=None, num_local_tokens=None, output_dtype=None, moe_sorting_dispatch_policy=0, gate_mode_override=None, bias1=None, bias2=None, q_dtype_a=None, shared_w1=None, shared_w2=None, shared_w1_scale=None, shared_w2_scale=None, shared_expert_id=-1)
¶
ROCm AITER fused MoE expert computation.