TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
" k* S% f! R, Z) Q" d1 H! I
在论文里,这是第3.2.2节的内容
C* T: j5 r, M5 M1 f# s0 } {
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
, e( V* n7 n! }* xIn order to ensure sufficient computational performance for DualPipe, we customize efficient
3 `9 p- a+ Q& Lcross-node all-to-all communication kernels (including dispatching and combining) to conserve% E. \6 F P) X2 R) [/ k) t& P3 E8 c
the number of SMs dedicated to communication. The implementation of the kernels is codesigned with the MoE gating algorithm and the network topology of our cluster. To be specific,; z. G2 T6 w- N1 I) u$ M
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
! x+ \9 C' z& b9 D; ware handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB" q' D0 V7 ~0 k1 D/ Q
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each& i6 [+ {" v1 ~4 K* b" `( \6 b
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
1 C2 g1 V% P* V3 G. Srouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
, c7 K$ e4 @$ L5 B& oindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
8 ~1 T" b) H% |' e7 Ninstantaneously forwarded via NVLink to specific GPUs that host their target experts, without+ W; M' H7 j U) X3 G& d d
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
. Z8 c6 @! h8 b/ s" pare fully overlapped, and each token can efficiently select an average of 3.2 experts per node9 V9 v5 V) ^$ ?1 B; b+ u7 d( q7 D
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
) ^( _4 D' B! X2 H/ k/ `8 I131 s; N' _9 k) Z% y
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts s. `) B, r3 o4 p1 n* T2 ?2 h
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
% i3 X4 K1 T: e' Z" {such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
u4 ? N/ Q5 @/ F" S) pand NVLink.) `8 u+ G, G- G& {* y
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
' I) i! u4 @: ~6 L k20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)" q, Z3 R/ |) w& [) C8 S- N ~! H
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The. T8 e5 E8 c# F$ {3 e' L4 @& \
number of warps allocated to each communication task is dynamically adjusted according to the& s" e. E& r- B
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
3 K+ V) A0 i- z/ \4 s2 B" z(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also2 P% d- y" J+ p) C1 n+ @! ~; E
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
, e" C; O- ^2 Q- w' t. Toverlap with the computation stream, so we also consider their impact on other SM computation
$ d/ V! h7 @( p! J' \. Y9 T: Pkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and+ ?/ q) J4 e) p2 O$ H, `4 ^
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
1 I3 s# b1 c- ?! G7 h. eand the interference to other SMs.6 @2 b' G$ y' l; m A( z& O9 {6 |
# J+ m' P, w2 ^ U* L; Z: @
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
6 ^" z4 ]8 b: C) ^
! o6 H. o: ?: j/ Z4 p8 Y我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
0 q- i, j- U7 Z7 s: C* T9 d8 K1 K# M. `( N
目的不是为了绕cuda,反而是为了让cuda的效率更高。
# b$ y: g- Q8 ]! ]- `, n
4 n, R2 S9 Q U( H; @类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|