Files
DeepGEMM/MEGAMOE_SM90_DEV.md
2026-06-17 23:56:31 +08:00

45 lines
3.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SM90 MegaMoE 开发日志
## 2026-06-17 23:55:32 CST
- 对应 clean 工作 commit`1dafd0f17376d8730bebb472dc8e15d9645c6b52`
- 用户请求摘要:重做 Phase 1 接口/基础设施提交,保证它作为独立 clean commit 在线性历史中出现,并通过远端测试。
- 本次提交的核心改动:
- 新增 SM90 MegaMoE host API`get_symm_buffer_size_for_sm90_mega_moe``get_token_alignment_for_sm90_mega_moe``fp8_mega_moe`
- 新增 SM90 MegaMoE JIT heuristics、runtime launch glue、scheduler 和空 kernel stub。
- Python MegaMoE wrapper 支持按当前 CUDA device 区分 SM90/SM100SM90 使用 `(1, 128, 128)` recipe 和 float SF 路径。
- SM90 symmetric buffer Phase 1 接口返回 8 个常规 view`x``x_sf``topk_idx``topk_weights``l1_acts``l1_acts_sf``l2_acts``l2_acts_sf`
- 新增 Phase 1 smoke 测试脚本:`megamoe_dev_test_scripts/phase1/interface_smoke.py`
- 更新 `AGENTS.md`,记录 phase 测试脚本提交规范、开发日志规范和 60 秒左右 timeout 规则。
- 更新 `MEGAMOE_SM90_DESIGN.md`,将 Dispatch 与 L1 TMA/WGMMA 拆成独立 phase。
- 关键文件列表:
- `AGENTS.md`
- `MEGAMOE_SM90_DESIGN.md`
- `csrc/apis/sm90_mega.hpp`
- `csrc/jit_kernels/heuristics/sm90_mega_moe.hpp`
- `csrc/jit_kernels/impls/sm90_fp8_mega_moe.hpp`
- `csrc/python_api.cpp`
- `deep_gemm/__init__.py`
- `deep_gemm/mega/__init__.py`
- `deep_gemm/include/deep_gemm/impls/sm90_fp8_mega_moe.cuh`
- `deep_gemm/include/deep_gemm/layout/mega_moe.cuh`
- `deep_gemm/include/deep_gemm/scheduler/sm90_mega_moe.cuh`
- `megamoe_dev_test_scripts/phase1/interface_smoke.py`
- 详细开发流程:
- 本地从原混合 Phase 1/Phase 2 commit 回退到 Phase 0 基线,保留工作区改动并重新拆分 commit。
- 本地将 SM90 kernel 降到 Phase 1 空 kernel stub仅保留 ABI、JIT 模板参数和 launch 静态检查。
- 本地将 `get_symm_buffer_size_for_sm90_mega_moe` 降到 Phase 1 接口,返回 8 个常规 buffer views不暴露 Phase 2 dispatch 内部状态。
- 本地新增 `megamoe_dev_test_scripts/phase1/interface_smoke.py`,验证 SM90 buffer views、float SF dtype、weight transform 和空 kernel launch。
- 本地静态检查:`git diff --check``python3 -m py_compile megamoe_dev_test_scripts/phase1/interface_smoke.py`
- 远端同步:`rsync -avR AGENTS.md MEGAMOE_SM90_DESIGN.md csrc/python_api.cpp deep_gemm/__init__.py deep_gemm/mega/__init__.py deep_gemm/include/deep_gemm/layout/mega_moe.cuh csrc/apis/sm90_mega.hpp csrc/jit_kernels/heuristics/sm90_mega_moe.hpp csrc/jit_kernels/impls/sm90_fp8_mega_moe.hpp deep_gemm/include/deep_gemm/impls/sm90_fp8_mega_moe.cuh deep_gemm/include/deep_gemm/scheduler/sm90_mega_moe.cuh megamoe_dev_test_scripts/phase1/interface_smoke.py g0034:/mnt/beegfs/lxy/DeepGEMM/`
- 远端 build`ssh g0034 "docker exec sglang-lxy bash -lc 'cd /mnt/beegfs/lxy/DeepGEMM && timeout 60s bash develop.sh'"`,通过。
- 远端 single-rank smoke`ssh g0034 "docker exec sglang-lxy bash -lc 'cd /mnt/beegfs/lxy/DeepGEMM && timeout 60s python3 megamoe_dev_test_scripts/phase1/interface_smoke.py'"`,通过。
- 远端 2-rank smoke`ssh g0034 "docker exec sglang-lxy bash -lc 'cd /mnt/beegfs/lxy/DeepGEMM && CUDA_VISIBLE_DEVICES=0,1 timeout 60s torchrun --standalone --nproc_per_node=2 megamoe_dev_test_scripts/phase1/interface_smoke.py'"`,通过。
- 测试结果和已知问题:
- Phase 1 build 和 smoke 测试均通过。
- single-rank 仍出现 PyTorch symmetric memory warning`cuMulticastCreate failed with: "invalid argument"`,当前不影响 smoke。
- Phase 1 kernel 是空 kernel不产生 dispatch/GEMM 输出正确性只覆盖接口、buffer views、JIT 编译与 launch。
- 后续待办:
- 在线性历史中继续提交 Phase 2 dispatch-only 实现。
- Phase 3 开始实现 L1 TMA + 单 tile WGMMA并增加 accumulator/reference 对比。