TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
6 A5 R& f$ s+ D" Y& l& ]( m. ]在论文里,这是第3.2.2节的内容* ]7 Q8 D: S+ g1 c8 | I
5 L8 |# w- y7 q2 i2 e9 {3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
* h: B0 k( w; X4 y( u# tIn order to ensure sufficient computational performance for DualPipe, we customize efficient! p1 g! b; ]1 J
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
9 Q' ~6 \/ |2 U$ e, c# }% g! i/ w+ 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,) h/ d& m, Q! a1 ?, p0 A
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
1 F4 N* K; q" Nare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB n' ?8 L8 @5 u; \: {2 ^3 @
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
+ N1 W8 v5 |5 [$ i! j- ^token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its4 x, \" \0 b* H! @9 U
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
! t4 V# z+ h3 W( V( u6 P, Rindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is! s% Y" v% H8 Z- z) P
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
; F0 i/ |* y4 A& sbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink4 t- |7 @, ^: O/ T
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node. b3 w1 H+ |' l, u3 e4 h4 o' W
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3$ m1 i& q) R9 P
13! V7 O6 [- h7 \' [. S
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
) v8 e6 y6 K: l(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under2 [7 l* e% b% L# {
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
5 W& D% ^5 ?) C0 band NVLink.5 m6 Q" g+ P( [+ l
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
: A1 k" u( ^& H# r! d* r; Q) t& r20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)8 F/ s* A7 ]4 w; V9 ]; J4 ~/ W
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
4 Y4 W" I( t7 E4 C* w' C9 lnumber of warps allocated to each communication task is dynamically adjusted according to the
; [! |$ l( f6 r" _actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,1 c& f3 z1 E* l9 p& `% h" c+ z
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
4 H& X' R+ q/ H1 P+ o# S/ O+ c8 Vhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
' K' @: D9 J \, m$ Q; r/ ioverlap with the computation stream, so we also consider their impact on other SM computation
& Q1 V" I4 e4 G! l: Okernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and' r6 g6 P/ A& x& N- z* R7 ]$ v
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
$ A ?+ J5 f( c. V/ \( \and the interference to other SMs.8 G6 z3 Z0 ?% _4 M% }3 r7 z7 m @
9 E9 j' K3 X7 @$ |) x/ t% f
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
2 m, v! }5 z4 y% v' p9 W
8 G2 W' g; ~1 i( N1 ]我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。/ g$ `% D. y* e# s
& N3 v+ l0 ]; |1 K6 ]- S2 O
目的不是为了绕cuda,反而是为了让cuda的效率更高。8 x5 N3 t0 X. {* c
b3 K `5 U: H3 C/ a F; s8 y类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|