TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
. o1 J0 w4 V Q# {( K( Z a
在论文里,这是第3.2.2节的内容2 C. b+ {4 H' n7 U1 L% f
" D' Q1 E* \ ~" D' C
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
( T* B' k- b8 `2 _In order to ensure sufficient computational performance for DualPipe, we customize efficient' O7 {6 v* E; x) J7 H
cross-node all-to-all communication kernels (including dispatching and combining) to conserve: K6 Q: A* d$ E8 B, K3 v
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,( y8 I8 V* H- d, W
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications# D% g2 G+ Q/ D3 x4 q
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB/ l: \& @( Q: o( d9 v: o4 }
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
# B& t$ c9 I& S& p- N& B; @token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
* F- ~; r: v9 r2 W! ^2 Frouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
9 M; a5 m* B$ ?0 y7 E4 O/ _0 Eindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
8 G3 a3 E6 T; l' A1 l, r& Z# oinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
! P6 E0 B5 [+ N+ i2 `being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
4 r6 T3 |3 N! B$ \. q* ]! Xare fully overlapped, and each token can efficiently select an average of 3.2 experts per node$ `, [$ c/ W5 ?3 j+ e3 t Z4 B
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
: Y" w/ I3 y6 n/ @1 ]7 K1 T136 A+ a4 @$ h) P9 r
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts9 n' a1 i& J/ M) X7 @3 }( F
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under3 Z: n% x" K1 z
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
4 J5 N7 {& T& W# Vand NVLink.2 Q5 e( D/ i2 Q
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition3 I' O9 M- i g& u6 `& K; A" G1 k
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
/ G) K9 o8 z- F0 N( TIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The. q2 q" C0 E H7 K
number of warps allocated to each communication task is dynamically adjusted according to the
/ G5 I1 s+ ]+ `- F4 r Uactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
* c# g% Q A) M& \- ]( D1 H(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also: z6 l5 Q) d4 U) I/ r4 V
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels- ]! z4 j, m G! g
overlap with the computation stream, so we also consider their impact on other SM computation
# {8 J/ G/ @& F; F9 ~8 z# _+ wkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
2 \# i A- } h2 c% ~auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
2 p# P$ _! f# Eand the interference to other SMs.
* W* _0 g3 a- [; j
, z( Q) ^: s/ p' d3 H: y通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。" g' z4 i4 K. N2 S/ J9 f
6 ?9 P9 }9 S' i" a
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。$ b! C- g- b) |
: o0 Q1 d& e C# U目的不是为了绕cuda,反而是为了让cuda的效率更高。
- y/ d; a) e% p. G% ^! @5 r# C/ K: o. f$ R% [( Z! X2 T E* m
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|