TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
2 j) o6 j7 @0 W1 J7 F0 _在论文里,这是第3.2.2节的内容
/ n' P' ~- t$ l) R" ~! p9 }% C
( J& U: K/ C5 J" |) R3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
$ F. Y' v$ V! d- N/ }In order to ensure sufficient computational performance for DualPipe, we customize efficient2 w3 Y! N0 N! U! {+ m
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
u" _: |4 v2 J3 Kthe 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,$ m1 _6 A. `3 [
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
! }" y/ D8 i$ r: h1 I. [; Z, Dare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
) q2 {3 M' t8 |(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
' U' i" a2 G# q( [7 \token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
; O4 _, `/ ]8 Y% z; p8 H2 U, ~* ]routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
3 A6 N" D9 R' \& o Oindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is b6 W% I+ X7 }/ C6 R1 M
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
6 a: h$ d) H$ ]being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink- ^. X. ^. w {! c2 ]! T* [
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node7 h$ f7 p% T& }# X+ B
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V32 w5 ~# _1 \* x! P5 U
13
( z- H+ {: [7 u1 Qselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts7 @8 h( M8 v% F* x( k+ n4 T/ L
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under7 a/ W! W: O& j
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB! u! i* e W F6 k+ T
and NVLink.
; E; B+ t5 _+ s3 a WIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
* \& h+ Z) f. B; ~1 g q' R20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)- d# X+ u/ L& g: j& m1 {; k
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
3 p v* `: u$ l1 L) }! A4 anumber of warps allocated to each communication task is dynamically adjusted according to the/ }7 }, t9 v1 F5 A
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,2 f. \5 ~/ L/ f& _
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also3 }2 U2 |' W. a1 Q9 l
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
2 y3 M" O7 i. Q1 P Coverlap with the computation stream, so we also consider their impact on other SM computation# R' P6 i6 h+ g7 |
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and; Y7 N* N& F7 w: r% c
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache# Q, |- ?+ X0 c( R
and the interference to other SMs.) ^, q4 c6 X7 [* f( ~; y
% h7 n l8 K+ G' x通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
" Y; ?7 l* K3 r8 \) s3 S
" F, `& f# r0 w# @0 T* v) \6 `+ }我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。% ?) M0 h& z, {, W5 }6 x! B
4 r. ]7 H2 t! p6 @9 N0 q$ @目的不是为了绕cuda,反而是为了让cuda的效率更高。* g! A3 `4 y/ ]! \0 ~. l
3 L2 K/ ]% J) t0 k7 T
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|