TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
" K& R {& N0 v/ A
在论文里,这是第3.2.2节的内容
0 U" e6 y1 j$ T; m% {8 w
0 t) C! w& P. L- s. }. y3.2.2. Efficient Implementation of Cross-Node All-to-All Communication) Z6 Y0 z8 i# N& G- g
In order to ensure sufficient computational performance for DualPipe, we customize efficient
( }% @" `6 q! `, ^# ~cross-node all-to-all communication kernels (including dispatching and combining) to conserve# J6 V5 ]7 S. q! {3 ^) F
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, i+ {2 g6 j, H7 v9 G0 Vin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
( V1 Y/ F( G. x; Mare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
+ `1 C5 r2 Y; p) J/ k+ G! Y" Z(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
( s$ {$ e0 f# t+ T4 ^0 H+ S7 ktoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
) q# ?4 R' D0 m9 c6 ^; o1 Brouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node) o- l; L3 k+ s$ B
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
d% x7 O; M2 }" minstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
; I1 R! a" C- \+ n% I7 Obeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink: K! ?. G4 H: P- E9 [
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node. |/ J ~3 V8 t) Y2 ^
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3# l1 D2 y4 }& p5 E
13) n' \9 G, a2 |
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
/ l+ Z- _7 [! g6 l6 b% O(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under( z& B" H' b8 M# U8 Z1 n
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
2 Y4 Y8 A6 I3 d8 O2 Sand NVLink.) \$ v. f# \/ i; x( u
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
: G V8 s8 T9 b' b- e20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)6 a2 {+ a1 W5 ?! E
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
1 N2 N; r, x" K2 Lnumber of warps allocated to each communication task is dynamically adjusted according to the+ j1 w5 `' w5 Y, c6 A& \6 [4 Q
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
7 b2 j9 y/ W+ H/ p- {% v# J* @(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
- _/ v7 `# A! X3 u; `8 C) [) ohandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
( s2 }4 M" J1 l# woverlap with the computation stream, so we also consider their impact on other SM computation% \7 r+ J n) A: l- x
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and1 t0 u) d. q# A: s1 W3 V4 I
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
9 W; e* ^' s, yand the interference to other SMs.( ~9 B) g! c- F7 L8 X" N
6 _# ~! T# N0 \5 I3 u' v
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。# i8 E ~! b% b9 ?+ G
. N) \6 P* Z& r9 [1 d# I我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。% Y( O$ ^1 {/ J- A1 Z1 V" B
4 E. A d; L; D( u
目的不是为了绕cuda,反而是为了让cuda的效率更高。* X- P Q' V- B! \* {$ l% b
/ X9 |5 Z" l2 E- x) n/ ^
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|