TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
$ ?$ W$ S3 ]6 q ]$ ]1 `% C在论文里,这是第3.2.2节的内容
* J. ^7 W0 y4 V! ^' a" y. B7 O' D3 t+ m' a, X3 ~
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
& }( p; R- B8 r. wIn order to ensure sufficient computational performance for DualPipe, we customize efficient
. ~1 ~0 ~% ^: S1 O* ecross-node all-to-all communication kernels (including dispatching and combining) to conserve, q, d/ _9 Y- |/ 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,
. q- Z" q2 k6 v. s1 U d8 Fin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
! _1 C; v; g" w5 ^! F: vare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB, `6 q+ J8 z) G8 U) S5 A- ?& j7 U! w
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each4 R! T% \ R7 S0 ^* l
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its7 R3 i$ `; i3 Y0 ~+ b7 j1 m: Q
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node; `9 `8 @. C5 t0 [
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
5 a, @. R4 z. G1 a1 [5 E dinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without @% K# d9 p) P& ~6 \/ r
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink0 d" H: Q2 R8 {6 o8 P2 W$ h7 e
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
) g/ i; n9 h1 _+ ^: o/ x9 Y0 lwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V32 G3 I3 i7 i$ \! s- y$ g
13
* E+ g' C9 q5 h! U4 c/ r6 N% [: gselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts- |' L1 j# I( v# D/ S3 d0 f
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
. e m# U: G& l3 m7 Isuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
& a8 ]4 {: U4 |$ T+ Q- P' Band NVLink.
( C' o6 i6 ~" [% QIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition" ^* r; ]& m8 j3 w8 `
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
1 v( r+ }! H6 K% F$ \9 fIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
5 y* H5 D( W. q6 ^+ j( L! t! knumber of warps allocated to each communication task is dynamically adjusted according to the. n7 J& X: H9 U4 ]( t, W
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
9 t8 v- l, P3 |(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also8 X- }: d; j# t
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels8 h4 t' z! Q+ T5 T. a+ B
overlap with the computation stream, so we also consider their impact on other SM computation
) n5 l: H. Z/ ?0 s4 Wkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
7 M ?8 U$ }7 V9 H+ |, }5 W$ }) `; ?7 vauto-tune the communication chunk size, which significantly reduces the use of the L2 cache$ b6 X2 h+ j+ V4 g* ~6 r) I. k
and the interference to other SMs.( @# \& O* k* t3 G
8 b1 s, J; r. {) R9 [$ m通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。2 f7 N7 V( V7 g7 {6 H7 H
6 {( p' H p$ F0 d9 S: s我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。1 M1 A# n y( K1 x$ ] q! C- p& G5 R
3 F9 K+ }( I. c目的不是为了绕cuda,反而是为了让cuda的效率更高。
3 O/ G# U1 _! v* K& \" _2 x5 E0 D1 ^) w# L
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|