Module ep_dispatch

Module ep_dispatch 

Source
Expand description

2026-09-25: Partition of top-k (token, expert) assignments into this rank’s experts and the other ranks’ experts, for EP token dispatch.

Its callers are MoeLayer::forward_ep_dispatch (moe/forward_ep.rs), which has no caller and serves through forward, and the glm53_ep_semantics test. The served EP MoE is masked-local plus all-reduce (moe/forward.rs).

Owner: model-layers (MoE). Invariants: none beyond the types.

Structs§

EpRoutingTable
2026-09-25: Top-k assignments split into a local bucket (expert in this rank’s range) and a remote bucket (any other expert). Entry i of a bucket is the triple (*_token_indices[i], *_expert_ids[i], *_weights[i]), in the order the assignments were given.

Functions§

build_ep_routing_table
2026-09-25: Build the table from row-major [num_tokens, top_k] expert ids and weights. An expert is local when it lies in local_expert_start..local_expert_end.