TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
: g: N$ B& p0 r
在论文里,这是第3.2.2节的内容
1 c( M$ t I! n9 n4 n' m& H& L b1 A$ B1 D5 H: N
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication( c5 ^: M% i: U d" ~7 x
In order to ensure sufficient computational performance for DualPipe, we customize efficient4 G1 a& ?' ~( ? }0 \& w0 s
cross-node all-to-all communication kernels (including dispatching and combining) to conserve9 s+ N% C3 @5 ~. H1 z) A
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,* e5 b( a5 j% z/ V+ j. }" o
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
. Q2 b" W; s5 M* @6 h( [9 E* d- Fare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
7 @; z+ o1 c9 R(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each4 N, ]- }* e9 A# K( {( ~4 b+ x8 g7 i
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
. P8 [9 L7 l4 j( K+ [routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node3 {( l4 S0 @4 _8 X1 v9 d4 A2 @
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is$ E' D f6 O! h, d3 X+ R% K
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without- Y* s k. Q/ W. e- x
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink1 ^3 m/ k2 |6 F0 V
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
3 E' U5 y+ c0 Z, d: {5 cwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
; g6 x$ X# D* L13" v( u. H8 \3 n: p3 ]$ z- y
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts; _" n- O# E5 G6 v. B5 B
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under# X3 U3 V# [( D2 G/ ^# L
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
- X: H# X w6 [3 band NVLink.
/ V i) z# z( |! i8 R% `In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
4 h8 O1 `: a+ T& i20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
+ |% R& X, M0 N; F7 v3 o6 AIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The2 ?9 V3 S+ F' K, N+ J$ k
number of warps allocated to each communication task is dynamically adjusted according to the2 t5 o' M) e8 d$ Z+ [! J) e8 o
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,/ _6 U: L8 V0 D" Q' k/ w
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
0 a( a2 A) u& h0 A1 S& h1 thandled by dynamically adjusted warps. In addition, both dispatching and combining kernels- u ~# a1 r- w. n* e- `, ~2 w6 j, ]
overlap with the computation stream, so we also consider their impact on other SM computation
8 d: L9 l. }7 H& akernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
8 L5 y( c; l. o8 xauto-tune the communication chunk size, which significantly reduces the use of the L2 cache' H* D, W9 k+ K8 B! {; p7 @4 `
and the interference to other SMs.
% t+ V( v3 c3 ` w9 }, j4 s+ O8 Z) _: I( i2 l- P6 n% r0 o
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
+ A. e Z9 D8 A/ J# U q: Q+ Z
, V/ `% E0 n6 B/ M5 x. Z- e我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
& j, Z( Q, Z( A0 ]) b1 ]. W# a: V, F3 ~' e* `+ t5 `
目的不是为了绕cuda,反而是为了让cuda的效率更高。
/ j6 }- {8 O3 H' E/ p3 B' x2 c M0 K# @2 y' m5 T2 q
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|