TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
+ {. e# b; c q/ i3 j+ r& i
在论文里,这是第3.2.2节的内容7 _0 \8 u9 V! p2 A
6 a2 {5 C9 `3 i, j6 Z3.2.2. Efficient Implementation of Cross-Node All-to-All Communication& l. i2 o5 t2 ^) [
In order to ensure sufficient computational performance for DualPipe, we customize efficient$ G5 u+ ?' A, _. A0 q
cross-node all-to-all communication kernels (including dispatching and combining) to conserve1 \5 T9 K0 ?% P$ p- H6 ^) j; ?
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,
: T! ~: ]% Q: s3 din our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications& y' H2 a4 O7 P3 |' {
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
6 L& y* H }+ f+ H5 U(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each G0 b8 F* O1 ^# K$ H
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its& b' {# m7 k: u" Q
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
1 }2 J! `% X" {4 @8 G2 F# U4 l$ |index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is. i4 f; G4 S1 L% B \$ l8 ?4 R" A
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without+ G, b$ U4 ~: y+ u" l8 Z; B# H0 A
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
) j$ f. d* f8 J |2 b9 s+ Eare fully overlapped, and each token can efficiently select an average of 3.2 experts per node9 s8 k9 D# e! A a4 ?3 Y; i" u
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3 D$ ]+ r2 Y; x
13
$ R2 b+ _ ]) \3 Xselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts5 D; b6 _& I/ f/ i
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under- z" F8 M, ?/ ~& h7 ]% w
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB. ^" K# C% R9 B
and NVLink.
9 D& D& E0 X& Y2 S9 \/ tIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition; t3 v3 m/ | v+ R- p) }
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
8 \7 N( {- P9 a9 H1 m1 jIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The2 H$ M9 W9 W5 w5 g
number of warps allocated to each communication task is dynamically adjusted according to the7 F+ i8 {/ W6 D7 V7 ]
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,) H1 z1 ~+ J+ N& G: a: U. s" ?: g
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also$ r/ h; K! W% P+ e" d; v' | \# O; _
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
+ u7 b6 q6 U" zoverlap with the computation stream, so we also consider their impact on other SM computation$ g6 u) z7 I. B% @, m1 A
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and1 b F6 b$ e# W' I% E& }. t
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
9 s( Y4 b) I9 u, N0 Gand the interference to other SMs.
: u$ O/ J4 u! v) I* n! e+ J; w: n0 b, r
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。1 ]6 \+ V* N! J6 ]( g- C, }
5 k& `' I( k3 X& r$ u8 {
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
: c e J W) ?/ Z$ l
, D. u0 f9 o: v5 ~, x目的不是为了绕cuda,反而是为了让cuda的效率更高。
$ H4 L3 s' [3 A
: k# h" }7 \+ Z. ~$ U( ^类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|