Skip to content

feat(megatron): specialize in-place MLA RoPE for MetaX - #159

Draft
lukatao wants to merge 1 commit into
flagos-ai:mainfrom
lukatao:kernelgen/metax-fused-mla-rope-inplace
Draft

lukatao wants to merge 1 commit into
flagos-ai:mainfrom
lukatao:kernelgen/metax-fused-mla-rope-inplace

Conversation

@lukatao

@lukatao lukatao commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserve the no-PE prefix for dense MetaX inputs with a non-unit last-axis stride. The Triton kernel uses the actual source and destination strides and preserves both the in-place public API and reverse rotation for autograd.

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.
  • 33/33 correctness cases passed. All 24 benchmark workloads matched the existing Optest H800 native data, with a 8.50× geometric mean of per-workload normalized speedups.
GEMS_VENDOR=metax pytest -q tests/megatron/test_fused_mla_rope_inplace.py
GEMS_VENDOR=metax pytest -q -s benchmark/megatron/test_fused_mla_rope_inplace.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