TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
8 Z( p# e4 Q' M" h; W c* s4 L! ?在论文里,这是第3.2.2节的内容
6 G2 F& M8 F: Y' y" ?7 `3 T
8 b! P) {. |# B! I2 E3.2.2. Efficient Implementation of Cross-Node All-to-All Communication3 R# v: Z" [; v# s6 H$ i
In order to ensure sufficient computational performance for DualPipe, we customize efficient* W9 B. F: @( B3 j: \
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
8 N$ n4 \: X- b7 q3 v X0 w- hthe 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,
% D; g/ |1 z3 u- u1 i, k# qin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications$ Q- u0 N$ a8 I: s: P
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB2 _6 {8 q: e' v" Q8 ]( N/ ?
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
4 ], b! s# ?& g+ a. ^3 t; Mtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
. {* K% T$ F0 prouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
' ?" h4 i3 O9 e. a$ Kindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is h% h0 O; D7 Z
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
0 Y5 C- E" o3 w% W8 G- U' nbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
# T" Y" R% J! S% S2 K; P4 D# Bare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
- O, k" M- W8 @. H1 w6 Lwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
8 E3 R' w/ X; \7 K/ j: a) n13
& V. q& u* }% B, Tselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
7 z: s, t6 r) b+ O* `! r(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under6 j5 N/ Y, A! N0 i6 a
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
3 t, {) Q0 v( eand NVLink.
0 S8 C4 T" e% D5 G. S3 q4 RIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
* t: o1 j8 W& M' u20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
: k" A7 H6 b+ kIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
0 ], F& h8 N; i7 f( i) l1 Y4 \number of warps allocated to each communication task is dynamically adjusted according to the: ]! y0 I; c/ Y5 `" v
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
9 S7 l) |7 x' K(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
Y7 l/ R0 I9 F! Thandled by dynamically adjusted warps. In addition, both dispatching and combining kernels5 l w9 |, i+ \ \0 J" z! s
overlap with the computation stream, so we also consider their impact on other SM computation( r' [$ E& n1 s: K
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and5 ]) } q5 m& Z: y
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache4 P ]4 ]. M: }& w* }# s: W7 b3 K3 n
and the interference to other SMs.
$ M U, ^$ o' N3 F" H% h- h+ U
/ B5 l; a* b; k p, R9 s通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
6 k$ e# i# }* j8 B6 g. f8 }7 v' c% f8 @% t1 F
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
9 @0 L( R- q/ A8 E1 `% k6 n9 j$ q
6 X( v$ D: f' G* R3 Z目的不是为了绕cuda,反而是为了让cuda的效率更高。
9 c; e( H" j% A, v( d$ e9 E# \) I0 [0 [5 w
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|