TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
% W& v9 M- J* @2 D; `% B, t在论文里,这是第3.2.2节的内容
. } U m% v* K/ ?5 c
4 q% T2 Q6 Q7 |" Y3.2.2. Efficient Implementation of Cross-Node All-to-All Communication8 f0 f. d8 G/ m2 `/ n+ U* M7 C( X6 l
In order to ensure sufficient computational performance for DualPipe, we customize efficient3 R/ I$ z6 X9 h( I3 [
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
! Y3 E: G+ j3 G2 Tthe 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,
! A+ P! s8 ~6 w0 k7 k* ~. uin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
9 n' G$ f/ Q( K; Uare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
# K7 _" X( H x. X: Z2 l(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
7 R% s0 n7 F+ d9 ktoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
+ p) t: O! [5 X0 `/ \routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
+ o8 ~9 ?5 a1 ~) ` }) nindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is* }/ b, T U& R) ^
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without- H! ^+ p9 R- M6 X, a8 e
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink* m5 {# J7 J" N2 \5 W! N
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
) V, a% B5 F6 A$ }* p Fwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
1 s) c- P N6 Z) [+ j3 E" Q) H137 D1 j3 n7 d; B) r
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
0 j$ z6 ~2 K( |(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
" Y9 x9 z5 h: D# C* U9 n- Psuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
; b6 X) C) t- fand NVLink.
8 G- z+ D4 d+ p, e) uIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition8 M7 r2 Q% y+ [6 F; @$ b+ M
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)% H* \% y' d: ]0 z
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
6 Z4 n" e/ [7 O+ R( b! f7 B; S! Qnumber of warps allocated to each communication task is dynamically adjusted according to the
* G: q% x6 c2 W1 K! R G6 c6 U Aactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
. p; k! S+ V0 @& k( R9 ^(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
9 s! T S4 W6 ~( d0 E, c/ bhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels& v! X" u2 O- d: j& T
overlap with the computation stream, so we also consider their impact on other SM computation+ i" ^, |& `% Y# G
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and; B$ f; Q* _" d, S) w" n
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
' W( Z+ s# o) C* Aand the interference to other SMs.+ d: F/ w+ v! m9 o& L7 z
9 C( ]9 c* E7 p z/ G通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。+ M& B# T8 p% z% M) ~2 J2 H, c0 n4 C
. t4 l5 N+ ]4 w/ Z! r3 |) O1 L) v5 h
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。+ }3 N5 v/ F) Z7 D
+ F1 Y$ U F- |3 I( g目的不是为了绕cuda,反而是为了让cuda的效率更高。
/ ^9 i+ V) ~' n$ J+ o
v; c9 x! H' h0 }3 C( _类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|