ref(upstream): FULL TREE — Deep-Spark xllm (1470) + ds_vllm csrc/models (703)

Replaces cherry-picked upstream_ref with complete source trees.

xllm/ — Iluvatar official C++ inference engine (15MB, 1470 files)
  Complete: kernels → layers → models → runtime → scheduler → api
  Excluded: .git, binary images, third_party submodule checkouts

ds_vllm/ — Iluvatar official vllm fork (8MB, 703 files)
  Included: csrc/ (ALL CUDA kernels), fused_moe/, qwen3_5 model, _custom_ops
  Excluded: tests, benchmarks, docs, examples (not needed for reference)

Critical call chains now fully traceable:
  MoE: moe_topk_softmax_kernels.cuh → ixformer.h → fused_moe.cpp → layer
  GDN: qwen3_gated_delta_net_base.cpp → qwen3_5_gated_delta_net.cpp
  Attention: ixformer.h → xllm_paged_attention → attention.cpp
This commit is contained in:
EX Engine
2026-08-10 02:53:54 +00:00
parent 9e4fb3712f
commit 002f9879b2
2179 changed files with 494021 additions and 79 deletions

View File

@@ -0,0 +1,17 @@
# EP并行
## 背景介绍
在部署DeepSeek-R1 671B参数规模模型时传统分布式部署面临、显存利用率低、通信开销大、硬件成本高昂等核心瓶颈因此需要引入ep并行。
+ 在同等资源下单张卡上的Expert越少可用于KV Cache的显存越多可Cache的token个数越多。
+ 因MLA的特性同等资源下TP Size越小冗余的KV Cache就越少可Cache的token个数越多。
+ 采用大规模ep并行部署可以将同一个expert的token计算集中到同一设备上提高硬件利用率
## 参数设置
+ dp_size设置Attention部分的dp规模大小默认值为1可设置为2的指数倍当dp_size不等于卡数时dp组内为tp并行.
+ ep_size设置MoE部分的ep规模大小默认值为1可设置为2的指数倍当ep_size不等于卡数时dp组内为tp并行.
+ expert_parallel_degree ep并行相关参数不开启ep时默认设置为0开启ep时默认为1此时为ep level1当ep_size等于卡数时可以设置为2开启ep level2.
支持 MLA 的模型会自动开启 MLA不再需要手动配置。
## 方案设计
+ 当开启ep时默认为ep level1此时attn与moe部分计算完成后通过All Gather全卡通讯将数据发送到下一阶段以64卡attn部分dp32tp2 moe部分ep32tp2为例执行流程如下
![Alt text](../../assets/moe_eplevel1.jpg)
+ 当ep_size设置为卡数时可以开启ep level2此时attn部分与moe部分之间通讯变为ALL2ALL只向需要的卡发送数据降低通讯量与通讯开销以64卡部署为例执行流程如下
![Alt text](../../assets/moe_eplevel2.jpg)