TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
! _8 m/ D$ q" N+ r. ?' @
在论文里,这是第3.2.2节的内容2 t0 ~7 J+ I& S& q
* N5 z' g8 A7 Y8 T8 m' _. y3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
F. j; K5 b; J9 e J0 C+ m3 BIn order to ensure sufficient computational performance for DualPipe, we customize efficient
$ r, p1 t6 S8 |5 Ccross-node all-to-all communication kernels (including dispatching and combining) to conserve
7 F! c+ X! ]2 j) ?1 {, Lthe 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,9 X: z' y; w3 N7 f7 F, e7 T
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications6 ~" J F: P* N
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB) R7 F; j6 \9 O9 [
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
* {$ A0 [% P) z$ p, `1 ^. N: k+ Etoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its* J5 l- \+ p7 l
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node- w: b4 R# M9 s4 b; ~
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is- X/ L3 ?' G+ C6 x1 o
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without! b5 _4 W' | d# g8 v+ ~
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink2 J( r; E+ v! o' F" k" D
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node: F: J6 W. ~) G% D6 \1 k% J
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
, b1 \: M* V8 m6 N& _8 u! s13
4 R2 v U! ^/ G& b/ Hselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts1 ^1 h$ b: F/ V, H+ j O6 i0 s
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under, A. X; S _4 ~: L; `2 w, ^% q
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB( G1 q5 B/ f+ m. u# S
and NVLink.
% Z1 [; g2 C0 p; E, }In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
# R, O+ D( U" Z) {! Y8 K20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
# a# t4 z8 U" T8 A! D& ~IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The# E+ c+ O/ V3 h, x! x1 d' {( ?
number of warps allocated to each communication task is dynamically adjusted according to the7 d |- h1 }' \* `9 \ y/ R3 N
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
! i0 Q( y8 t" m. u# O9 j5 q5 h6 V(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
( s3 T4 j! h) ~) n2 C# ~, n3 uhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels/ \ C2 x% {4 r. K
overlap with the computation stream, so we also consider their impact on other SM computation
/ e8 C( B d. t2 ]' a) tkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
1 ?& W- v* w. Y$ ~, w0 L6 Oauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
! C$ a& p% c5 [9 F3 dand the interference to other SMs.( ]& f+ \( |$ {4 z
% c8 d0 D- X5 v
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。% W3 Q0 k% t) M4 w
5 X: k$ J3 Q2 O( E% ^
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。6 Q; l! m8 W! I
# g# D* j8 N" O8 B5 N! B2 Q
目的不是为了绕cuda,反而是为了让cuda的效率更高。1 w5 D! T& c! ]& b
H8 t9 @ O2 ~$ C, E9 X& V, t类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|