TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
% o0 [1 i" a9 }% S. @- Q
在论文里,这是第3.2.2节的内容- i" w6 j! S' @; }- `" d# a+ v& b) X/ Y
; p9 p7 ?- b. m, f r0 E
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
1 ^ k* ?) P* lIn order to ensure sufficient computational performance for DualPipe, we customize efficient
6 N5 N+ \1 Q. c7 R: k! ?( Fcross-node all-to-all communication kernels (including dispatching and combining) to conserve
: i! |( H% |& a7 Zthe 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,
) \3 k4 u6 ^9 [; Y% Z0 Nin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
9 k" u- j- W8 r( y( ~are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
1 f7 G/ L, Q- v8 J/ l$ f(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
0 E7 w2 Q4 j, n! \% o i1 D1 mtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
2 _ g9 a: }% [6 Grouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
1 f7 w7 T Y2 Z, `8 Xindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
4 c$ G2 {; y) l: q8 @# I, oinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without, W* _$ B g2 i% f0 k
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
' \3 n0 \" @$ x. h$ R! sare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
2 @6 v: P k# N( {7 hwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3. ~: b U0 j7 ]/ _) C: @
13
9 m9 ~9 G0 ^- O3 E' H' mselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
) m' P$ J5 @- s7 x5 R9 d( T8 W(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
5 [) ~; s. R/ y& ]* U2 C3 Tsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
) |3 D% [: F. Y4 ?: L: L0 }and NVLink.
) b: m, X- f/ M. Q4 s4 rIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
! H" h# J/ P! q- v: R C9 a( [- m20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)7 d/ o6 c( K( H( w5 T: ^9 w
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The# K! p' p5 H; e% r
number of warps allocated to each communication task is dynamically adjusted according to the1 J$ j$ e4 S+ h# \
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,& o* w' ?7 B: D9 w7 f" c2 \
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also" `4 R" D, ~- e2 }
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels0 k( V, p5 Q! d L
overlap with the computation stream, so we also consider their impact on other SM computation5 @/ F; ]! [, }' A
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
% s; |# H/ C- Z* rauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
! _6 k3 F9 x" w' Tand the interference to other SMs.
' M" ]( t' Q/ s& j9 c9 ~' u5 S2 G" J7 ~! y: t1 ]
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
+ f+ P0 ]7 g* w- Q+ d o0 }) K' _5 b9 t4 Q, u& V( p
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
! S7 \6 a5 j' U9 Y; u7 P/ n8 F/ P+ L$ R2 P6 k9 R( Y1 ^/ {. }
目的不是为了绕cuda,反而是为了让cuda的效率更高。
* Q( A) y/ ]# h7 u6 q- U# d: k
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|