TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
1 f* U! o- C. ]/ q* {1 M S# e在论文里,这是第3.2.2节的内容9 ?# N, h. L" @/ y) [) `; {
; {0 L: Z) k5 l6 `* C* O/ {3.2.2. Efficient Implementation of Cross-Node All-to-All Communication4 [+ p% A+ S4 C( N% G8 n) E
In order to ensure sufficient computational performance for DualPipe, we customize efficient
! F7 v4 e# d f" Jcross-node all-to-all communication kernels (including dispatching and combining) to conserve M& n: O" W/ N7 z$ {3 F# 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,3 J* c, M8 m' g# O8 O/ s
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications# R! W) n2 _5 P- ~# b, F
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
6 d7 q) r: o" ?7 V0 B% P$ C(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each* x1 `) K6 Z: p# ^) _1 a) Z
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
( h, }( _: H, p4 Mrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
( y7 J- d$ S1 i2 e' b0 g; K- J& gindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
4 m. w5 e1 U" _7 q# M9 Y8 xinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without, { E, [: M" @3 ~4 a/ V
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
p4 w% l8 V# sare fully overlapped, and each token can efficiently select an average of 3.2 experts per node# O' A x* T0 j. U+ x9 v
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V31 S% H: W6 x+ e# `9 L* {3 l: Y
138 w0 _9 _8 z1 d- x* {: a4 G
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
( d, R6 H7 t e9 t; K; ]( A' f& t(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under3 J, ^: J$ a$ s
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB. U+ H6 [5 [" ~4 }* c7 X
and NVLink.
5 t$ e Q4 K V- G0 v7 |, HIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition7 Z3 P# H1 S0 N/ o3 x' |
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2), x$ M# ?' x( ^
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The; i }, o% x- v+ i
number of warps allocated to each communication task is dynamically adjusted according to the* s5 p. U2 l. J: c h3 J( P9 O) h# I
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,) J, _3 T& L# Y1 d7 r
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also1 d- \/ o3 f; {- A3 Y1 [
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels7 y' Q0 n' H5 s5 ?( P5 v& p
overlap with the computation stream, so we also consider their impact on other SM computation7 |; d% F+ n3 H# n# ~( t
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and; S/ @; ]" ]4 ]
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache; q" e/ ~+ ]8 Z5 ^+ A/ _
and the interference to other SMs.
: `8 e4 D$ Q' o) L! G# l {$ V* `' a
( F8 `: [; L! {' l通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
' D% n. W$ z# F% E; S$ ~% O* U+ m/ H$ ]2 W8 C ]: g _
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。# @3 V. a; R M
8 F; T, v5 v4 B5 t. c目的不是为了绕cuda,反而是为了让cuda的效率更高。 E+ x/ S2 M2 l6 p: A8 S
y0 B3 O7 }. W6 Y
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|