vllm.model_executor.layers.fused_moe.router.fused_topk_router
¶
Classes:
-
FusedTopKRouter–Default router using standard fused top-k routing.
Functions:
-
dispatch_topk_softmax_func–Pick the softmax top-k implementation for one launch.
FusedTopKRouter
¶
Bases: BaseRouter
Default router using standard fused top-k routing.
Source code in vllm/model_executor/layers/fused_moe/router/fused_topk_router.py
_compute_routing(hidden_states, router_logits, indices_type, *, input_ids=None)
¶
Compute routing using standard fused top-k.
Source code in vllm/model_executor/layers/fused_moe/router/fused_topk_router.py
_aiter_topk_gating_supported(topk_weights, topk_indices, gating_output, num_shared_experts, shared_expert_scoring_func)
¶
Whether AITER's topk_gating can serve this softmax top-k launch.
It needs contiguous gating rows and at most _AITER_TOPK_GATING_MAX_TOKENS
tokens. Fused shared experts are scored with sigmoid after the routed
top-k: 1, 2, 4 or 8 of them, with topk_weights and topk_indices
sharing a row stride and topk_weights wide enough for the shared
columns. Shared expert ids stay as the caller prefilled them.
Source code in vllm/model_executor/layers/fused_moe/router/fused_topk_router.py
dispatch_topk_softmax_func(use_rocm_aiter=False, *, topk_weights=None, topk_indices=None, gating_output=None, num_shared_experts=0, shared_expert_scoring_func='')
¶
Pick the softmax top-k implementation for one launch.
On ROCm with AITER, topk_gating is chosen on gfx942 and gfx950 when the
launch described by the tensors and shared-expert arguments is one it supports;
every other AITER launch uses the legacy topk_softmax. The tensors are
optional: without them the launch cannot be judged and the legacy launcher
is used.