Skip to content

vllm.model_executor.layers.fused_moe.router.fused_topk_router

Classes:

Functions:

FusedTopKRouter

Bases: BaseRouter

Default router using standard fused top-k routing.

_compute_routing(hidden_states, router_logits, indices_type, *, input_ids=None)

Compute routing using standard fused top-k.

_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 or sigmoid 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.

dispatch_topk_sigmoid_func(use_rocm_aiter=False, *, topk_weights=None, topk_indices=None, gating_output=None)

Pick the sigmoid top-k implementation for one launch.

On ROCm with AITER, topk_gating is chosen on gfx942 and gfx950 when it supports the launch described by the tensors; every other launch uses vllm_topk_sigmoid.

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.