TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
7 M P4 v% M! k* ]* w0 p6 \在论文里,这是第3.2.2节的内容: r+ Z* h0 a+ ]
( P+ O$ }' W3 e6 \2 P, S6 a
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
6 W q- \, a. n. N! S* hIn order to ensure sufficient computational performance for DualPipe, we customize efficient2 v2 X' Z' Q7 D3 B
cross-node all-to-all communication kernels (including dispatching and combining) to conserve6 u/ Q; E w, [2 x: ^1 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,
; d8 z' {9 _& [% v* Q6 @6 Yin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
8 m& f) e1 D, o: uare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB* U3 V4 t5 d- i L
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
( e$ c) k- ]# i/ G1 T' [( @" {token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its5 o) U% g7 l! m1 d, V0 L8 t
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node# a# c# N1 i, [4 Y' J5 k
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
1 S8 d: `& t9 @$ T* l {& `instantaneously forwarded via NVLink to specific GPUs that host their target experts, without- C }1 y+ b0 }; O4 C+ _8 S2 V% L
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
' \) N5 g" ^2 Pare fully overlapped, and each token can efficiently select an average of 3.2 experts per node3 k, y3 _6 R, ]7 u; N; V
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3- t& J. N. c! ^ w7 E
13
: J. [2 Q ]9 X% b6 t! b% pselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts. P" R! [0 @/ J$ j
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
* A& U1 G) s$ l; n- S( q6 j6 Bsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
# P, T$ t3 Q9 U8 |, cand NVLink.7 [' L/ i( i, J1 I+ V$ u6 z
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
9 |$ L0 m' J- X3 k+ S4 [* q* F20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)+ Y2 H7 `2 {* G2 R( |
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The4 E9 `6 _( ? s6 G7 l3 y- f& E
number of warps allocated to each communication task is dynamically adjusted according to the
w# W. g, H% V; zactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,9 Z' i r* S% Z7 E) }: X( M( w
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also! C& u+ x% X/ G7 j* Q9 i
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels! S# _: y; \( l, J+ M) K
overlap with the computation stream, so we also consider their impact on other SM computation
, Y' p* m2 E0 a; V% x, U$ ^# \kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and3 h* o/ d4 o( F" A1 A: |( h
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache; e( M4 T; G# J" p! k5 z. S
and the interference to other SMs.
" ]% [. f0 n# a& q2 h
$ q& | C# D: {$ I通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。, P4 f5 n) { M
! m% Z. C9 K; W/ S我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
( j, @+ w. ?# _( k2 Q
" c% d v, ~6 U目的不是为了绕cuda,反而是为了让cuda的效率更高。
3 }7 W$ o/ K# Z% Y, k" \0 X2 `4 E' P9 I
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|