TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
7 `% l6 a, g% `7 D9 M8 }
在论文里,这是第3.2.2节的内容
: o: I# e" t$ j3 n X0 @$ t. O+ E: N7 b( c# K+ T
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
& {. E' j5 f( O- f# hIn order to ensure sufficient computational performance for DualPipe, we customize efficient
% r/ r" V- U, c+ S/ Z% K. D( u# zcross-node all-to-all communication kernels (including dispatching and combining) to conserve) h, I( W* [4 r! ~1 J1 z
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,6 m: ?( D9 f& P, \! O2 t _0 }
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications" n( K0 ?! {% ]) S" H
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
1 @( P2 ]) [+ l" Y3 l9 H(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each8 _; z9 T3 m2 W( |( T. l0 {
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its% \+ i: w' ?5 b1 ?' y3 }1 ^
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node6 d; ^; `! d/ G: N0 K/ K$ m+ K! x
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is6 p" F& `) c8 v' b
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
+ S" c6 F) h4 W) A- X& a; J1 a( A( }being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
+ O- u4 J9 `) F% W. h5 t9 K% Z6 \are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
7 c9 w6 I: t# n6 hwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
1 X1 X w: f2 @7 v* ? Q13
6 ]1 t! I5 n! c" p) T* z% eselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts. m! _6 h( ^( ^9 l1 J
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
8 c Y/ n8 N) _# _5 `- Hsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB9 q! z" \- ~9 i# m# `9 o# g
and NVLink.
: p; d1 [8 n, C1 c6 H; F$ w% {2 \In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition4 `9 [+ A) Y/ h9 x' i" U2 Q8 y$ P
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)5 T) n2 R. I1 u5 T4 @. L2 R9 Z
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The$ O' l8 t& }1 H5 R$ m
number of warps allocated to each communication task is dynamically adjusted according to the% |4 c0 \. E1 q A
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
# _4 {- K+ Q) f(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also n* ?" i) j( K2 _* q& s- {
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
+ Y: K6 I0 y3 q2 W$ k: {+ }8 noverlap with the computation stream, so we also consider their impact on other SM computation
. ~/ G( D2 I; v% p% _9 `: p Y5 [# Xkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
8 P5 d; U, g* Z2 n: K. Yauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
) E7 C w& h( q! ~4 ?5 C# |and the interference to other SMs.
# w2 @: T/ K4 X+ _0 e" M9 }- }4 v- [) U8 E& K& S4 K2 O" O
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
& W) n! ]: ^. C$ f- w9 a3 S) o3 Z v4 Z3 T2 ^1 J+ n+ E2 u
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。4 S5 f. i$ v. P1 u( }( |0 U
9 J# h$ y% N- |
目的不是为了绕cuda,反而是为了让cuda的效率更高。
9 h& E- V) O, W
3 B& y$ k4 X, p! A/ ?类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|