Skip to content

feat(metax): add moe_align operator for MoE token alignment - #991

Open
rubik-hua wants to merge 1 commit into
InfiniTensor:masterfrom
rubik-hua:metax_moe_align
Open

rubik-hua wants to merge 1 commit into
InfiniTensor:masterfrom
rubik-hua:metax_moe_align

Conversation

@rubik-hua

Copy link
Copy Markdown

Implement token alignment operator on Metax backend for Mixture-of-Experts.
Given top-k expert assignments (topk_ids), sorts tokens by expert index,
computes per-expert token counts with block-size aligned padding, and
produces sorted_token_ids, expert_ids, and num_tokens_post_padded for
downstream grouped GEMM dispatch. Supports optional expert_map for
expert remapping.

编译core
image
单元测试
image

模型验证:
python examples/test_infer.py --device metax --model=/data/rubik/models/Qwen3-30B-A3B-Instruct-2507/ --enable-paged-attn --tp 2 --disable-prefix-caching --prompt "who are you"
image

  Implement token alignment operator on Metax backend for Mixture-of-Experts.
  Given top-k expert assignments (topk_ids), sorts tokens by expert index,
  computes per-expert token counts with block-size aligned padding, and
  produces sorted_token_ids, expert_ids, and num_tokens_post_padded for
  downstream grouped GEMM dispatch. Supports optional expert_map for
  expert remapping.
@rubik-hua
rubik-hua requested a review from a team September 18, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant