Skip to content

feat(megatron): specialize MoE mask-map permutation for MetaX - #160

Draft
lukatao wants to merge 1 commit into
flagos-ai:mainfrom
lukatao:kernelgen/metax-moe-permute-mask-map
Draft

lukatao wants to merge 1 commit into
flagos-ai:mainfrom
lukatao:kernelgen/metax-moe-permute-mask-map

Conversation

@lukatao

@lukatao lukatao commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Use block-local expert counts and a separate Triton mapping and copy pass on MetaX. Preserve the existing row-map order, padded and probability outputs, and the empty-input return contract, including zero hidden width.

Validation

  • MetaX C550, MACA 3.8.1.3, PyTorch 2.10.0+metax3.8.1.0 and Triton 3.6.0.
  • Verified the public FlagTrain dispatcher selects the MetaX implementation.
  • 35/35 correctness cases passed. All 24 benchmark workloads matched the existing Optest H800 native data, with a 10.02× geometric mean of per-workload normalized speedups.
GEMS_VENDOR=metax pytest -q tests/megatron/test_moe_permute_mask_map.py
GEMS_VENDOR=metax pytest -q -s benchmark/megatron/test_moe_permute_mask_map.py \
  --mode kernel --base-data "$H800_JSON" --warmup 3 --iter 12

Signed-off-by: taooo <gumptao2997@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant