shishi d72dbff689 feat(pro6000): Kimi-K3 PD 分离部署(MoonCake RDMA)- 8 节点 P/D 双 profile + deploy_pd.sh 编排 + 文档
- 新增 P 组(prefill)/D 组(decode) deploy profiles(mooncake RDMA + 计算网 mlx5_0~3)
- 新增 experiments/pro6000/kimi3_pro6000_pd_rdma/ 编排脚本(mc-master+P+D+router)
- 关键修复: 必须关闭 PYTORCH_CUDA_ALLOC_CONF=expandable_segments
  (mooncake RDMA 注册 expandable GPU 段报 Bad address,GitHub #2511)
- 容器内升级 mooncake 0.3.12.post1(含 dmabuf 修复 #2035)
- docs/KIMI_K3_DEPLOY.md 新增附录 B,README 更新实验索引
2026-08-11 10:36:09 +08:00

90 lines
4.4 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.

# Kimi-K3 PD 分离部署MoonCake RDMA实验
RTX 6000Dsm_1208 节点 64 卡)上 Kimi-K3 的 **Prefill/Decode 分离部署**KV 传输使用 **MoonCake RDMA**(计算网 mlx5_0~34 链路 RoCE
## 背景与动机
PD 分离部署PD Disaggregation将 prefill预填充计算密集型与 decode逐 token 生成,访存密集型)拆分到不同节点组,是长上下文下提升吞吐/利用率的行业标准做法。本实验聚焦 KV 传输后端的选型验证与稳定部署。
### 为什么不用 NIXL
实测 NIXLUCX 后端)在 RTX 6000D无 GDR/GDAKI**VRAM 单次传输上限约 20MB**24/32/64MB 均报 `Input/output error``NIXL_ERR_REMOTE_DISCONNECT`),且 sglang NIXL 后端不做按字节分块(一次传输整个请求全部 KV连续负载下必断。根因UCX 依赖 GDAKIGPU Direct Async接口当前未启用`NVreg_RegistryDwords="PeerMappingOverride=1;"`)。详见飞书 wiki「Kimi-K3 部署手册」PD 章节。
### 为什么 MoonCake RDMA 可行
- MoonCake 走 **libibverbs 直连**(传统 GDR + dmabuf 注册),不依赖 UCX/GDAKI
- 实测跨节点 GPU 显存传输 **1GB 无压力**,连续 10×64MB 全部成功
- **必须用 0.3.12.post1**(含 dmabuf 注册修复 #2035;镜像自带的 0.3.11.post1 无修复)
### 关键坑(务必遵守)
1. **不能设 `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True`**
expandable_segments 分配的 GPU 段mooncake RDMA 注册报 `Bad address [14]`GitHub kvcache-ai/Mooncake **#2511**)。移除后 KV 注册 2376 条失败 → 0 失败。
2. **P 组先启动D 组后启动**prefill 需先注册 bootstrap
3. **容器内必须升级 mooncake 到 0.3.12.post1**wheel 在 `/data/flashkda_deploy/wheels/`profile 的 BOOTSTRAP 里已含 pip install
4. NCCL/GLOO 走计算网(`bond1` + `NCCL_IB_HCA=mlx5_0..3`),不要走管理网 bond0。
## 架构
```
┌───────────────────┐
client ──31000──▶ │ router (MiniLB) │ 174.1.60.5
└───────┬───────────┘
┌───────▼───────────┐
P 组 (prefill) │ 174.1.60.1~4 │ TP32×EP324 节点 32 卡
└── prefill 计算 │ 计算完产出 KV │
└───────┬───────────┘
┌───────▼───────────┐
MoonCake RDMA│ mlx5_0~3 (RoCE) │ 4 链路并行
└───────┬───────────┘
┌───────▼───────────┐
D 组 (decode) │ 174.1.60.5~8 │ TP32×EP324 节点 32 卡
└── decode 生成 │ 接收 KV 逐 token │
└───────────────────┘
mc-master (174.1.60.1:50051) MoonCake 元数据服务
```
## 使用
```bash
# 一键启动mc-master → P 组 → D 组 → router
bash deploy_pd.sh start
# 查看状态
bash deploy_pd.sh status
# 停止 / 重启
bash deploy_pd.sh stop
bash deploy_pd.sh restart
# 端到端验证router 入口,自动双发 P/D
curl -s http://174.1.60.5:31000/generate -H "Content-Type: application/json" \
-d '{"text":"Hello","sampling_params":{"max_new_tokens":16}}'
```
## 实测验证2026-08-11
| 测试 | 输入 tokens | 输出 tokens | 结果 |
|---|---|---|---|
| warmup | 6 | 16 | ✅ 200 OK |
| 中等 | 1680 | 512 | ✅ e2e 31.4s |
| 长输入 | 5280 | 256 | ✅ e2e 13.0s |
- P 组 prefill throughput ~112 tok/s5280 token 输入D 组 decode ~26 tok/s
- 两端 GPU 同步工作,**PD 分离链路完整跑通**
- 对比 NIXLMoonCake RDMA 处理长 KV 传输稳定,无 20MB 上限问题
## 文件
| 文件 | 说明 |
|---|---|
| `deploy_pd.sh` | PD 编排脚本mc-master + P + D + router 全生命周期) |
| `config.env` | 实验配置 |
| `deploy/profiles/pro6000/kimi3_pro6000_pd_prefill.env` | P 组prefill部署 profile |
| `deploy/profiles/pro6000/kimi3_pro6000_pd_decode.env` | D 组decode部署 profile |
## 参考
- 飞书 wiki「Kimi-K3 部署手册」PD 分离章节(七~十一章)
- GitHub kvcache-ai/Mooncake: #2511expandable_segments 注册失败)、#2035dmabuf 修复)、#351Bad address