TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
" u7 i/ t5 W+ D$ Y3 G8 i+ O* v* ~在论文里,这是第3.2.2节的内容
2 Z: Z9 o5 [1 w) ^ @% j
1 U: i/ A2 {5 Z3 G9 i& o/ N3 k* V3.2.2. Efficient Implementation of Cross-Node All-to-All Communication. R# ?( S# Q# M
In order to ensure sufficient computational performance for DualPipe, we customize efficient
: q2 f$ R0 X1 Q0 V$ wcross-node all-to-all communication kernels (including dispatching and combining) to conserve
5 @; S& r) c6 @& U/ C8 m+ N8 Wthe 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,
9 g f( j. _$ J3 L$ v3 t" @in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
- W7 n/ @9 M2 K8 o2 c3 rare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB: k9 E' r6 P6 i
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
, {9 p$ E8 k( P4 U, [token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its7 I2 ?# `8 L6 e
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node" n, c7 x R3 G2 ^$ k
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is4 a& C, f" A* ]% L& w, Y
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without# ?4 q$ k, j) q
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink3 D( \- {8 X J% Q
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
! b0 o& q3 j6 ^8 Y2 twithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V34 g, n& Z1 O1 s; K$ R0 L: W
130 l" q# q# N( ?" ]. E4 x9 ?5 G
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
: q" B% U+ s5 _7 a( c7 x0 {" Y, B(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
* w& H, R6 J; w' K* lsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
6 Y3 t3 p: z: @) pand NVLink.
) }, H( J8 k8 o; Y& w) n2 t: _In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
8 x \+ ?+ p. w: k4 A20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
) h$ `, Q' Z* F( ]IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
: l$ I2 h0 z' G' ^# Vnumber of warps allocated to each communication task is dynamically adjusted according to the
* C8 g/ }% J0 P$ jactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,. l, K! w( @$ W2 _- x+ F
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also7 h& q6 `; l0 S+ `; `& \2 _) c7 w
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels: @) y7 x7 w) O+ y; V4 v$ ]1 H B; z
overlap with the computation stream, so we also consider their impact on other SM computation
' j( P$ X# R0 M4 o% Tkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and4 l l: C9 p+ v( j5 V( q/ }& L
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache1 [: s) D' q2 |
and the interference to other SMs.# w. X, x; p$ r! l, Z
% b3 z" b- E( t% V# m通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
9 U- W2 ?# {. q% e; Y4 a: R# X, w8 e! F7 {4 V; M! @
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。" _9 Z$ G* T# h2 u0 ?9 ]9 |6 _: T
: k4 r! _5 a. I; P* J
目的不是为了绕cuda,反而是为了让cuda的效率更高。
( ^$ E; j9 R+ H+ g c
# j% t: ~, F0 G E类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|