TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
: o" Y/ M# \. U% |$ a( V8 W在论文里,这是第3.2.2节的内容
: j2 S3 M8 g+ G5 z, l6 A" Y& R
5 `/ I/ \" H, C+ l3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
9 N: b/ A" k3 A% v, C9 mIn order to ensure sufficient computational performance for DualPipe, we customize efficient/ r" l9 M' R" }6 R3 z/ j
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
% A3 L0 t& S9 e& s9 J" Kthe 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,
6 F5 P X1 D& _+ @in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications& m' o& M, P2 [
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
1 f2 J' T% Z6 }# O& b4 R(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
5 q! O; g( D" n! Ftoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its9 R; N' T- D. ^- I, M; c, U8 r2 P1 Q
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
8 m8 Z+ H8 m& K1 u" Z9 Kindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is+ L% r! R9 O y+ n5 Q- b
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without6 c" T/ N) r/ H. N
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
' {& i6 q! F" I! ?% g+ J d% M jare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
0 y/ }7 `; X3 Z- [1 m( xwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3! P9 h/ J! E9 h& k
13
/ F& E) t: i, D& oselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts3 C- ^+ y: U+ c6 e2 B) R' m
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
9 D/ I7 d1 o0 A. T* l4 t6 Z3 Wsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB4 c' a P/ T; e( m# Y2 w! e
and NVLink.0 [! C; g' G. q- P
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
" E: b- l6 c! ^ U2 `% B# Y20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
" p! m. O* M4 `7 wIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The3 U0 d( h4 O* R# _
number of warps allocated to each communication task is dynamically adjusted according to the
4 V) l6 V( x3 r zactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,9 H @5 N: v! s! a0 h- }# t, J/ h0 j
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also. ^, }5 ~: A3 W( f( h* C, h
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
( ~' |$ L i6 A* w. \2 A& ^overlap with the computation stream, so we also consider their impact on other SM computation
/ U. ?$ \! O& A" ~, P5 ikernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
& M5 _2 P1 }5 G* {) l4 c/ d4 r. sauto-tune the communication chunk size, which significantly reduces the use of the L2 cache" N2 S, n/ \! \
and the interference to other SMs.4 j$ P6 f) U8 n3 ^, X$ Y: ^
6 N, i7 L T' b' `/ S通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。- V% _% J6 t# y/ T: }
0 B- P r4 a t! O: n我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。& d# t8 m: `& [" i3 J3 B
- M4 K6 _9 H( O5 v: D. @
目的不是为了绕cuda,反而是为了让cuda的效率更高。8 h7 S6 Q2 h5 v- _+ {
: ~5 E* W3 Q" r! N类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|