TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
7 X5 ~5 \' W8 f4 }在论文里,这是第3.2.2节的内容
* x% q: \+ S( M' b; e8 r, ~+ [. u2 t4 Y/ B
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
, P( ~% P' g0 _2 r. bIn order to ensure sufficient computational performance for DualPipe, we customize efficient
4 W& O4 L: ?* v* @. {" J. }cross-node all-to-all communication kernels (including dispatching and combining) to conserve$ ]& b/ p+ } |8 [: I# p, h% \
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,
2 d4 s" x' Q. T2 Fin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
* w/ H4 O( {* h" b; K+ W/ {are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
8 L% d3 R5 N2 L(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each. U4 U* L, n8 M: p0 z: _
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
, @ a9 w8 G1 A0 Irouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node) W6 Q9 w1 s5 t2 y, H+ R6 [$ k
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is8 N) C# h7 k2 h/ ? J
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
% Q- @, `% H) f9 e% J& dbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink+ M) ^" z- W9 n; U
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node+ `% P1 [& v% H2 b: m; q2 o; i
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
* i1 N3 Q) Q3 a& @4 n8 D13, j# M' n. K. e/ ?7 o- m+ {
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
' Q5 E* m4 v% [! Q(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under6 ~% Z! T; r8 [7 J/ y
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB9 c7 @& q- a+ ^8 L# q+ x
and NVLink.3 `' z# N+ K7 K) q: G
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
. h- S- {# a5 O: K( x20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
$ T& h8 l3 v& F' P" G: ]6 s8 rIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
T* K1 D, R* x- l2 \1 g: C* s$ L) Bnumber of warps allocated to each communication task is dynamically adjusted according to the
: Q% ^. j2 w( P1 P" ]9 o" cactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,. X/ |* m& A7 c# \' ^0 L
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also6 P# g9 c6 W. f0 G6 ]9 g1 m
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
* T+ U% v! F& u0 g S7 Goverlap with the computation stream, so we also consider their impact on other SM computation
7 T5 a5 ^, ?; J# _1 ?9 `6 ?kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and) ^# r/ q2 P3 u
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
6 V" ^ |3 F1 o& t+ N. `and the interference to other SMs.
' Y0 V2 ?- u( w$ J' u% _4 v3 A/ J2 L0 y/ Q* M- Z
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。: M: j: J- t, v
' }7 U% R1 D. o; B( f8 b% ?我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
" h" D. |8 j# K' Z5 p0 S
, E! k( n% i; C* S6 Z _$ F目的不是为了绕cuda,反而是为了让cuda的效率更高。
* h* o: i2 D: x8 i. B6 T8 x( n, T5 R1 R* E
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|