perf(moe): route fused_topk through the in-repo triton router - #319
Merged
Conversation
The triton_kernels branch is gone: fused_topk_softmax is faster at every shape measured on H100 (2.4-9.5x vs triton_kernels.topk, 6-17x vs pure torch, CUDA-graph GPU time), works for any k, and needs no undeclared optional package. Slot order for power-of-2 k now follows the descending-weight convention instead of triton_kernels' ascending expert id; downstream expert compute sums over the k slots, so the routing decision is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
fused_topknow always callsfreetoken.kernel.triton.moe_router.fused_topk_softmax. Thetriton_kernels.topkbranch and the pure-torch fallback dispatch are gone, along withis_triton_kernels_installed()and its warning._torch_fused_topkstays as the reference the router tests compare against; the runtime nolonger reaches it.
Performance
The dispatch order was inverted: the fastest implementation was the fallback branch.
Faster at every shape measured. H100 80GB, torch 2.11+cu130, bf16 logits,
renormalize=True, CUDA-graph replay (GPU time), us/call: