TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
# F' q6 y$ V: L6 R+ }+ N在论文里,这是第3.2.2节的内容+ A( D- l* h: `5 ]( F+ ~3 [
* h! t! p1 ^3 R6 @6 R( B( n3 j9 y/ d: f r3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
# A4 W) y6 f, F0 Q* @: XIn order to ensure sufficient computational performance for DualPipe, we customize efficient$ r% A2 N; v1 |8 W: y; k3 I
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
5 d- H( D. U& b. N9 @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,: P! b' h! C8 |( ]9 Q- r, k
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications# m0 z1 m7 {( J$ A: S& a' N' k9 `
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
( K4 _1 j# k4 a+ }(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each& u2 D0 m, P8 ]& S
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
4 @, B- Y2 b( B9 O# u( srouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
" K) z# r8 }* m0 z h& q8 Pindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
- J0 s9 R U- W4 d5 n, L) H+ _instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
& i+ [) Z6 m# i0 Q8 c. z8 Jbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink5 l5 a. [8 n9 S8 b9 g
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node3 k/ y8 L4 Z5 N# a5 y' b
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
/ Y- m* S6 ?5 m" E8 p1 O6 d' D3 u13
' u3 a3 {3 W+ y" ^$ Cselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
1 k; ^6 [) p, ~5 ? n: G8 l; k) l, y(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
2 R. ]% U: `/ U ^7 h/ csuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB' D( E/ `: g! G! P& R
and NVLink.
r% X: N0 _. |9 ^& BIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition/ ]' I3 I" }. m! [ L q8 F# C
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)" i! }9 G" _; r: {/ z# l
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
$ i3 }) X" R; A# r/ w2 onumber of warps allocated to each communication task is dynamically adjusted according to the2 @8 K9 H8 D) B4 x5 P+ ~
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
& H0 j/ \% a9 F, F- l(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also/ s/ a0 B" s, s2 N( z6 d7 ?, L9 L0 _
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
. _6 _8 _0 N3 E- c/ ]1 Hoverlap with the computation stream, so we also consider their impact on other SM computation
3 D2 B6 w' B& s& M& zkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and9 E: W" H% T# C3 E
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache3 U% ^6 U3 N1 p# `2 T8 M
and the interference to other SMs.
0 J1 \/ t7 S: R7 c: Y- P& j; U! t( e! b5 Q
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
' t1 {* D! t$ r; g" p7 C) a: d- t) o# x: L0 i8 h
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。1 X1 L% G/ T: s; |
8 o, Y/ e/ G( m# A, s( k8 e目的不是为了绕cuda,反而是为了让cuda的效率更高。) A4 h1 a% `+ y5 p8 \
$ J$ Y2 _$ x, l3 c- ], t9 D y- h类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|