TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
3 H8 L8 w. H6 ^, x9 X3 r7 m
在论文里,这是第3.2.2节的内容
& p9 m, u" J6 U6 u
3 u( H# [" h- _4 R3.2.2. Efficient Implementation of Cross-Node All-to-All Communication8 B X* b. n' L3 u" I, `; d
In order to ensure sufficient computational performance for DualPipe, we customize efficient
% O0 l# S; s/ b- y+ Ncross-node all-to-all communication kernels (including dispatching and combining) to conserve* e6 j4 _( f3 e. b9 R
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: x! {; g6 ?1 \0 |# d" ^* j1 Y0 jin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
3 P7 o/ y. F. ware handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB# N8 S+ G6 e3 y6 j4 ?
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each" v) h$ _# ^8 i7 r
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its$ n5 V$ N# F# ~3 H9 s2 z: Z: M
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
3 P0 y+ ^0 F) O+ W3 _index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is4 b0 @( l5 K8 H% e. i& e' [
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without5 d2 W+ Q L/ {
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink* X- p( c5 w$ V4 @
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node% w1 V' R" Z) @; ]- W( s
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
. k6 m! U6 {! `" U: I% |& x1 _1 J13
' V+ |9 b% y, q [selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts2 \* y% C+ G7 K9 a& B
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
0 \; b% {/ m& G' w2 Y2 Ksuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB6 U6 H0 O' m& @7 r' M
and NVLink.6 P- D, f, y; j6 ~
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
7 P, B) F& X: N20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
5 U; m: ~7 \7 w2 B5 pIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The/ _3 V6 A$ d9 B4 a
number of warps allocated to each communication task is dynamically adjusted according to the* |5 [. a/ V1 [
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,! \6 k! F. f P
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
: b& N+ S) L4 @) n9 shandled by dynamically adjusted warps. In addition, both dispatching and combining kernels' F. \ c3 x) L5 r2 P
overlap with the computation stream, so we also consider their impact on other SM computation
: U' J) L# W6 N0 skernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
! d" X& m/ Q' q$ ?" `% u# A$ \auto-tune the communication chunk size, which significantly reduces the use of the L2 cache: L* ~2 F0 Q" A
and the interference to other SMs.
4 Z* K3 K: z5 E" a/ W7 e2 ~" z) z% P6 W8 l; {
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。. V$ z! Z4 L/ |5 b( z- Q
2 d) F/ p2 x5 Z+ j/ o1 M
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。: X2 r# F2 M) n3 S3 G) N' S
; W0 S' C+ f# | m! y目的不是为了绕cuda,反而是为了让cuda的效率更高。5 G9 r9 ^# v) U, L/ s- G
# O4 L" {8 N. S5 \& O9 H0 B8 I+ O& J类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|