TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
( y, _+ C# c# b4 m4 ^; R1 b4 d在论文里,这是第3.2.2节的内容
( H; B$ H7 y q- x# g9 d( a7 L g2 d5 o* }* F U
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
6 l. r0 a- I: h7 U& @: H7 SIn order to ensure sufficient computational performance for DualPipe, we customize efficient
7 q2 ]0 y! M$ \! Q& m Ncross-node all-to-all communication kernels (including dispatching and combining) to conserve
3 H4 V" M# S# L; Uthe 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," D$ d: K( ~, p! X
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
: N% Y8 J7 G4 e; h2 _, j( `are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
0 G; r/ Z+ m0 b1 ^. y0 i) q9 Z5 y(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
, Q3 Y8 q- ?4 ttoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
( s- F; s; W) U& b, @routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node% ]5 Q% t& q4 f
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
3 y# X z7 g- s3 V% y' D/ e7 rinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
7 [5 b8 e1 g8 I Fbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
$ S, _+ |2 T! |9 {. l% Dare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
. F2 \ T+ c$ k/ \3 ?/ _) Dwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V39 j+ J/ T- z5 o; }0 ?, {. H: P6 R
13
7 U# K! n4 e1 R: a6 ~) H$ T0 gselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
* v$ T3 H0 Z" @+ a(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under' z4 Y$ d0 M3 q7 x! ~4 T9 w# |7 u
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
3 ]2 R0 f8 [5 D! y# @and NVLink.
& D" |4 B- ?) P6 aIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
. y* t/ b+ F/ p6 g20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
" J4 P- b: \7 _- K0 d& {* {4 uIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
- D8 A# b, _1 i. Q0 G' ^# pnumber of warps allocated to each communication task is dynamically adjusted according to the
8 T5 S6 Q( [" {* l7 _- @- gactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
$ M$ z' b+ k5 O, g(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also% q; v4 B) G7 Z! `3 M1 t, j( @
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
% r9 l. L0 j) D- C1 X/ ]1 H( @overlap with the computation stream, so we also consider their impact on other SM computation5 U6 H5 }5 H' P( x* h
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and5 m$ k$ x O5 r* k+ e
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
& d* U) P8 b6 Z8 Mand the interference to other SMs.8 h4 o0 V! T4 K2 R9 ]; X0 ]
+ M3 n( P- Q0 {7 Q0 h2 D) w通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
# @9 x0 c1 ?: r: z, D( M, z% [4 n4 z# T0 @2 k( M
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。5 m) k V# a. Q" y- m) l! x1 I, Z) n6 N
7 u; T% r7 r8 O2 z; b
目的不是为了绕cuda,反而是为了让cuda的效率更高。" w4 \' `0 O: F' Z& v. U
* _" J9 b+ r' I$ Y( X8 ?类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|