TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
# K# i) ]5 w. Q9 V% _, T4 o在论文里,这是第3.2.2节的内容& M9 S5 E4 @1 m4 p$ T: z, M
) I) c/ U Y/ { i) `3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
4 Y3 a" R1 d* U/ q wIn order to ensure sufficient computational performance for DualPipe, we customize efficient u2 C* X% b. M4 l( {4 [5 Y
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
T, O g W- J" P. c3 I3 hthe 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,7 u! h a9 H! f- v# {& a+ c
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications# f/ g( ^6 U( `2 n
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB5 v9 T" r- Z+ c2 V: A4 y2 u. n
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
9 U/ e8 b( c" Gtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
$ p' j' k" l8 Q. rrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node0 c1 `. S1 ~& ^ h
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
8 r& @/ E5 T' _% Z& E3 u4 Ninstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
6 J$ i$ L1 A& X/ Q3 y7 ?! S8 Abeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink; L" i+ @" n9 r
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
7 f9 K$ U2 `2 V5 i7 Fwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
0 O3 \7 u9 u, }13% f7 z6 N: w! k, r4 S8 |* ~
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts/ R& S; a9 R" l
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
6 v. u& X7 F9 N0 c) F+ D% |& }such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB) C% U8 [% C# H' n2 z0 c
and NVLink.
9 o( y2 U! A0 m3 UIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition: u* C" m& \, Y2 P
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2). L% y i8 l: X |; v- H/ Z; z
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
$ W* I- {3 g' ] y5 S }number of warps allocated to each communication task is dynamically adjusted according to the
m# P, g( V, R# E, L% h4 @1 T; qactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
) f$ L. i' ` b2 [! i* m(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
2 X/ }7 j3 Y2 U, ? }handled by dynamically adjusted warps. In addition, both dispatching and combining kernels+ f# f. w" f* `$ y
overlap with the computation stream, so we also consider their impact on other SM computation
+ [. ?% a" r/ p' d5 Qkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
) j) h4 [9 z, S) w( I, F) ?' Aauto-tune the communication chunk size, which significantly reduces the use of the L2 cache$ ]8 [9 ~/ `9 p* q: P0 M
and the interference to other SMs.
4 e- O+ p: s& o6 F+ B1 w
) ~7 f) E3 V2 \6 f& E2 }+ l0 ^4 x6 o通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。' r0 |8 d' m b
0 A# A/ i y! c
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。6 b+ p- x) |4 |2 G. ^( n2 [
5 m! u4 y2 G# x; S目的不是为了绕cuda,反而是为了让cuda的效率更高。
$ u% Q5 v8 _# x( {9 `7 y, l. g( H
v- ~6 B9 S. R6 w' |# Q类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|