TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
9 ~; C% Q$ q n
在论文里,这是第3.2.2节的内容$ F& z$ v( { A6 T& p
, L- G! w0 C6 x$ U1 Y$ s% _- Y
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
5 G# Q. H) Z N4 qIn order to ensure sufficient computational performance for DualPipe, we customize efficient8 f. I1 _+ q3 _( y5 `* B3 O
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
" L, q0 V6 \& F. j( rthe 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,+ A6 C0 s( j' ~, r3 ]
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
8 k5 q5 t) D. \( R; }are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB* h. a |* u1 s' g
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
4 y& K! J0 x1 g! U R) Jtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
4 B4 X% L% I0 v) Mrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node# @7 F: ]4 s& h+ A2 {/ Q2 K, a
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
2 i# h) m n. h n0 g6 o- Finstantaneously forwarded via NVLink to specific GPUs that host their target experts, without# u! L3 |9 R7 O% v, [9 l+ {" ?
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink: I5 [9 d5 ^) }2 Q/ |
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
4 f! _6 F7 L0 O' Z! X. {( m. nwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
3 {. Z3 D& N% z+ s4 g. @( Q13" \* l8 ?2 E; U# I8 r) s0 w
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts$ E( ]7 x+ u2 c( q
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
# E6 q6 Q4 n+ D8 I/ xsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
4 V) ~" O. _, R( F; sand NVLink.5 m2 \# J" S0 {% E
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition' B$ g+ W9 R3 [0 r q* K0 t: ?: b
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
8 s7 s X: U, Y' }7 LIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
* K! k! {9 U6 r# ^number of warps allocated to each communication task is dynamically adjusted according to the
$ d; ?: N# E8 G0 v9 r( @% A0 nactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,; Q! s4 L2 \7 n8 i3 x
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also, x9 G/ g' w; U; [
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels2 [( k w: g9 v' ~/ q
overlap with the computation stream, so we also consider their impact on other SM computation
" K3 E9 \! `' g1 pkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and0 `5 X7 |2 h$ c, w- V
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache; x8 y& A3 V. Q0 u0 w* H
and the interference to other SMs.$ ?& A0 A; d: o) ]& i$ B
, |% U4 ^/ l1 T0 S: s' d" z/ g
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。2 y" {$ ?- ^1 H# T+ j& n. p
9 t4 Q/ X/ I7 h; t2 d$ c我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
! u# o4 r: L/ G0 i) k" `9 Q* r" R4 n o$ L* d- W z9 M6 Q% [
目的不是为了绕cuda,反而是为了让cuda的效率更高。6 A( h6 N1 L% a X+ Y/ f7 }
0 s5 q) T2 _* |; D/ y, A4 X ~+ k% y类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|