TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
/ ?" k3 ?: `3 \' W& q/ R" G在论文里,这是第3.2.2节的内容
1 K- R' l: ]2 B3 {) a9 r, P9 N. K
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication7 d" @7 b" a) M7 N' k
In order to ensure sufficient computational performance for DualPipe, we customize efficient7 H# J( p9 r& Q# J$ ~0 {! E
cross-node all-to-all communication kernels (including dispatching and combining) to conserve, Z. J W v1 l; W
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,* y, B, y s* p$ W- ?
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications4 `, e: X( [; F4 i/ `# N2 G
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB* q1 P' C; z0 l& r' N
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
' l7 g$ `; O( Z6 ztoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
! H+ F% x. |) X3 Prouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
/ q+ g6 W/ t$ z6 V5 g: Windex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
1 f" M. E4 @, W/ zinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
3 ^2 J5 n' V* b, t0 w. E. k& ^8 K6 Wbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink! M, s) _* m* N5 u8 {) J
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node# H; ~0 c- Y) k4 m. N5 K; ?) ^
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3. u0 t h) b; V- I4 T
13
. o7 u9 x7 d! A i3 wselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
- V* D7 ^0 R, Z9 D; S* Z7 Y9 ](4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
- i( R4 y5 x# B }1 ]such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB W' s9 |- x# X5 F, v
and NVLink.
( b- Z9 _* H! x, q; ], NIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
1 W, X- t& V) j0 x% A20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
6 C4 Z+ F, _4 a2 [% j$ Z* [IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
; y8 v; e( I9 r2 Enumber of warps allocated to each communication task is dynamically adjusted according to the% V% A! e6 \0 h4 P* {2 d
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,& P# ]3 h) v7 r- p' D) {* `4 |
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also0 v$ U: X" B: h* V0 c7 K' b) ^- i
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels3 J2 T- d* f- f/ ~- N( v0 _# c- C
overlap with the computation stream, so we also consider their impact on other SM computation" w. Y) `( Q t% W" d& d# {2 t
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and( H$ n: e0 c3 s8 {
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache* Q0 U0 l5 H. `7 C$ D4 n
and the interference to other SMs.
$ ^8 N& R. a$ u7 a; |9 F& g- I; `# U, B7 \
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。' f* b1 R& f3 S/ ~2 ?) S ?
" ~+ G; j8 N8 t4 ]# l8 M我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。1 Q2 u: c7 y( m4 l5 N9 [: S
% J4 x ~; e8 ~. }1 ~) u* M4 u
目的不是为了绕cuda,反而是为了让cuda的效率更高。
" F9 a3 }' }$ C; h3 K( J+ |& q) n s& }' g/ Y( |, E7 N8 k
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|