Skip to content

feat(megamoe): support MXFP8 probability weighting and selective recompute - #6

Merged
davidhe91 merged 1 commit into
davidhe91:megamoe-ascend950-integrationfrom
dz-ssk:feat/megamoe-mxfp8-prob-recompute
Dec 2, 2026
Merged

davidhe91 merged 1 commit into
davidhe91:megamoe-ascend950-integrationfrom
dz-ssk:feat/megamoe-mxfp8-prob-recompute

Conversation

@dz-ssk

@dz-ssk dz-ssk commented Dec 2, 2026 •

Copy link
Copy Markdown

MXFP8 MegaMoE currently rejects before-FC2 routing probabilities and retains quantized activation storage that PanGu selective recomputation can discard. This adds the matching probability path and explicit saved-state replay options.

/kind feature

Changes

  • Support probability weighting inside the CANN SwiGLU/dual-axis quantization task, carry probabilities with Dispatch, and return probability gradients with the existing token completion protocol. Combine sums contributions without a second probability multiplication.
  • Add MegaMoeRecomputeOptions for routed input replay, routed activation replay, shared activation replay, and shared FC1 replay. Defaults remain disabled. FSDP replay resolves current weight roots instead of retaining gathered views.
  • Rebuild only column data/scales when restoring saved activations; preserve the CANN arithmetic and completion/event contracts. This avoids unused row-axis GM allocation/writeback, not all internal row-axis computation.
  • Version the MX native ABI to 7 and quantization descriptors to 3, lock the adapter patch, document the supported combinations, and extend CANN-oracle, EP2 lifecycle, and CPU regression coverage.
  • Fix standalone numerical-test evidence writing when no distributed process group is needed.

Rebased onto d045692 of megamoe-ascend950-integration, preserving PR #5's shared SwiGLU backward alignment and existing shared-SwiGLU/Stream-K regressions. Native payloads must be rebuilt for ABI 7.

Validation

  • Current rebased implementation: 393 CPU tests passed; the final new-file cleanup also passes its focused tests. Repository checks parse 310 Python files and verify all 17 locked patches; Markdown checks pass.
  • All five newly added Python files pass the repository Pylint hook. Whole changed-file Pylint and Lizard are not clean: remaining diagnostics include existing-module annotation/import findings and complexity limits in touched execution, graph, descriptor, and oracle functions. No lint checks are disabled by this PR. The repository label gate also awaits a CI-produced pipeline-passed label; no passing label has been manually added.
  • The feature snapshot before the upstream rebase passed a CANN 9.2.2 / PTA 2.12 Ascend950 native build/load, single-device CANN numerical oracle, EP2 push/pull replay tests, and an 8-device 20-step PanGu FSDP/Muon/MTP training acceptance. FP32 reductions use the existing rtol=3e-5, atol=1e-5; bitwise equality is not claimed for those reductions.
  • The 194 native build inputs still match that successful ABI7 build. NPU regression of the final rebased head is pending; previous device evidence is not final-head validation.
  • A separate EP64 full-training comparison of the pre-rebase snapshot is running with before-FC2 probabilities and matched selective-recompute flags. Native passed 100 steps (steps 21–80: 7.189 s mean, logged MFU 61.07%). The MegaMoE arm completed one step, then reported OOM allocating a 1.11 GiB NPU workspace with about 1 GiB free; its runtime records confirm routed permute/activation replay enabled and shared replay disabled. The run does not establish a performance gain or memory equivalence.

Shared FC1 replay currently uses standalone CANN calls before the fused backward launch. Input replay also adds Dispatch work; memory/performance trade-offs require measurements for the target model.

@dz-ssk
dz-ssk requested a review from davidhe91 as a code owner December 2, 2026 08:13
@davidhe91
davidhe91 merged commit 40a66d4 into davidhe91:megamoe-ascend950-integration Dec 2, 2026
1 check failed
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.

2 participants