Skip to content

fix(megamoe): align MXFP8 shared SwiGLU backward with PanGu - #5

Merged
davidhe91 merged 1 commit into
davidhe91:megamoe-ascend950-integrationfrom
forever-moe:shared-experts-swiglu-quant
Dec 2, 2026
Merged

davidhe91 merged 1 commit into
davidhe91:megamoe-ascend950-integrationfrom
forever-moe:shared-experts-swiglu-quant

Conversation

@forever-moe

Copy link
Copy Markdown

/kind bug

Summary

修复 Ascend 950 MXFP8 融合共享专家的 SwiGLU 反向量化与 PanGu Native 的逐 bit 差异。原实现对无 clamp 的共享专家选择 dense worker。PanGu Native 使用 SwigluBackwardGroupQuantWithDualAxis(group_index=None)。两个实现的 FP32 乘法顺序不同,舍入差异会进入 dU 的 FP8 数据,并传到消费 row 数据的 dX 和消费 col 数据的共享 dW1。

共享专家的任务描述符改用已有的 grouped 双轴 worker。无 clamp 和带 clamp 分别选取其对应特化。修复可复用现有 native 制品和 descriptor ABI。

将触发问题的 4K 形状收进现有 PanGu 单卡回放,覆盖无梯度前向、训练前向和梯度。EP2 Stream-K 用例也切换到 PanGu 的 grouped 参考。

Evidence

  • Ascend 950 EP1 4K 每 rank 4096 token,hidden 7168,中间维度 2560,FP32 partial dW。旧 selector 下,融合对拆分的 dX 有 4,740 个不同字节,共享 dW1 有 32,017 个不同字节。使用同一份 native 制品切换到 grouped 后,融合对拆分、融合对全 Native、拆分对全 Native 均通过 8/8 项逐 bit 对照。收编后的用例临时恢复旧 selector 时,仍能检出这两处差异。
  • Ascend 950 EP1 129 token 使用 native dW 和阶段优先调度,三组对照共 24/24 项逐 bit 一致。
  • Ascend 950 EP2 Stream-K Push 和 Pull 各 84/84 项逐 bit 一致,覆盖动态 token、单 rank 空 token 和 tiling 失败恢复。
  • Host MegaMoE 与 scheduler 共 324 项测试通过,仓库检查通过。

本地设备验证使用 CANN 9.2.0。集群 CANN 9.2.2 的 64P 原训练作业仍待复验。

Merge Danger

改动范围为 Ascend 950 MXFP8 共享专家的 SwiGLU 反向量化与对应回放。可通过回退本 PR 的单个提交恢复原行为。

@forever-moe
forever-moe force-pushed the shared-experts-swiglu-quant branch from 601f11f to 4efd129 Compare December 2, 2026 03:17
Use the grouped dual-axis worker for the unclamped shared SwiGLU
gradient. Match PanGu's multiplication order before MXFP8 quantization
to restore bitwise agreement for dX and shared dW1.

Preserve the existing PanGu replay defaults and add explicit 4K
SwiGLU and Stream-K regressions to the same entry. Keep the CANN
extension in the standalone replay and exercise EP2 scheduling,
empty ranks, and tiling recovery through the existing test launcher.
@forever-moe
forever-moe force-pushed the shared-experts-swiglu-quant branch from 4efd129 to 38348ae Compare December 2, 2026 03:25
@davidhe91
davidhe91 merged commit b53766c 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