TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
0 X" l% f" m5 ?在论文里,这是第3.2.2节的内容% R4 Z8 n) l0 k; w2 l& B
5 a8 E( w9 j& i# Y$ f2 \- }
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication4 O" X$ K6 |* ]3 W7 N
In order to ensure sufficient computational performance for DualPipe, we customize efficient
# i7 s( l" q3 d$ P& r7 H, H i. a, Hcross-node all-to-all communication kernels (including dispatching and combining) to conserve( Q: q4 y- Z% k* c, g( T6 H
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,
: Z: k" i+ t$ Y/ g- Y5 win our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications( Y. Q# H7 @& R1 k2 O3 R: V, l$ s) n
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
4 I5 I/ L" J6 c4 f5 C, U) N+ B(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each2 U- X' X' m" {
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
5 ?9 i( \" R' m" B8 frouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
' t* \" |5 b- o: Y4 hindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
9 P X+ V+ N- X" k# \# g; binstantaneously forwarded via NVLink to specific GPUs that host their target experts, without i) R3 x, e/ b3 }7 `- e, T3 |) W9 I( Y
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
; u% G$ G+ u8 s! q4 ware fully overlapped, and each token can efficiently select an average of 3.2 experts per node
/ L8 J. u0 H6 c, I4 u" jwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
' o4 l$ x! G; A$ \+ x7 Y; Q& R+ [13
; T$ j8 p- U$ d4 h! M& `selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts+ u5 m; { i6 ], Z7 K3 }- L, L
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
! ^* H; U4 E& Y. k4 P% Vsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB4 l7 {% P! W6 @2 J# [
and NVLink.& T6 X! @8 N3 p6 X
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition5 v8 L; X/ `( o5 B1 l/ w( _0 M4 j
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
4 X& m, `1 U- D+ F' J2 QIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The$ P- G3 ]. U1 e7 j
number of warps allocated to each communication task is dynamically adjusted according to the' {( K. W& V% Y" w
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
5 |: E* X3 `& K- A: v8 |: {(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
. l% N3 Q2 q8 s0 p% t! }9 ^handled by dynamically adjusted warps. In addition, both dispatching and combining kernels9 E% ?0 f @1 X8 q1 o" Y
overlap with the computation stream, so we also consider their impact on other SM computation" I0 C7 s# \5 y9 a, m" M& B0 `
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
9 @! a2 L4 i3 Q7 j0 C4 l7 a; Q# cauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
2 q0 C' V0 \: X2 N) Tand the interference to other SMs.5 v8 X8 f) A Q
, U1 m" u9 [; }) \, P通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。! u6 p/ O% ~5 I
5 t- I* O- l) y& b4 i& o7 w8 e0 _我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
- c9 D5 }, i( ~2 o# p
/ e5 { P6 F5 P2 ^目的不是为了绕cuda,反而是为了让cuda的效率更高。. `" e* U+ E! b5 |5 G
4 y! c9 s! \& o/ D H" A& ?
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|