TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
+ d( h3 i7 r9 W9 _( B, \
在论文里,这是第3.2.2节的内容
& k+ m, Q' [) ?4 _# f/ R5 c+ d! e
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
! B+ C; J# [: l2 a% dIn order to ensure sufficient computational performance for DualPipe, we customize efficient
! X# Y+ }# j" L6 k) xcross-node all-to-all communication kernels (including dispatching and combining) to conserve, q" N/ P% y; T& I( }! O+ Z1 C
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," @' n, M( A& [( Z1 b+ C. i
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
6 V% \, `# Y4 q e8 G2 z8 |6 ~ `are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
C2 p4 z V+ i; U8 Y6 _(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each5 m7 z6 ^* V( b" Z9 r3 u
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
- C' N7 O+ N3 e* r4 x1 \: k5 Zrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node9 H, f0 V# Y& q' H
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
0 R2 E# \. m: h% H: _. Vinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without" f, m- a I: ~2 R
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
* L7 S# |# T0 |are fully overlapped, and each token can efficiently select an average of 3.2 experts per node6 ]9 G. X; x$ b" O* K2 s2 ^
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3/ W) U' T7 s$ Z" ^6 U4 u! Q: Y
130 I, I. |. J! ~1 x" W. K
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
8 h s: H: M& a" a" {0 c(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
}* H, F( t: j& J5 F! Csuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
+ M$ { W9 t$ Qand NVLink.
7 Q! z9 f( d0 U4 U: vIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
: _3 R! Z* U* k2 D0 s7 z* d. ]7 U! H20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)- ?$ e/ \ M2 T/ P7 p, N
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The% x' O# Z; L! K7 q- P' S6 K
number of warps allocated to each communication task is dynamically adjusted according to the
7 I7 d6 `( G4 h1 b$ bactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,( ~. j1 e& Q- {. [/ D
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
- c5 J0 k+ i2 l6 u! ]* n. f) U/ khandled by dynamically adjusted warps. In addition, both dispatching and combining kernels! x" I! {2 c- t5 q
overlap with the computation stream, so we also consider their impact on other SM computation8 i' l5 S3 f3 g4 N; p! e! ]. |
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
& \! ? v, W& R/ Y7 L1 Uauto-tune the communication chunk size, which significantly reduces the use of the L2 cache1 Z$ v* [7 H+ t& G
and the interference to other SMs.8 c1 u% t6 S0 R3 e7 A( v" e% h6 o
f4 s- B6 y3 N- ^3 J
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。, d) O; T: y( ~. H, U- r
2 p! z4 W7 w* |; o9 U, A9 F: v
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
8 u% D" s5 l; Z4 a* _. f# S6 ^! i" v, v+ ~6 e5 L* G
目的不是为了绕cuda,反而是为了让cuda的效率更高。( |9 H# [7 ^+ A3 i- _2 B
0 j/ r1 d; T4 \; b7 g9 F类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|