TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
5 x+ p. F& v$ | F6 J: r9 s5 k在论文里,这是第3.2.2节的内容: q/ K: k2 Z' U
) \- E' l. B; A3.2.2. Efficient Implementation of Cross-Node All-to-All Communication; S+ b( U/ z1 O: Y [
In order to ensure sufficient computational performance for DualPipe, we customize efficient4 u" N0 o% `6 c
cross-node all-to-all communication kernels (including dispatching and combining) to conserve6 n# U T0 R- y$ ?# a, M+ @& ~# s' 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,/ W/ g( f, L/ a# g7 c
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications4 o( O7 j- {; ~8 j* v9 ~7 x
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB0 W* C3 z9 c- C7 v" I; a
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each' j7 a5 P" t8 _0 p8 u0 N* Z' u
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its- n* d8 `8 |) Y( j+ [( k5 K: j, D
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node# F3 U( {% v3 Z6 o
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is4 z. p: U8 S, Z, y. O
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
0 Z/ v7 ]0 f9 Hbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
* U0 X1 I# y& [$ S1 i2 T( mare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
& a- m* c6 M) N8 }without incurring additional overhead from NVLink. This implies that, although DeepSeek-V31 ?( i* o: c4 ^4 V; f! e
13- o/ G, M- p; v9 r
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts' e6 ~6 N! {; Z' i8 ` u
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under: w( w& H1 F. h, |: A6 s/ a/ A: N
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB3 P9 K8 v: v3 }% q" m. X- a
and NVLink.
- l! F. Y7 g; i0 N6 f0 D& } VIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition: F& v; c! A4 H b' H9 H
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2), U" m- [" y/ r0 _- G% f- Y" W. D s
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
. i, M7 L, ]2 t( d4 Wnumber of warps allocated to each communication task is dynamically adjusted according to the/ d( m& m! \% |2 z/ \: L @6 H
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
9 _ H' V U1 V! G( ]3 j9 `5 M! I q(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
4 }' {. @4 E: S' E, H. y1 bhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
+ b4 Y6 i- ~5 H1 K" \7 ioverlap with the computation stream, so we also consider their impact on other SM computation
# T3 i3 i! K& Ckernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
O) \2 U$ P, Mauto-tune the communication chunk size, which significantly reduces the use of the L2 cache2 U( B- v' S7 g) t4 Y
and the interference to other SMs.
1 |% ~+ T9 H+ \) ^8 q! t% R
2 A- _5 i# Q. j7 E通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。7 Q ~' W4 b3 R6 \3 }+ z; E
+ n1 b9 ^! G9 [/ ?& U我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
! k. ?8 s- h, i5 N4 v: C% }! Z
" `5 A8 w7 \) ]5 I& V1 q; B目的不是为了绕cuda,反而是为了让cuda的效率更高。 c' T2 p0 O/ n3 Q3 E2 ?6 v$ h# S
; J" y; p$ p( A/ k5 ]/ l' {
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|