TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
) I" v' [- }9 a0 d; e" R6 A8 @) w在论文里,这是第3.2.2节的内容* x6 \* F+ u4 I5 t. w
+ n a) V. D# ?/ D. h0 j0 Z3.2.2. Efficient Implementation of Cross-Node All-to-All Communication5 f' o/ R/ [6 _) t9 u9 x1 P
In order to ensure sufficient computational performance for DualPipe, we customize efficient
; Y% N( \2 q- M/ j; S0 V8 Rcross-node all-to-all communication kernels (including dispatching and combining) to conserve
" X9 h2 x) j! g0 b& g! T+ Ithe 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,
. c/ f1 p) @8 k7 vin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications9 ]+ M# I6 b: c6 k; a/ ^- \
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
$ ~* y8 ~! s& X6 l(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each! l5 R) ]/ \' T0 X# O7 T# j
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
1 z, k" w8 k( H3 J) Orouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node% s0 Q2 \) n/ [. l
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
9 @8 M" |( c6 @* dinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
9 o9 i$ R) N* Rbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
1 u4 Y; t+ f& j3 z- Q% e# u6 gare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
+ \1 \/ A, g2 O# K% f0 B6 \! e6 jwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
+ D3 M- Z' ]9 }; j13
) x9 m5 t/ k. E7 M$ f% {1 ?. Aselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
; q) ?9 e# y4 U8 O2 C$ S6 V(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
) b8 O4 h( s, s/ i7 I3 R% ksuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
- S. M% `2 I9 y$ h8 Hand NVLink.9 v& M" |) C% _
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition1 Z3 P: J8 B! T9 f z
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)2 R0 c# H; D2 D* n
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
1 O2 N6 z: I) |- P6 {+ X$ f) q/ P* Knumber of warps allocated to each communication task is dynamically adjusted according to the
. p# G% u. \9 y: P, vactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,: f+ h# c- w) l/ Y$ C
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also v' c( \. G+ o3 N+ p- Z! I) U
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
0 D% @ ]$ A0 _5 t4 _+ Z8 Coverlap with the computation stream, so we also consider their impact on other SM computation$ m" g4 w; a4 C s# _) t" ^. o
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
- N7 \1 i" {! r. H! oauto-tune the communication chunk size, which significantly reduces the use of the L2 cache5 A2 y9 j) }% p* s9 A
and the interference to other SMs.. _6 z# I# j& h- c6 Z( x. V
6 c4 B: S; ^4 b9 f1 \7 m7 s' R通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
$ [: y" Y+ V3 S
3 D5 ?: Y( [& z' \我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。% P+ |& i! e B* P+ m& u+ H
5 A- m' A( B! p# D2 s' c& \4 O目的不是为了绕cuda,反而是为了让cuda的效率更高。
% u( c* Y+ L( j) \/ Y
% q5 h! u) d+ D+ }; O5 O类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|