TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
1 Q4 J% w0 w+ J0 b, o( t. y在论文里,这是第3.2.2节的内容* P- j! o, o3 {
# U9 ?) L W, q5 O
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication% `* r- V3 a" R: f6 g
In order to ensure sufficient computational performance for DualPipe, we customize efficient
7 u8 _" ^. e' z+ Ycross-node all-to-all communication kernels (including dispatching and combining) to conserve
! z3 D; K. ~! Rthe 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,
; Y9 u4 H! I- m4 m* [) xin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
: m5 r# \7 E$ `3 kare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
3 M1 }& x0 x2 m7 b' v5 Z(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
5 K- }6 E: V$ S$ E& M2 o5 Rtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its& u+ a! V& B. h n. T& E: w+ H
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
# N6 _" G) u( @0 K5 A% Tindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is, i* N+ X0 {& x( o
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
2 ~: e, q/ s! \. @! l+ ~; X+ V1 Fbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
4 K; C# C5 C3 U+ jare fully overlapped, and each token can efficiently select an average of 3.2 experts per node% ~) U; Y0 f; \+ _& {1 V
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V39 F1 ^* H& D/ J, [ l" G
13# C% V! l2 e* Y# c. G4 V3 x
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts$ `7 J8 n! j4 p' |9 K" l8 \; a) X- ~
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under& s; E, J3 Y- a: H* p% j& P, I
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
4 n* j3 E% e8 m `* {and NVLink.+ E; H D+ m; Y! g
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
: i; _; j+ m U/ `20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
M! A+ E2 J( @" y1 B j. A' vIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
7 f! f8 j) m; L n/ D. G; lnumber of warps allocated to each communication task is dynamically adjusted according to the
$ ~7 u3 {) J) d: C) Bactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
* v3 _$ L( X2 q9 z& c) Z(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also1 ^ q4 N* w, w! E
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
: h" ^/ \9 E1 h0 v7 Q* o, T- poverlap with the computation stream, so we also consider their impact on other SM computation
- `" {/ h: s" n. p, ~8 f3 U5 zkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
% _* a) [( Y; C9 |. Vauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
" D- A- O P3 ?and the interference to other SMs.
; j" Q: |9 t# W. y3 H/ K% t. o, u0 t6 v5 D {+ V9 g& X
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
8 S/ @* j" r! V# q
6 q; L+ L8 q& O: j我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。7 |# @1 u% O9 M. s4 f; l( R7 u' E- v
. r( ^6 U) G/ K S) L! L! A目的不是为了绕cuda,反而是为了让cuda的效率更高。* C+ a1 Y8 R1 m
4 |2 y% Z! M5 F# d4 T5 \类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|