TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
$ \$ Z* q4 y7 W) l7 Y/ V
在论文里,这是第3.2.2节的内容
. Q& n) W4 e z0 @/ w9 A
. e! v/ q% Q4 z4 z, d6 h4 ~9 j, @3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
$ O" K! w) x1 w! r9 U1 ?9 AIn order to ensure sufficient computational performance for DualPipe, we customize efficient
: Q& T, z# t: U( M3 O! w7 L* [cross-node all-to-all communication kernels (including dispatching and combining) to conserve
4 S, t7 ^6 G) n- P3 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,
6 q6 K8 O4 Z3 r6 Z* {8 `) T/ yin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
3 b2 V5 W9 G* L, ^" O8 L5 m' @( p: zare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB* F: S6 S) E) `3 C! \3 H1 A6 m9 s
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each) R, A1 D, w! `
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
6 @0 } t5 O$ Y9 h2 [) @! W' Xrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node [! K: d# k s, P3 N2 I5 Q" t
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is. c Y4 S4 e! c1 l( r6 T4 ]0 R
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
8 ^! Y: @- @. x8 n! x& I: u' A# O& x& N2 Jbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink! S b% X" K. z6 w5 I: o
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node, }, {6 I0 m6 V* e" U
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
. u) P1 e- u, m: }$ V: y13
$ l$ P# q- \1 _! n5 I4 z5 Qselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts, o! r6 {# O0 d
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under+ m) ~4 R8 \# }3 v% J0 A* z9 s
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
" q0 ?/ j6 J( t+ p: F" Q6 \and NVLink.
; Z& v- T4 i% J3 v* B; nIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition. O' x, F# [: D% k$ u8 r
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2); \% w/ _0 Z5 x9 A! p6 h6 g
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
) b& t1 ~0 k( ~% M( R' Tnumber of warps allocated to each communication task is dynamically adjusted according to the
! w2 {6 L- X' G$ b6 v) h; sactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
/ M7 w4 y; V' T(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also) ~$ K1 P( I' B H$ J
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels; Y; V" ~" d# s7 `1 L
overlap with the computation stream, so we also consider their impact on other SM computation
# V* k# e+ l. \) f& ^% F9 u' Qkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and( w" b/ ?" w. m5 K4 }* d2 l* W! h
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
: U3 G/ u& C7 M: @! Land the interference to other SMs.
# l8 ]( R. [8 D/ k' ], \3 c6 l: ?- C; a. _
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。& N5 L+ E7 Z4 N$ w0 J
5 v1 g! R- ~. E% E, H& E我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。4 m0 X4 s0 x6 u9 c& E- ^ E/ z2 T @
9 s# b: k$ u3 c) b. }$ ^# a% F目的不是为了绕cuda,反而是为了让cuda的效率更高。
2 t$ B2 Y( R" U+ [& E' k: W k' P* I1 ~
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|