Conversation
- Optimize prepare_moe_input_small: parallelize token scatter across workgroups (1 WG per token row), cache topk_ids in SLM, and generalize fused small input prepare to all MoE datatypes (BF16, FP8, W4A16). - Relax n_experts % 8 == 0 constraint in Grouped GEMM dispatchers to support arbitrary positive expert counts. - Support 1D scalar scale tensor in _validate_fp8_weight_scale for compatibility with SGLang FP8 MoE. - Add unit test coverage for non-multiple-of-8 expert counts.
CaoE
force-pushed
the
ecao/moe_small
branch
from
September 10, 2026 07:28
421d4f3 to
a5f1b7a
Compare
…ert counts - Restrict prepare_moe_input_small for multi-token batches (num_tokens > 1) to models with num_experts <= 64 to avoid thread-0 serial loop overhead in the SLM histogram and prefix-sum phase. - Retain fused small prepare for all single-token decode cases (num_tokens == 1), where routing sort is handled entirely within private registers without traversing the expert count E. - Add unit test coverage in tests/test_moe_prepare_input.py.
CaoE
force-pushed
the
ecao/moe_small
branch
from
September 10, 2026 07:42
a5f1b7a to
c31c1eb
Compare
This branch has not been deployed
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.
Summary
Micro-benchmark: Input Preparation Stage Latency
Since the input preparation overhead accounts for a small percentage of the overall MOE, this optimization can typically reduce MoE time by up to ~5% for decoder M=1.