TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
, s4 Z7 C9 u+ f) d0 i在论文里,这是第3.2.2节的内容
Q1 m" N4 r2 `8 {# Q5 u: u7 ~/ Q y* C: M! f. K7 o5 g% x
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
2 `$ g" v/ P9 dIn order to ensure sufficient computational performance for DualPipe, we customize efficient5 ?/ ?5 z. z4 ~$ k
cross-node all-to-all communication kernels (including dispatching and combining) to conserve- P; X% R; ]" n& W
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,
5 c4 S5 O# E4 Q* n* V+ e: K: m- cin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications2 ^8 q! X. Z+ n5 Q; r
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB) c% Y: i5 T ^1 {5 X: N
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each f$ X. @) c* G
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
: q7 H% _3 c s1 d6 e; _routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
7 R: D. M# R2 _index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
4 K2 S% t0 e* s$ _" {3 e5 l; L, binstantaneously forwarded via NVLink to specific GPUs that host their target experts, without) y( r/ _3 C2 a! _. K1 O
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink( ]/ E# U; g+ Y% a% }
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node+ L1 i% Y( V) `. B
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3- Y9 W2 C; K+ ~# O% J
13- Z& f3 O# D) Z# ]$ f1 q
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
; B1 b& ~. G" ]: V+ W(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
0 A# C' s/ s- d1 ysuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB; ]2 y* v9 T4 S2 C
and NVLink.7 G& y- a( v) N# {, v
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition+ `8 X/ E. h* q4 p
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)) k4 J3 F! t; w$ j9 b
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The8 t( `1 o4 I; c4 q6 B$ z5 c; p
number of warps allocated to each communication task is dynamically adjusted according to the
# j2 h L0 c# `3 B& ^actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,. i7 e( W# G O4 S5 e/ h7 t
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also0 g+ F2 T+ n1 `* c' P% r+ C$ Q
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
1 T# U+ U6 w2 c. c- R, Coverlap with the computation stream, so we also consider their impact on other SM computation4 N: V+ O4 p' ^# }8 s% B5 n
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
& F. ?, y4 S. t9 G4 pauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
* }" ~' C. l" F: {7 A" S. ?( pand the interference to other SMs.
5 o' H: B0 k5 o2 D j' X( c
' \' B6 I' a4 P8 m7 F+ W, j5 S0 Q' X7 l通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
; R# ]' l: X d' }. G8 Q) L4 `9 D1 b) E1 n. c8 f" z
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
& ~/ R! H% t! ]- p8 h: K
Q \+ ]5 ~; ]. H7 x8 f" I# i目的不是为了绕cuda,反而是为了让cuda的效率更高。
8 c$ i, X- U5 s. q
, W+ c/ l2 b, ~6 k- Z# |类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|