TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
( b! v d0 {: X' `) d1 {
在论文里,这是第3.2.2节的内容
}- g. p% _% K; g1 |+ L
$ ]# r3 P5 T5 Z1 r, c" G6 L1 n3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
* @4 M4 n8 U4 CIn order to ensure sufficient computational performance for DualPipe, we customize efficient
* |/ e, ]3 ]: S3 @cross-node all-to-all communication kernels (including dispatching and combining) to conserve
; `# v' @- w3 O6 zthe 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,
- ~3 B2 F( h$ e C+ Q* N) ~* ^0 J& Fin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
' t% |! {2 `, X2 zare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB2 B% N3 n; @ k6 o
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each; M# x% K+ @6 Q$ [9 O
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
, H0 W& w) T+ c2 l- K7 t% i( u( f( yrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
9 l9 Y, G$ ~7 ~! uindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is K6 z1 S* ?2 ~) q' l* t F
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
% A8 ~! _" [* }! x0 lbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink+ t: B/ C5 s [
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
- u! o! h' F t/ e4 O2 p% I: @without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3% m! Z# W' c+ V: E0 [9 k2 u
13 h: U0 M! n' L, s
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
7 M0 D0 h( {. J% c& V5 z(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
( C% y! s6 K* Tsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
8 w; \( r7 P- g# Q) ~2 ~and NVLink.
N3 K' N! p$ o! k0 @- X; Z0 Q2 tIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
' x" d. q( L, Z20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)' |# F0 N& F) R: M# z; ]6 q
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The" T) G: [8 m; d0 M7 \
number of warps allocated to each communication task is dynamically adjusted according to the
$ C, k' G; \3 V2 H7 n* E& r; ractual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,# U2 n. [/ k! S- h; N
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
8 e% w" R3 s- j# whandled by dynamically adjusted warps. In addition, both dispatching and combining kernels- N2 ~! t. T7 M. Z
overlap with the computation stream, so we also consider their impact on other SM computation
% l0 P% S. h6 Pkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and3 P' x+ T' Q) g) F# v I
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
; z6 P# e/ R; v) n" J5 \5 mand the interference to other SMs.
3 e# h z, y( V' e: R4 w V; M9 }
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。( x' E/ p! [: v; H) j; ]: g& U( e
2 t5 Z4 I: v2 ^4 z" i我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
; S# [3 g- `9 A0 _+ D! ^8 u4 R* n v7 h8 q, a
目的不是为了绕cuda,反而是为了让cuda的效率更高。
# H- d4 o8 H1 v4 B5 Y% z& w
) B( _9 X# ^1 a' S类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|