TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
0 u1 Y6 q/ J- P7 q- \在论文里,这是第3.2.2节的内容( `4 v4 {) t# F& O
- \" @$ u; c3 |3.2.2. Efficient Implementation of Cross-Node All-to-All Communication( | M- i! T6 |. }% o9 @/ g0 A: I
In order to ensure sufficient computational performance for DualPipe, we customize efficient( ^1 s; Y2 u; ]. B1 F* R: o- A& o
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
& _' T% a8 s$ t( D5 cthe 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,
# w+ S, }0 f! o1 W2 xin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications2 q2 I2 l+ I! Z; R
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
( n* D& B$ m# \! l8 }& c(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each& P& C) ]' b5 ] P) m
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
' |+ F- d- c% A7 Qrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node9 E) W' s: @# _9 E9 }
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
( K& j! u4 g4 |. x. g) Z0 U) Minstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
( d/ I# L" P9 K: R# f% Q6 Gbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
9 t0 W9 Z0 i: lare fully overlapped, and each token can efficiently select an average of 3.2 experts per node) o* |5 y! @7 I; C8 n
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
& T l2 Z: O8 ?% Y, I' m13% h2 A' ?3 l9 F- I8 f" i. @. T7 g7 V
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts2 q; a9 c! Y4 I' c8 S
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
- B: u9 d5 l0 a* _5 b, G* usuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
+ f. m# z8 C8 _and NVLink.# V7 D' |/ D6 ?: P1 V& r0 _
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
% a* j0 |; X5 g; S20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
; N1 z/ q, n: aIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
6 u8 r% T/ ~1 j; W7 S1 ~" Znumber of warps allocated to each communication task is dynamically adjusted according to the
! k* W* s8 F7 G* Aactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,5 s* Y+ L3 Y; P3 y
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
3 |. g" u7 L& x3 u/ a$ P; nhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels, y" {! d1 c* w' D1 _
overlap with the computation stream, so we also consider their impact on other SM computation
3 Y5 }* P7 P3 j: Z$ \% `kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
) Y* N% v- C9 c3 L7 q$ |4 Qauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
: o: F4 u W+ @5 N* {and the interference to other SMs.
\# U- a v3 r& N2 {6 Q( u4 y) k9 n G! t# ]
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
) D- E6 h/ ]. I* [
9 t! R' f+ ^: X0 y我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
0 m1 e' T9 g3 B: K5 v
" T X/ G& Y: y6 q目的不是为了绕cuda,反而是为了让cuda的效率更高。4 D! Z) n# z9 E' R' t
" T# p- i8 R6 l% u) D2 Y$ x类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|