TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
! {3 B* u# k3 _# F/ P6 h- j# S
在论文里,这是第3.2.2节的内容
0 Y: i- n& h2 \6 w0 i( U" G5 o) N' l. Y) e9 b1 \) K
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
" W5 b9 G. t2 cIn order to ensure sufficient computational performance for DualPipe, we customize efficient
# ~# [& D! h+ Fcross-node all-to-all communication kernels (including dispatching and combining) to conserve
" t2 ~* |6 Z' Q5 Jthe 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,, `+ z! T! @" I+ B' R7 T" X( v
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications2 x* i0 E' b: y
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB. B' v& U3 U% g Z( a3 J$ t
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
% e5 j' E d7 @& m" v! e3 _token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its7 Z, ~4 E) y$ Y; U' ]3 ~
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
y- t r% p% r. ]" o: ?index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
5 |* i4 i- o5 p% ginstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
* T1 f3 j0 |. _5 m: m0 t+ Q- F5 lbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
" a _8 O! h3 ]/ C; Zare fully overlapped, and each token can efficiently select an average of 3.2 experts per node* ^, }: a# j5 ?3 z: P$ c
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
+ k0 u8 R& j3 c) |( Y8 R/ c13' Y2 m9 F' m; @% a# I
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
! t4 B, p% v, [# |$ N(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under( Y& m. T0 c1 `3 X
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB U6 A/ S" |$ u2 }0 Q7 [
and NVLink.
8 L! L8 V/ ?" v; LIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition, V4 V% I. T; U- Z6 Y5 g; m
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
& h( Y. e @4 r+ U0 j, QIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The, [) \8 _, L' |
number of warps allocated to each communication task is dynamically adjusted according to the5 P2 t, [6 a: O; d/ `$ l
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
2 |- w8 Y5 Z6 N0 q8 n(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also# w$ z+ H, b' ]2 K" O
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels) z! ~0 l# t R' {# [
overlap with the computation stream, so we also consider their impact on other SM computation
8 d' D6 c1 _: g Qkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
1 y. m0 R1 c/ \5 P( B4 Cauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
1 j$ M# b7 v7 Sand the interference to other SMs.& D! J# _' p( A6 x9 j
! j% m& X, K8 t+ w( Q0 |/ K通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
6 c* e# }# B/ p
2 m9 ^& Z' @: O, S- k我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。* a2 H! k7 E1 D9 p. a! t- @7 b, \! z
( z8 B/ d8 j! ?; k! ^4 i
目的不是为了绕cuda,反而是为了让cuda的效率更高。8 H" r- \) Q- T. b; {6 T6 ?0 R: F/ ~
. F/ t& l5 o7 n4 L类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|