TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
+ _2 O- p5 f5 E: Q' H7 Q: ~在论文里,这是第3.2.2节的内容
. t; N% ?; q$ t/ S) h0 Q7 i" U: v' A; `4 U* ]
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication! D1 J! D) l& z
In order to ensure sufficient computational performance for DualPipe, we customize efficient
# G2 d( v& h4 g$ Scross-node all-to-all communication kernels (including dispatching and combining) to conserve- m6 l5 y% O6 O: y
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,0 ^ y G! G$ \( E/ K
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications+ n* H# C! ?% N
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
' H! B/ E9 u1 q; W& R7 ^(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each9 i+ z3 O1 C) S2 t' n9 T) N D
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its$ Y+ @ {. q( Q
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
# r' V6 W( H, Q* u: Jindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
! i* _ T. J6 sinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
+ B6 ~* x p6 ?6 E7 T+ s. Ibeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink& Q' M4 u7 U E& B1 ]
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
; L+ P. H/ }7 E9 {( Q$ o) d% f7 K$ \without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3& e$ e$ b; G# U. F
13
7 Z1 W2 v" |$ Z: yselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts# x- a5 r* K- H2 k$ f/ d& S
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under7 \2 l- z8 G: J3 O6 M
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
$ N; w4 u- G; o# r4 l3 Uand NVLink.
! y* [ b# y) l. W4 d! Z5 bIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
& R& m$ j% s6 }5 d20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
7 |; \/ E2 D# |8 `8 n4 P8 |IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The2 p: U8 ^* u% G& i5 T/ ?
number of warps allocated to each communication task is dynamically adjusted according to the* {( f/ }6 R8 M( S! Z A" E
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
0 J# m" a2 u0 W7 G( H" O6 I5 w% d m(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
& e2 {4 a6 \1 M% zhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels( N4 R1 Z" p4 U3 L
overlap with the computation stream, so we also consider their impact on other SM computation" P6 J3 }' e" w, e8 s3 W
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
+ c7 N) W: o" N& v, }4 ~auto-tune the communication chunk size, which significantly reduces the use of the L2 cache7 S: K1 k8 Z5 Q0 h5 T
and the interference to other SMs.$ w0 J" }; k ^" y; n3 v5 j- J) A
9 ~9 Z$ S: X, R% x
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。/ n! q6 g, h8 ~- q
3 Q. ?- C+ @9 o1 M/ m
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。5 f1 T$ a H! k( f5 k9 R; u- k
" |# h& [& S% P- _
目的不是为了绕cuda,反而是为了让cuda的效率更高。: A4 `$ ^3 Q& Y, C
: X R, j2 M9 I$ J6 w类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|