Draft
[WIP]MoonEP rank 去重使用同机 MTE 与跨机 URMA #2
szm_thomasAdd on 4 days ago
[WIP]MoonEP rank 去重使用同机 MTE 与跨机 URMA #2
Draft
Merged fromperf/npu-urma-rank-local-mteintoreview/dev-npu-urma-server-dedup
Merge blocked
4 days ago Modify description of pull request
4 days ago Pushed 1 commits:7f0955c7-refactor(npu): finalize the rank URMA schedule and Buffer policy
4 days ago Pushed 1 commits:7f0955c7-refactor(npu): finalize the rank URMA schedule and Buffer policy
4 days ago Modify description of pull request
4 days ago Modify description of pull request
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
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
4 days ago Pushed 1 commits:1f46d6b5-refactor(npu): pass rank planning stripe control separately
4 days ago Pushed 1 commits:1f46d6b5-refactor(npu): pass rank planning stripe control separately
目标分支为
review/dev-npu-urma-server-dedup,基线为bec6185。本版按连续 8 个 rank 对应一台服务器,沿用现有
num_sms、算子 launch宽度和 QP 配置。
改动
向量路径批量搬运,标量路径及大行使用分块 MTE。跨机 peer 使用原 URMA PUT。
仍由 URMA GET 拉到本地 staging。数据就绪和缓冲复用沿用现有同步协议。
交错分配热专家路由,每条路由的目标服务器、每个 expert/rank 的分配量及
prefetch 计划保持一致。
Buffer(use_udma=True)默认使用 rank 去重,.dispatch()、.combine()按构造时保存的引擎配置直接进入新版 rank URMA 算子。Planning reference 同样按
Buffer 的 Dispatch 引擎识别 URMA 路由。
.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。
每组使用相同节点和路由哈希。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 分别构建并执行同一条命令。