TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
: N I3 v( b- A' K3 R在论文里,这是第3.2.2节的内容
% Y% Q/ q% x/ p- {! p7 }2 \" X0 o: h! r5 w4 t' L: M# h; {
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication% V) S2 d1 v" Q: j
In order to ensure sufficient computational performance for DualPipe, we customize efficient
M* v; T* J! x! h; fcross-node all-to-all communication kernels (including dispatching and combining) to conserve+ \8 U y T' S- B3 _0 W7 [+ A
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,2 h/ k3 \2 k7 r/ s( T# c# ]
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications t3 \, e5 m; o
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB; U6 N/ c A {' e
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
$ m% t- a6 K* F" A( C& ^token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its% [- ~# T, v$ w/ b* d4 q3 Y" y& }5 E
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
% x# t/ x4 _5 X( S2 Z: A* k, ^index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is0 q& J" z8 C/ m5 D
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
) r$ S, p. I+ W% lbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
8 `* ^# ]8 {$ S& Fare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
0 Z4 q. j/ J% i3 p8 t, ]6 G& ~# N0 { Rwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3' X$ x' q% Q4 J+ ~1 M
13
U' t1 h" v( |7 X3 Pselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts( w4 t A' N( u! F
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under& r5 s9 {$ A6 W4 _( _
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
7 o3 x+ t( \: j0 |8 v4 @; Gand NVLink.
& u V& Y; i% J" ]In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
6 Q7 h: \) U$ N" C, |+ b( `! t20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)! v" k" a8 b9 f; t+ f
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The* N) ^* `$ ^$ k
number of warps allocated to each communication task is dynamically adjusted according to the6 N1 H' h+ R& W
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
& S4 I* R( R/ U z$ l) F1 V' j& g(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also* q' s E9 M' B; B3 `$ k
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels% A; F2 T4 W+ p0 Q
overlap with the computation stream, so we also consider their impact on other SM computation/ m3 T* V" O1 S6 \6 m& B& {/ u: y9 ~
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
* Y; Q, h- X, a7 i/ ^. fauto-tune the communication chunk size, which significantly reduces the use of the L2 cache m, a! c% G1 t8 d* {
and the interference to other SMs.
/ `$ ~- y2 J% g' Y3 o; |4 E0 E) \ G; P: _# I+ |
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
" i1 r; Y& b/ b% o6 j! K1 S: R" J. U7 a$ A$ Z7 @' @1 C9 m
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。7 \) Z2 V& U* \! P) U. u: F: |. T
! d" A" p; w n9 i5 I. ^& j6 r' l目的不是为了绕cuda,反而是为了让cuda的效率更高。
; D' q8 M5 c% v4 x. {0 D2 P
; d5 s$ D, P* |' l: X& Y" l类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|