TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
1 }: h0 u: t. w2 B V4 @7 l z在论文里,这是第3.2.2节的内容4 N/ e) ?! x. T% g" |. g
+ w- z6 ]2 T$ T5 C+ I4 b" M
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication0 O, h, u4 X, G) ^' m
In order to ensure sufficient computational performance for DualPipe, we customize efficient
4 P" h4 ]8 |0 `, {/ E) _cross-node all-to-all communication kernels (including dispatching and combining) to conserve9 q) H$ X, Q i Z7 c$ Q, z/ x1 h
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,
/ Z+ }3 L9 e! U7 Q, U4 H. n$ j' win our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
$ |9 Q: O9 R7 ?4 _# |/ Hare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
# ~: h+ y$ u B0 p(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each0 J9 C. L6 Y- k0 b7 i
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its4 V8 {' W. t$ g6 z* E1 O; \
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
8 X' v* H7 }( V/ V6 t2 g7 o1 \index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
& n) {# C z7 s1 l g7 R. `instantaneously forwarded via NVLink to specific GPUs that host their target experts, without( c7 f# t; H( W6 a' Z9 B
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
F# B: B. b$ g, T* h* fare fully overlapped, and each token can efficiently select an average of 3.2 experts per node5 i* Y9 x: Q h; T* ` [
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
7 S% _9 K0 b& C" B1 J+ v R. A. w13
( X, N; r( i* l7 b+ Dselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
! T+ b5 ]- V0 C(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under( I- Q9 J/ |- {# Y
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
" U% b1 C8 ~; E- |6 |and NVLink. N m) p# {+ t- B' g9 a
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition1 L# G, p; b4 i6 i6 d! W
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)$ E3 v7 o$ x. y9 S( x
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The* o4 \0 W+ d' t* l
number of warps allocated to each communication task is dynamically adjusted according to the3 d* z, |0 l' w3 @0 [8 F
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,& k1 _5 r, A5 X: L# S* C
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
' X& M) @3 M5 r1 Z# ~6 Y0 i5 E5 ~handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
) d+ x8 b$ X5 _& s+ l3 Ooverlap with the computation stream, so we also consider their impact on other SM computation
9 h/ ]8 o. t: z4 f( lkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
6 z% B& f2 N. t" ]# G% E1 [7 Mauto-tune the communication chunk size, which significantly reduces the use of the L2 cache3 S/ _. W& h) [5 I0 \8 R# P
and the interference to other SMs.
7 X V# r1 G5 w& b, K$ R, r( ?7 |; q) ?
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。& B; ~3 C' {4 Y- |2 h5 @. Y' N
( V% Z. c9 O5 Z9 i我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。0 O, \/ j# R; _" h! s- M
, L' o& }3 V, _3 h1 b
目的不是为了绕cuda,反而是为了让cuda的效率更高。6 e& K3 M$ G9 K2 g1 p
) U: B1 ^2 ], [, i- G$ `4 c% @类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|