TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
4 {* X3 {; i% O, S' P在论文里,这是第3.2.2节的内容* Z* l( u, h( q. v: i. i
7 E& y* o) _5 c7 P7 J( l0 U3.2.2. Efficient Implementation of Cross-Node All-to-All Communication. G7 N7 {$ z" r1 h( `1 i7 S7 G
In order to ensure sufficient computational performance for DualPipe, we customize efficient$ Y9 P; T/ h0 r! Q! n
cross-node all-to-all communication kernels (including dispatching and combining) to conserve! ^7 D* k, m6 U8 ^6 {
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,0 d: {8 P/ G5 r/ ]7 O. V& F
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
" V! G2 @! f0 `8 c9 Jare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
: M f1 G6 J7 B A(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
9 u$ b0 b( k$ Ztoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
1 T" ^8 U, j0 }3 a" f/ z, Prouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node2 l- h+ y5 v' E9 q; A
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is. B. \& X) D' g" }
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
3 |8 d* v! d7 e) Fbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink( o0 ^+ o" Y) T
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node- M- Y- w' b y& [- _/ ?5 K- M
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3- L% T, W3 p2 k0 |9 w
13
5 w: c5 t+ U3 k0 r, l1 `* v' W" Jselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts2 X; A3 r( W! a+ I
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under6 |0 c) F9 V9 g4 O* d
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
4 r- k) w5 i' A4 [: q) dand NVLink.$ q2 P2 V; p: T# W; G
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
1 Q: K( r" U! }3 Q; s$ z20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
9 L7 H1 }9 r2 |# t$ u+ R( _0 lIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
1 b1 N/ g3 Z# x1 y0 D4 hnumber of warps allocated to each communication task is dynamically adjusted according to the
: m6 v s3 \4 ] wactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,* ~( {) ?3 A& e( V; a
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also7 {' L' K& A4 o' q& V
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels# z: z6 I3 u/ H
overlap with the computation stream, so we also consider their impact on other SM computation
! P+ A6 L5 s- _8 D |kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and4 X2 G; y! M2 A2 s% t; |8 C
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
+ T, k8 `$ a0 E) t- ^and the interference to other SMs.0 L; t1 C0 l1 a2 K
# u' L5 ~. Q) V6 K! r7 W( _通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
}2 m5 {% v+ i* b9 M
5 J: `9 M1 h9 B4 R我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
. U% c6 N/ W5 l+ W& A
3 M' t- W: U( g% S1 i/ g" t目的不是为了绕cuda,反而是为了让cuda的效率更高。: E+ T/ _) @# ~. N( s2 a+ o
) n. [1 \" `/ B3 Y* w; k
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|