Repository navigation
feat(moe): support more hidden and latent sizes in the fused MoE tail… - #52
Merged
lizhenyun01 merged 1 commit intoDec 2, 2026
Merged
Conversation
lizhenyun01
reviewed
Dec 2, 2026
| mma_f16_m16n8k16(g, a0, a1, a2, a3, xb[2 * mm], xb[2 * mm + 1]); | ||
| } | ||
| const float sA = scale_of(s.sfa, sb), sB = scale_of(s.sfb, sb); | ||
| const float sA = scale_of(s.sfa, sb); |
Collaborator
There was a problem hiding this comment.
看到比较多这样的改动,并没有改变实际代码但是换了写法,是必要的吗
Contributor
Author
There was a problem hiding this comment.
之前的代码规范不是很好,需要调整一下。
lizhenyun01
reviewed
Dec 2, 2026
| const uint32_t bw[4] = {B.x, B.y, B.z, B.w}; | ||
| #pragma unroll | ||
| for (int mm = 0; mm < 4; ++mm) { | ||
| uint32_t a0, a1, a2, a3; |
Collaborator
There was a problem hiding this comment.
是以什么标准做的规范呢 我看起来例如这种改动之前的代码似乎更简洁明了
Contributor
Author
There was a problem hiding this comment.
从可维护性,可读性来讲这样写会更好一些,方便调试。也没有那么绝对吧。
lizhenyun01
approved these changes
Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description / 变更说明
扩展 fused MoE Tail 内核在编译期支持的 Hidden(H)和 latent(L)形状。
TpSize × GroupSize个 chunk,编译期检查每个 chunk 的行数是 16 的倍数。这样每个 16 行 MMA tile 都落在同一个 128 行 Blockwise FP8 scale block 内,可以移除 Hidden 余数分配和 M 维 padding。Lg,对[L, Lg)的 activation 和暂存权重补零,并限制 scale 读取范围。Accuracy impact / 精度影响
生产配置
H=4096, L=2048, TpSize=4, GroupSize=32通过完整回归,运行python -m pytest tests/test_latent_moe.py -q得到 93 passed。扩展形状通过独立 TP1 Tail 测试与
MoERef.tail对比。下表为每组 6 个 token 数下的最大逐 token 相对 L2 误差,验收阈值为0.005。测试结果
Performance impact / 性能影响
完整 Fused MoE 延迟测试
1. 测试环境与配置
与 PR 基线对比
此前,H/L 扩展版本相对 PR 基线 A/B 测量结果为:
-0.02%+0.24%本组数据以已经包含 H/L 扩展和统一 tile 循环的版本为对照,主要衡量最后一轮 Round C 优化及 Scale 路径清理 对完整 Fused MoE 延迟的影响。
Checklist / 检查项
tests/test_latent_moe.py全部 93 项通过