TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
" ?2 P( ~# J- V/ T# j6 a
在论文里,这是第3.2.2节的内容9 ^1 D& S" D) I' f5 s6 A0 m
, f# m, }5 o2 F9 r4 j
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
) X( i2 \9 Y1 v, BIn order to ensure sufficient computational performance for DualPipe, we customize efficient
* n P/ g- ]/ R. v: jcross-node all-to-all communication kernels (including dispatching and combining) to conserve
$ ]% f- w. E6 q; M6 Y$ R( o! f& @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,+ v; T8 g/ n& Z& ]8 T
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications1 Q9 I E5 F2 f1 x8 U- y/ k9 [3 \7 M
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
8 f, x8 z) O3 ~1 u) c/ S. \8 p j(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
# Z2 F6 S' f' U& Z0 W$ V& ttoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
l: C2 I5 _$ [ ~% j2 \, irouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
( ^% c3 k/ H( p! {4 I- Gindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
) a0 d6 A; a4 g# N1 w+ minstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
6 ~8 l6 o) W1 q0 u) m! s) [# ~( F0 ]being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
# i+ |" e+ m) k4 l3 s4 z' yare fully overlapped, and each token can efficiently select an average of 3.2 experts per node- ~: z( e' l+ X, J
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V31 h# _# \! e/ k8 g5 c! G% X7 w
132 i9 |1 ?9 u( n4 f, k( l
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
' e" k; g7 f3 C% V# L7 r6 }(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
- |+ z( n6 U7 B- c) lsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
5 B5 ]- T- X* G4 `" M# uand NVLink.5 }- |& Z- m* @7 ?8 F" ]' I: g
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
3 n! E, Y- y3 A- G( T20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)/ j# s. U, J! }: m/ s& }
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
a) ]% f ~7 onumber of warps allocated to each communication task is dynamically adjusted according to the
; n, I* ^8 ^! u. h+ uactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
* R' t/ p: @; T3 i) u9 C1 @(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
# M, C2 H3 |! q$ P& s8 chandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
! h" L7 ^) p3 T2 y, R, @" y; L$ c1 Boverlap with the computation stream, so we also consider their impact on other SM computation
0 `! D* G, f9 l, R* I0 k* gkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
. O* r- J9 r1 @, [1 z4 ?0 mauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
& H: H5 t$ ]* V% ?. T5 }9 Tand the interference to other SMs." n& O/ C4 R. ?$ k( S. c
, Q6 N+ E, k8 `! j* O/ S; O7 ~; v通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。 A. |. v5 z9 `0 |* C1 G# r
* W" I9 ~% X9 H我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
" R& M+ {, `$ V$ ^6 j3 A7 J. g) i/ E/ d% L, m$ t/ X2 T
目的不是为了绕cuda,反而是为了让cuda的效率更高。
4 \. s6 r. {% k) ]& z. b2 m; j- h; a/ `1 Y8 |
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|