TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
% v* r" a. a, z8 W' F# B在论文里,这是第3.2.2节的内容
; f' m! Z. I' _' ^2 y- {
9 {+ P+ J9 l/ v: m: P! q3.2.2. Efficient Implementation of Cross-Node All-to-All Communication7 L. J0 G. e; k& q( w" }9 i
In order to ensure sufficient computational performance for DualPipe, we customize efficient
# @9 t6 T- P+ U7 U. ]5 rcross-node all-to-all communication kernels (including dispatching and combining) to conserve
4 p" r9 Y' p0 I) A! x6 kthe 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; M Y: _2 {4 z4 t/ O) B6 u$ u$ }
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
1 I, N' j) q0 ^8 ~, q( N1 mare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
+ H/ y+ }# D [: T* p5 y2 H( E0 i" @(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
% I# ^7 n6 I8 \8 R1 }' W2 Ltoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
* j2 r+ _# G: t U8 e$ Lrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node3 j/ v* M' R+ x" ~' R
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is% v6 q& e% M# S+ F
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
; v1 y' M: R! Y+ _; bbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
2 ]& d1 x$ Z) jare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
0 y2 e* i2 v, P5 gwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
V; W; O+ T6 _! o, h138 A$ j( y9 Y% Q' [( G, ~
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
V. U! X8 X3 A/ `: a( y6 q(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
# }, C5 W) \, v3 Bsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
1 o O6 O4 ^$ t- Oand NVLink.& g: @- u5 z9 h( V
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition4 C/ i; O5 C6 J/ M) d: n/ A
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)/ M" u7 C" V& f0 N# J8 h+ x
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The4 ?5 C/ g/ G$ b! u
number of warps allocated to each communication task is dynamically adjusted according to the
+ }9 u" r- y; w0 L) Oactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
) k$ U6 ?* e5 {( J(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also6 z& S1 J6 S; G# }) S( [4 P9 T
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
3 u+ B) m7 E5 Z. A4 loverlap with the computation stream, so we also consider their impact on other SM computation
( u* f# J! q+ ]. r& f9 wkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and0 a# w. ?# ?- M8 S
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
$ ~6 Q. Z' C- @1 b( Z6 P3 uand the interference to other SMs.
0 J: q8 t5 s' x, g1 Y2 \. w. _" ^
9 i8 n. t+ T0 s$ y9 u通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
}5 O; D; F, U4 F$ X% |0 ^; ~* y$ ]2 k7 F' H
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
6 e. c5 t5 `# s% v3 d! T. j L! C2 V" z$ w
目的不是为了绕cuda,反而是为了让cuda的效率更高。 O3 K" S' z8 |" x7 @
9 A; z/ ^$ o Q4 Q1 a) O2 k' R* ^
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|