TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
. P3 }& |6 L5 T+ e, w$ F p& Z
在论文里,这是第3.2.2节的内容
) b- o4 H0 `3 k1 j+ H
8 C8 ^+ {7 [5 J; W6 `3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
7 X! z- M/ \9 L8 ]0 R3 xIn order to ensure sufficient computational performance for DualPipe, we customize efficient
# a1 M) O8 W, D6 B5 ucross-node all-to-all communication kernels (including dispatching and combining) to conserve
: _7 {0 d& }, sthe 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,
8 I7 T0 g4 I' J3 |# min our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
/ B: L. a! C# [$ j2 o) Aare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
3 u8 x# ~) J! y# h5 N) e(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each J; K& n @8 Z- o6 Y
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
6 B1 w& R6 ~; y6 Q* Z2 R; E3 R3 Orouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
# j1 j7 F. l/ |7 O; t! Sindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is- k" S8 d7 y, [( I0 B
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
( y% Q8 V3 i0 W" {0 i$ M9 ?being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
/ q. V" {# o0 M5 |, R/ sare fully overlapped, and each token can efficiently select an average of 3.2 experts per node5 K8 ^' I$ w& y( a
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
Q0 K" I7 a4 `2 W x13
4 ]: t) ^7 y6 K, K0 Pselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts- b; q% I( s4 \6 M+ G- q' b
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
. C% e$ o, @( j2 Esuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
; V6 l! E. H6 ]4 k' V7 P, K+ Qand NVLink.
# v& Q4 T+ a% S6 x7 ^In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
- j a1 { P5 {, w" ^# J0 ], n20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2), I3 [! x+ P) C2 A" W! b
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
& u7 O: I! w& p: q0 Knumber of warps allocated to each communication task is dynamically adjusted according to the/ ~. Q# F& J( M7 e$ @" p
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
! F& {% f( o& o0 |(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
/ d) e4 d) l# E+ Fhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels6 E8 l5 S/ F; W5 Q8 ]# Q2 K& G z: ^
overlap with the computation stream, so we also consider their impact on other SM computation4 A9 c# N$ h7 H# Y) r% i
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and: C1 i) f& ^* W. f% b( L9 U
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
+ U7 C' P5 O# J0 Q8 {and the interference to other SMs.; A3 }+ \ J2 R {" T4 V) r
; M" _, A. l* `$ {9 }. h$ a通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
' L' g; f. ^; h' h9 L8 i% M- S3 c' R! v: g C. `
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
O0 A& T p9 F8 H; p2 f2 e3 ~* w! _7 Q, t; J
目的不是为了绕cuda,反而是为了让cuda的效率更高。) G# b3 n( l8 ]
3 Q) a6 s( @ X; K5 z
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|