TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
0 r% `, m; M( e2 z在论文里,这是第3.2.2节的内容! W3 b* b2 ^2 W
; ^: m( {" P4 d! h8 U+ n
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
3 c9 f/ R8 {5 ?: w3 `4 iIn order to ensure sufficient computational performance for DualPipe, we customize efficient
* c& u% ?* X" N, v zcross-node all-to-all communication kernels (including dispatching and combining) to conserve
9 C. e6 d; K3 H2 i' N& jthe 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," {; t& b, l5 r& y+ [; |
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications( b0 K: \* J& Z: y2 o9 _ X5 Z( }; |% f
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
/ o5 K! G8 k6 V(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
. [6 q4 B/ x' D0 Z4 E/ s/ ttoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its- u6 z7 M+ @4 d* U
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node# t. i& @% o' V7 P- L5 B
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is1 Q& z3 k; ?* ]# r4 a- @
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
8 Z0 z. m3 M& e" c' \; p! Hbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
7 f. n* y: x9 W. V3 T! D' Y! J3 B/ T! Zare fully overlapped, and each token can efficiently select an average of 3.2 experts per node9 k8 D% b2 _$ G
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
5 [5 g N9 m0 K: ]" r% h13) B& W) l1 B2 d# a0 @) t: A; y4 g
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
3 ^+ a7 |! K# Q1 ~5 g' W8 j(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
' g. k: E& J( o& m) f% j1 Jsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB, R- p, j: w* q3 ]2 k4 m
and NVLink.
3 W, @7 ^$ t: _; y8 @7 X# k0 uIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition2 _- x9 j5 }8 w- A) T: L( F. i
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
- r5 H0 V1 c+ _2 F8 \IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The* Z, Q0 M, ]) s+ Q$ |
number of warps allocated to each communication task is dynamically adjusted according to the
, s7 O& ?! q, N* t, w+ aactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,& w* a( ~% S1 ^8 Z0 q
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
: B% L" Z! J8 K, H; Ehandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
! x% k. J. |+ ^+ w6 x- c' Noverlap with the computation stream, so we also consider their impact on other SM computation3 k# U3 M. J' u3 M) l6 G+ n$ e* [
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
$ z& ^1 D7 j! j$ wauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
2 r. i( v- u) c5 c6 [1 c% jand the interference to other SMs.& | z0 B& N1 K& a; F' S) T
) p: Q; M- _' s# Z" u" h- m& V1 e9 c通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
% I' j( j3 e4 y# C; p( @, j0 v+ } K) i. H! c0 q1 r
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。# {' q- o5 e* ]. l/ n3 Y
. S1 N( A+ T* r% r# T目的不是为了绕cuda,反而是为了让cuda的效率更高。5 i! ^4 U* m! V
: f1 ?. O' }3 U, L' J6 \( G
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|