Draft
[WIP]MoonEP rank 去重使用同机 MTE 与跨机 URMA #2
szm_thomasAdd on 4 days ago
[WIP]MoonEP rank 去重使用同机 MTE 与跨机 URMA #2
Draft
szm_thomasAdd on 4 days ago
szm_thomas
szm_thomasCollaborators
4 days ago

目标分支为 review/dev-npu-urma-server-dedup,基线为 bec6185。
本版按连续 8 个 rank 对应一台服务器,沿用现有 num_sms、算子 launch
宽度和 QP 配置。

改动

  • Rank Dispatch 对有 P2P 映射的同机 peer 使用 MTE 搬运 hidden 并发送完成信号。
    向量路径批量搬运,标量路径及大行使用分块 MTE。跨机 peer 使用原 URMA PUT。
  • Rank Combine 归约时直接用 MTE 读有 P2P 映射的同机 hidden,跨机 hidden
    仍由 URMA GET 拉到本地 staging。数据就绪和缓冲复用沿用现有同步协议。
  • Rank URMA Dispatch 统一用逐 peer 的完成信号与 credit 推进。Planning 只在固定 8-rank 服务器域内
    交错分配热专家路由,每条路由的目标服务器、每个 expert/rank 的分配量及
    prefetch 计划保持一致。
  • Buffer(use_udma=True) 默认使用 rank 去重,.dispatch()、.combine() 按
    构造时保存的引擎配置直接进入新版 rank URMA 算子。Planning reference 同样按
    Buffer 的 Dispatch 引擎识别 URMA 路由。
  • peer 地址选择实现在 Dispatch 和 Combine 的 .cpp 文件。仓内验证复用
    bench_vs.py 和现有 Planning/Dispatch 测试。

验证结果

使用目标分支的 SHMEM 1e1c4ab5 构建 A5。已完成 Python 语法检查和
8/16/32/64/128/256 rank 的 CPU 路由与分配量检查。

下表为 7f0955c 的实测。基准使用 BF16、H=Hp=1536、K=16、E=512、
S=8192 tokens/rank、双 QP、
num_sms=32,测量最慢 rank 的往返 P50/P95。往返包含 Planning、前反向
Dispatch、两次 Combine 与两轮 UBMem Prefetch,省略 expert GEMM。

规模 基线 MaxVio 1 → 30 往返 P50 新版 MaxVio 1 → 30 往返 P50 新版增长
8P 18.149 → 19.773 ms 9.238 → 9.641 ms 4.4%
16P 15.412 → 19.309 ms 10.264 → 10.726 ms 4.5%
32P 14.920 → 22.188 ms 12.048 → 13.060 ms 8.4%

每组使用相同节点和路由哈希。Planning、前反向 Dispatch、Combine hidden/weights
和 BF16 逐元素求和均通过。8P 另以 S=65、K=4 检查公开 API 的标量路径。
使用 Buffer(use_udma=True) 构造后将 Dispatch 和 Combine 的进程环境
开关设为 0,四轮普通 .dispatch() 和 .combine() 都走 rank URMA,
hidden 和 weights 逐元素匹配。仓内 bench_vs.py 通过 8P MaxVio 30 的
Planning、前反向 Dispatch 和 Combine 校验。
64P 预检时第八台节点仍有 NPU 作业,本轮未启动。

仓内回归

复用 npu_patch/benchmarks/bench_vs.py 验证精度和单算子延时。往返 P50 表
采用固定路由的独立实验脚本和 Gloo 控制面。

git submodule update --init --recursive
FORCE_SHMEM=1 bash npu_patch/scripts/build_a5.sh

torchrun --nnodes="$NODES" --nproc-per-node=8 --node-rank="$NODE_RANK" \
  --master-addr="$MASTER_ADDR" --master-port="$MASTER_PORT" \
  npu_patch/benchmarks/bench_vs.py --engine urma --dedup-mode rank \
  --ip-port "tcp://$MASTER_ADDR:$((MASTER_PORT + 1))" \
  --hidden 1536 --hp 1536 --topk 16 --experts 512 --num-sms 32 \
  --maxvios 1,30 --verify --verify-stages plan,dispatch,combine --no-cudagraph --out "$RESULT"

每台节点各执行一次相同任务,NODE_RANK 从 0 连续编号。8P、16P、32P、64P
对应 NODES=1/2/4/8。在基线 checkout 和 PR checkout 分别构建并执行同一条命令。

likedislike
Merge blocked
szm_thomasszm_thomasCollaborators
4 days ago Modify description of pull request
szm_thomasszm_thomasCollaborators
4 days ago Pushed 1 commits:7f0955c7-refactor(npu): finalize the rank URMA schedule and Buffer policy
szm_thomasszm_thomasCollaborators
4 days ago Modify description of pull request
szm_thomasszm_thomasCollaborators
4 days ago Modify description of pull request
szm_thomasszm_thomasCollaborators
4 days ago Force-pushed 9 commits:a67d96ba-fix(npu): pin SHMEM to the multi-sync fix,d32a57e0-fix(npu): use PEP 517 for editable builds,a81f1872-fix(npu): pin SHMEM to the upstream multi-sync fix,525edbd0-feat(npu): add Ascend950 server dedup kernels and native bindings,30c16e74-feat(npu): expose server dedup through the Buffer API,d44ffb14-test(npu): validate and benchmark URMA server dedup,3afdca0b-fix(npu tests): preserve the SHMEM bootstrap process group,72980844-perf(npu): use MTE for rank traffic within each server,7d17cbed-refactor(npu): finalize the rank URMA schedule and Buffer policy
szm_thomasszm_thomasCollaborators
4 days ago Pushed 1 commits:1f46d6b5-refactor(npu): pass rank planning stripe control separately