TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
2 f6 R( l. S' F8 r, c) A7 N在论文里,这是第3.2.2节的内容
' w1 I; o C* U. w5 p y' _4 ~
8 I: x) B" ]: O+ S0 y3.2.2. Efficient Implementation of Cross-Node All-to-All Communication* i6 D* |3 D9 C% M% d
In order to ensure sufficient computational performance for DualPipe, we customize efficient) t9 @0 X# }5 K; V( s+ F% ^- A: }
cross-node all-to-all communication kernels (including dispatching and combining) to conserve& i2 i8 s: s& L" E$ _# O
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,
! }! Z" z1 k$ t# Q: e" {! H6 Cin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
/ l7 q9 v3 g& m4 b& s- tare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
- }* D2 y! T7 A1 L* j2 N/ V" K(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
1 y2 _! j/ W- }4 r. r2 F# X8 \token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its& j4 t3 ^& o) A( x. J6 r
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node" m) V, B5 ^* E. Q- e/ \
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is7 @' S' w( K0 I3 M, W: G0 c! h
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
5 g- N) ]7 Z2 l! `6 o5 o3 e, dbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink( N0 s4 r" T( o7 B, k0 K
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
9 J7 b |3 i8 J t0 Owithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V32 }+ W( Q1 A( r& g
13
6 E2 o2 Z5 Q; U9 w7 pselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
( ^9 X9 |8 N* ]$ T6 u( Y" [(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under9 d1 d* d0 j4 A) S1 p
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB% z0 F+ o3 G7 J0 [
and NVLink.) m: I; N% r: Y- P% Z
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition' N+ \# W2 ~, B3 G7 |3 K
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)6 B( E1 }/ X) n+ ?' ^/ l
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
n# Z# b) t3 g) [$ ]3 h ?' vnumber of warps allocated to each communication task is dynamically adjusted according to the
W' U$ B- [& X$ ]$ [+ Nactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,% F9 R7 p0 ~8 w
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also2 R* ?; y5 u; B# `7 o
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels$ [ W& |7 A" a$ P& O' N& y, T
overlap with the computation stream, so we also consider their impact on other SM computation
5 J- M; l$ H2 @5 B, ?# T8 ~kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
3 ?3 o8 w: f- H. B) o; f# Aauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
; a" z0 j; y6 e$ Q. ?7 {5 hand the interference to other SMs.) `& o4 t" r; B: S0 T0 d- M
M6 f6 }0 x1 b$ P+ _# X& c' J# a4 G
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
( }0 e! X5 x$ z& x9 n
! V7 ^. C9 ^# A' _5 M我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。" W3 I8 U# c: i' N. b! ^
: E) u; Y& N! ]' Z! r目的不是为了绕cuda,反而是为了让cuda的效率更高。
, W" J" Z* u. ?( j E
/ V, d6 @+ p4 M2 S8 \5 p类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|