TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
, J, h7 y3 a" b: H在论文里,这是第3.2.2节的内容
, r- x, q9 @; \9 d
6 y$ A1 I7 z5 u+ ~4 u- _. o3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
% L$ V9 ?5 o8 R; {/ K w: Y& VIn order to ensure sufficient computational performance for DualPipe, we customize efficient( R+ G8 z3 b; @( E- z& s* j
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
! ?: U; f8 w; ~3 l: zthe 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,, }3 d9 R7 _- o; t9 m' k
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications |9 i9 Z( k/ C# R9 o% p
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB. }) D) ^9 D) q Q, {
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each* Y' s% U# k' c9 e& l0 A3 Q
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
+ i; _; T1 U3 U; R6 K3 Irouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node$ Y2 w5 G9 d6 G X; N7 G5 @$ K
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
2 R3 B% }- a' z. c; a0 U, U' Winstantaneously forwarded via NVLink to specific GPUs that host their target experts, without P, S* U; D- l2 }
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink" J% S; {0 [0 P' K& B( U
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node7 C0 ^; u' Q9 z; c+ [
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3- c- u2 I, w# o) [, v! Y
13
! y+ A! K! ?8 W, Pselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
" ^3 }" K. v! O(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under6 M$ B) F$ ]6 s: M% ~6 O
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB; |. n4 W1 F6 ?7 x$ d' y
and NVLink.
( Y( c5 v$ [0 b% l- J& u/ P0 B# U {In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition6 n1 o! f! f' Q1 V% W1 l
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)# Y& T7 h4 R8 {6 P
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The8 M9 O; D2 C' c r
number of warps allocated to each communication task is dynamically adjusted according to the1 [" a5 d" U" s
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
& m& T5 Q0 H, s0 h, W. h/ ?% X(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
5 r5 u5 q8 ~1 o* P" J( J3 k# phandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
. W8 G4 s; X" F( D, @6 doverlap with the computation stream, so we also consider their impact on other SM computation4 A4 H8 W" a& ^
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
2 @* s3 b6 u, a6 v0 Sauto-tune the communication chunk size, which significantly reduces the use of the L2 cache! K3 e s, g) Q5 J: W2 U
and the interference to other SMs.
% Q) i7 R$ Z! N* k V! t
4 }# F* D9 Q/ h; i0 `+ B通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。9 f6 Y" b2 o. }3 B' O/ w$ X
0 }4 [7 {' f% |- d; X
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
; }6 O5 o W4 Y, y- ?2 ?! C: D) y" n/ h
目的不是为了绕cuda,反而是为了让cuda的效率更高。# t! [& v! E" y5 p# n
0 H+ q5 Y! A* V( m类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|