TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
# b) B, M/ O- _2 k6 p3 b* f
在论文里,这是第3.2.2节的内容
; L; V" \7 C# C# D
$ P) K: { I7 W& L! T+ q3.2.2. Efficient Implementation of Cross-Node All-to-All Communication* G, H* x: ^2 ~0 V: G, [2 C5 p
In order to ensure sufficient computational performance for DualPipe, we customize efficient( ~0 T$ B. c( R9 e. V* e, _
cross-node all-to-all communication kernels (including dispatching and combining) to conserve- d6 _+ \7 Y: {: v- f3 y) ^' K. a
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,, e, [ w2 J8 T6 v5 Q+ [3 ?7 }
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
, I* A3 K [, e# l! j$ h( {are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
, M/ N+ k7 x! d6 c9 h: d(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
+ W2 G6 k! C2 S) B3 Z; \1 [token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
/ L ?- R$ j* G1 grouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
1 H. i2 t; H% O7 vindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is4 s& L, \& g2 o
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without8 z) z1 E2 e' [$ ^- U
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
2 s& G) c( E% `3 i bare fully overlapped, and each token can efficiently select an average of 3.2 experts per node7 U8 q% n% I8 T8 Y
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3$ L( @$ h6 {2 x( b% O6 g4 N
13
. B; Q8 U4 D( {4 U3 l. \7 h# jselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
" J2 o% K% M' E. t3 L(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
; h5 f" d+ b7 Nsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
* y2 i6 ]& t# S4 V C; w! z. ?* uand NVLink.
7 G. N) c: z) b: [" h; PIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition/ _2 N2 J+ j" {; ?& r
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)6 b: b, |8 @7 c. U7 N7 e
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
7 g; d# j; e" \3 j- s$ q# i1 F$ Dnumber of warps allocated to each communication task is dynamically adjusted according to the
* @% h% I3 }+ u6 aactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,2 z) C# ^; p1 H6 o
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also5 k- \/ x9 {# D5 r2 Z* L
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
1 j. {7 h3 |; h- goverlap with the computation stream, so we also consider their impact on other SM computation% X+ \# `2 q, @) D8 [
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and O8 n: w! @1 D8 X8 I5 a; d- f
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache; N: {: w, Q$ }( u u
and the interference to other SMs.! m9 ~, D) O% S* E
) R) |$ i/ Z' v; s& q2 `通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
: K' W& ?8 ?- b; U6 R
. h/ D( a% m$ k# f; m8 d( ~我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。8 x* s1 V" c% m% k- a
6 Z" i8 ?: U" k& X' o8 D% d' d目的不是为了绕cuda,反而是为了让cuda的效率更高。
% j# m* C9 w0 Z6 \1 u! b' m% v6 h: g9 R E6 f
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|