TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
: d1 F1 a) q/ Y0 H# n% J
在论文里,这是第3.2.2节的内容
# W s) T$ F" ?7 E! Z
% L. c1 y1 t- n7 u, B3.2.2. Efficient Implementation of Cross-Node All-to-All Communication& j. U5 Y9 C/ V' x8 a9 o
In order to ensure sufficient computational performance for DualPipe, we customize efficient
, B2 @7 E; z, o- f6 N* ?cross-node all-to-all communication kernels (including dispatching and combining) to conserve
* e& B4 P9 U0 athe 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,+ w& O8 S) F7 F9 |3 E
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications4 i% A9 W3 b. t
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
3 R% }! F$ v! P0 h(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each$ N3 z3 o" R' m8 L3 [" H
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its8 [% L) O3 G2 D* D
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node4 ?0 Q2 d/ L" V2 O3 R7 S( n
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
( a- E1 R/ |& \7 Pinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
1 d4 U \& f: ^2 O6 g- I3 Q; Fbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink, i/ b' ]. o' }
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node% g+ F/ @) g* ~- @: M
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
0 n1 Z- }( _6 f h: |( u! u, t13, ]' c; g {4 J, W: G
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
6 a+ B( Q3 r4 e(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
0 r4 z: ]2 N; Q) ~1 r; n8 t. |such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
) a! w& N7 k, U0 ?: t1 aand NVLink.' m+ Z: l; O) X# B. n$ |
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition( a7 k/ H4 h" u: X$ \: S
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)- m: i3 W) }( R" g
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The: S: M$ \: }/ j4 o2 c
number of warps allocated to each communication task is dynamically adjusted according to the: }2 K" }2 y" Z' L
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,7 ]) a, g$ T1 x' g b
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also' K) [% |) w+ e9 U4 g
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
6 C/ C9 y" L# p$ O: y6 W$ K4 coverlap with the computation stream, so we also consider their impact on other SM computation8 d8 S9 @+ H, J; J6 |9 a
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and8 ~% k- a9 q3 {4 T2 ~; E
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
9 o; l7 v7 o! r+ ~# I$ @% wand the interference to other SMs.0 J+ M! Q3 f# W" }
1 F/ H3 X, h" Q& {' @) n
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
% t5 ~ [- ^# t( [7 b5 Z% Y. k, n. R6 n
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。2 j I" }+ N1 f. b2 w
4 \( E3 [8 S) w/ D5 P
目的不是为了绕cuda,反而是为了让cuda的效率更高。9 F* G. q& v7 L- N
# V: C4 e5 J8 _3 _/ W/ w G2 \7 }; N
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|