TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
) e- Q& a, ^, M1 e5 Z9 h7 j
在论文里,这是第3.2.2节的内容3 p& _" L; B8 {1 Z# A: k5 J6 d3 B
* `8 l" q; A5 a, x$ ]- K3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
9 z# y) E& q {) D0 G+ @0 kIn order to ensure sufficient computational performance for DualPipe, we customize efficient
x1 k; T/ k( t$ {% T1 |cross-node all-to-all communication kernels (including dispatching and combining) to conserve n$ t% E5 b& B- {) A) 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,
& b; P3 ?6 b }6 T: L& Z$ E. d/ i# uin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications5 h& g. E* ?* q3 p* b$ h# P" U
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB( C1 R, S0 C- x; t8 ?
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
& ^" P8 o7 l1 E2 E& Ytoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
& o: [2 ]. ~" T% A# hrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node5 B q( m5 O- m) `- f
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is4 t7 u5 f) h* c. h0 j
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
; y, v" S5 ^! U. _- I( S! T }being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
: X" g' h' R' L7 g; dare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
- y2 D4 c/ E* g% zwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V39 A6 ~: j) |. C* s- \% W
13
+ q0 E- V: @6 H: d* V$ P' Q8 i' @selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
5 |8 }" K5 v/ C(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
, T4 N V5 l: ~4 L+ nsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
' W% u b5 |* Hand NVLink.* U' L* b% \5 X! K% a
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition( h% n6 ]% ^: A- {3 c
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)) H+ j( S6 d0 u0 f% H4 V
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
: L3 {' s( m+ z" k6 v2 g, knumber of warps allocated to each communication task is dynamically adjusted according to the
# q0 X. h' h$ E& C+ H7 D5 S0 bactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,5 d- | z5 d! O( }, B0 D4 ]7 }3 f
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
3 d+ D) o2 N: u7 n' ]# v/ W7 j6 Yhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels2 t) h) _9 H6 o) T
overlap with the computation stream, so we also consider their impact on other SM computation
0 c( p( d' q' y2 V; V zkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and2 ]2 j3 G' z/ y% ~& N0 C% H- x
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache1 f6 b; B1 y: J; z& W) h8 P
and the interference to other SMs.
: I2 [2 [& H& k8 W0 b
& T& v, Y8 b9 _' T1 q+ B通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
& U& {$ o+ \ x4 g4 t* p
& v& C9 w" E- N我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
* V, H- j. H& p/ G0 U7 d4 H0 `' {" f2 F0 l7 ?% o7 x" U" J8 E. [
目的不是为了绕cuda,反而是为了让cuda的效率更高。+ a0 O8 F0 \; s" S" @7 |
; l0 \4 f& I x# X2 Z
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|