TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
; d3 |$ e# a+ A8 k9 }: t* R
在论文里,这是第3.2.2节的内容) i T$ k) d- Z; Y+ J
- ^; v1 I5 }' L, a2 H1 L! c, n3.2.2. Efficient Implementation of Cross-Node All-to-All Communication* [3 O; R s* F. x Y$ g
In order to ensure sufficient computational performance for DualPipe, we customize efficient/ W4 @( v; c. K: w! C& w, H( F
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
* D. ^! N. Y, b; [. _+ Y* d. gthe 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,5 z: W# M+ e+ E. @. m% v
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
0 o0 ]" @% u; ]3 ^are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB7 e" }/ l/ @( w$ S
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each! B1 J; g) }7 M0 i% U: G- c4 H' Q
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its' K' }+ j2 K/ \1 E# v G/ J6 t! H
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
& q$ T( Q U& a( i+ Kindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is, h: N4 z' T3 i2 V' K3 o/ h7 y9 V
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
! G4 e8 n6 A' m/ rbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink0 a" k$ Y0 f: m" u) _
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
) t" A# u: W% n) iwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
3 O0 N3 g4 a! W8 I; c+ G13* K' W3 Z0 F* W
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts: O& m8 i2 X3 @ |: _( G6 M8 T
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
) X, p: N6 ~: e2 |such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB) g* s' u3 o w( s4 l# \- l2 [
and NVLink.
3 H4 U# G3 _9 Z( KIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
" l/ Q8 \; v5 \) q$ _3 P/ v9 y20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
2 p0 k7 G) A; q: U8 v" z% KIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
1 \8 v) X8 ?2 Q0 [' H1 u9 Z' Cnumber of warps allocated to each communication task is dynamically adjusted according to the
4 M" R% e5 Z' }1 R( ~actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,3 }# w( J2 o) |; B$ l2 L2 \
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
K6 d$ Z- O1 y6 U! `9 Chandled by dynamically adjusted warps. In addition, both dispatching and combining kernels; k2 Y* D* w1 F4 ~, q* E9 q) E
overlap with the computation stream, so we also consider their impact on other SM computation
* p3 _2 U! v# h/ f! u2 hkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and6 M, A) V& b- T6 S# v4 u& K$ Z
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache) v# k2 i* t; E1 [& \
and the interference to other SMs.' W2 U3 o5 z6 p8 m" x, p' Z
u& Z& z- p% C6 @3 O4 c$ g9 b
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。1 R- }; r, G5 T+ O% w/ r u
: m% l7 S a; p6 A2 q
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
0 b! ^( e9 {. g8 Q$ q/ [* y s0 a1 S4 D" T
目的不是为了绕cuda,反而是为了让cuda的效率更高。
" X! q7 u5 x4 T+ L) l6 C2 R0 c+ c* \$ L+ r9 O
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|