TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
- G* J7 G7 R; V2 o, F+ l# B在论文里,这是第3.2.2节的内容
, K- m2 K3 I* ^. ~, E' D) D0 o" \
/ [. O9 E9 |3 O6 h0 H- I; W3.2.2. Efficient Implementation of Cross-Node All-to-All Communication. ]1 U! _. S* A6 P% @ K( k
In order to ensure sufficient computational performance for DualPipe, we customize efficient
4 I; L/ L& i, V+ Tcross-node all-to-all communication kernels (including dispatching and combining) to conserve' e5 A l& j- c! U5 H4 \
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,
1 [1 k9 m$ X2 p3 w( Zin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
$ \2 \- T- o5 l( h mare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
6 z4 A' _7 {6 Z(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
: M! l. p1 m1 Y: U9 Otoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
6 `) A4 G4 ^& e% D4 vrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node+ W3 t, h `8 U$ U, m
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
- g# G. b' t3 t7 [2 Binstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
& {) J1 O ?5 Obeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
; @1 d" F9 s' u3 E$ G$ O" W$ Dare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
^' E. c2 n% s) M" H5 iwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
2 l5 W X- b8 g13* T' v4 T5 e# A! P& ~
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
C' ^9 t3 R. q4 Z3 ]# N(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
" O2 P# S. K1 C( X/ Q' C) j! L& [3 zsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
9 V, A# A/ e# ^' ~1 N$ vand NVLink.; T6 K% r; L6 l+ Y$ ^
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition% f8 w( y+ `+ @( U4 H ? @: `
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
2 P1 z5 Q$ @, G5 R* f' M, wIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
e1 [; L X& e& Znumber of warps allocated to each communication task is dynamically adjusted according to the b# N9 F' T8 u
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,( e9 \, `2 E& a& M+ v7 h- ]
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
, R/ c7 q" [1 m8 Bhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
5 i' K" N+ J8 o' a2 o6 Q( ~; Eoverlap with the computation stream, so we also consider their impact on other SM computation
* G0 y5 n& q" C( a4 n, M+ Z! l) ykernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
8 w; ]( R( m# g. zauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
4 o1 D6 O0 U* x' N0 d. rand the interference to other SMs.3 s: N ~2 H" [7 ]% O
2 g, t3 r. t! |* S2 ?! k& v通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
! s Q z% V |& l0 {
2 q- j' v0 R/ ~4 s- G, f, ]我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。( F: C+ F3 P/ h5 g2 D2 K& }
$ j) [% [1 J6 }3 f
目的不是为了绕cuda,反而是为了让cuda的效率更高。1 a) D" A( Q& C; W% B# h3 G; z
0 X! X, K7 E8 ^7 z, P7 i
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|