TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
1 ]* J- v: @2 N
在论文里,这是第3.2.2节的内容
% k& j; D$ ?4 k
, Z/ Y# Q2 H; G3.2.2. Efficient Implementation of Cross-Node All-to-All Communication' t4 h" t/ T5 X! Y+ L3 Y
In order to ensure sufficient computational performance for DualPipe, we customize efficient4 h `- W9 Z' K- D4 B
cross-node all-to-all communication kernels (including dispatching and combining) to conserve( Z* z) L& A* e3 V
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," ~$ d0 J( |2 U, V% o3 r. K2 f
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications e. @! A7 K6 h% C, I
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
$ x1 o9 E2 ]6 {+ {) n9 p! a(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each s% A! N. p2 e+ D" i
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
1 i, `) Z2 t) f j/ [, t* |* Srouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
) H# s1 b Q7 v% i( S/ Q; ?index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
; r7 X2 A; A7 ^. p0 cinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
$ f) u/ n$ ]- X j. Zbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
; }( e. P4 y4 h5 P7 P/ u3 n/ Z, [" Zare fully overlapped, and each token can efficiently select an average of 3.2 experts per node( m% ~, N5 t; m* E1 z ]
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3/ f4 q3 g5 Z. R7 H7 J
137 B( y1 ]. X p% F' P
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts7 G( x. p Y- ]4 U- U7 ^$ @+ J- D
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
, w0 f' B! B4 hsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
# i- B- ^2 b! A4 Z, c! {' Q mand NVLink.% M4 H/ f* @! K% O& }- g
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
; y2 N+ ?$ |! b5 o6 C5 c20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
$ C8 P. e P3 C" N( }0 x3 {IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
+ v, p0 q. b# N1 w6 U* U1 inumber of warps allocated to each communication task is dynamically adjusted according to the
8 W8 c( ~6 D8 W3 s+ J% ?actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
5 o8 c% f7 F% j. N& v; z. p(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also% t$ j" E) K4 G$ v( f- C
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
" O2 y x) X5 g6 N7 C2 s: _overlap with the computation stream, so we also consider their impact on other SM computation. {& i& k% L" u0 P* G. G& M3 n
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
% T/ {2 X) J- N4 T- G3 V- f1 nauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
0 j5 t# Y$ F2 a2 ?and the interference to other SMs.9 z/ L5 G) l, A5 X( q
7 A3 w4 d3 M+ D3 k通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。6 K2 D& S* J9 g! u+ W5 N5 H: Q
( M; U% p+ \' @% g' x+ D我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。* F6 e! S! A! D; c: n, I" j
# D; O$ K$ U, x, d
目的不是为了绕cuda,反而是为了让cuda的效率更高。
. q2 l+ M% H$ \2 @. e4 b z
& ~9 o) }0 j. Q y类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|