Add moe topk softmax templated from vllm (#4302)

This commit is contained in:
Qingquan Song
2025-03-14 12:03:33 -07:00
committed by GitHub
parent 660305c38a
commit 61e4433caf
9 changed files with 716 additions and 6 deletions

View File

@@ -21,3 +21,14 @@ def moe_align_block_size(
token_cnts_buffer,
cumsum_buffer,
)
def topk_softmax(
topk_weights: torch.Tensor,
topk_ids: torch.Tensor,
token_expert_indices: torch.Tensor,
gating_output: float,
) -> None:
torch.ops.sgl_kernel.topk_softmax(
topk_weights, topk_ids, token_expert_indices, gating_output
)