TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
$ Y, Q- G( e4 S在论文里,这是第3.2.2节的内容, z! k5 u* z; C( I5 v
5 D4 d: S0 V+ A/ ~1 A
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
: @8 J3 H! c: Z* g8 ]In order to ensure sufficient computational performance for DualPipe, we customize efficient, t$ c" J) o$ w$ [
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
% c! R( s; k' c9 N- b/ ?$ r3 [+ dthe 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,
; u2 {5 K; M9 n/ z' ^8 |) win our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
, n! t7 }8 e7 d- q- E1 r! sare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB6 C% j, n" w' h/ K( w7 V, q _0 @" A
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each( N0 o1 D/ n5 _) Q1 l( u
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its, M V5 }2 ]3 S7 ^. ]! Y
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
% j4 P6 a( I, G& ^) Cindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
* `0 G9 y6 @' r* s/ d7 Ginstantaneously forwarded via NVLink to specific GPUs that host their target experts, without, _& N: o6 [# t, l" F& V# V
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
- V% l2 S5 D- l" s4 C3 a2 Qare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
/ {* N9 z7 z7 M' b9 Cwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V39 }% l* m* a/ N! e
13; ]- i4 {4 h+ e4 {/ x
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
+ O# S, E; ^8 K. y' s7 u(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under7 c- [3 P- s, ~% L
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB8 h0 P" o' ], Y
and NVLink.
4 ?6 L4 _2 o6 zIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
' ~0 j9 m+ ?3 m20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)( ?( l$ k7 H* u) B; D
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
/ Z+ q. v. X/ o7 z/ Unumber of warps allocated to each communication task is dynamically adjusted according to the
6 ~4 S" _8 m$ A" E8 l- _/ R: h3 }2 {actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,1 L5 E; U( n: C3 I3 T! R" d2 D5 x. X' B7 ?( B
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
/ h/ Z. }; C1 Y7 \4 j Fhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
* {( X" E+ z+ z! m0 zoverlap with the computation stream, so we also consider their impact on other SM computation! P( g; C# v8 ]; d7 A/ {3 P
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and {' F* {: A4 }) @# V8 G* t
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
! m" U" _& `+ C: qand the interference to other SMs.
. @2 e: `$ r' x5 r9 F: X7 f! n. x
/ I( y, c) e* A& [7 j通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
" n# C7 F7 B/ q) a( m
) P; y! c6 @6 t7 p( l$ l6 [我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。8 ~4 U* n- D0 l
# }4 l3 s$ E$ d; i9 @3 M% }4 m4 M目的不是为了绕cuda,反而是为了让cuda的效率更高。' y; u6 ?0 g; z+ C" ?
W8 ^+ `" W A: A2 c2 t类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|