TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
) }% u" e" ]$ k* ?3 M
在论文里,这是第3.2.2节的内容! M' f' S0 a* A
! i$ \0 l; X0 f' d/ `
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
0 l; B& X3 m6 n1 F/ O; g" ?3 DIn order to ensure sufficient computational performance for DualPipe, we customize efficient
+ n; X5 K- ~3 R! Fcross-node all-to-all communication kernels (including dispatching and combining) to conserve
$ q% [2 M3 @3 [' z- p d1 d. kthe 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,) O5 [8 E" o3 p2 Q6 \$ s1 A3 X( I
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications: R, s, }5 |( |+ g" U
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB4 o* ?/ @1 W0 V7 N- t* k
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each5 k' B. c* T2 O) B& ]
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
( f, m# x/ C3 E0 Z' t( g: `routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
6 V# F" L' v* s, o, Vindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
5 q+ {6 e4 [! Y! Y6 `: Hinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without* a( r7 g$ b' ^, p" k/ \
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink: Q4 a2 w# v7 a+ [
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node$ v" A3 j3 d* A# A. \8 t/ ~
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V37 l+ i7 i+ R! `5 x
13
& q; P& e- a0 @' O/ h' y$ nselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
v$ z3 J, v1 p! a, p(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under) e8 D0 c3 e$ @% V& |. P/ F
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB; ]- F2 H( A! D j+ v0 f- f/ x
and NVLink.! K4 `3 Q( _4 _* ^
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
# T; F0 m, F3 P" L# E5 r20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
7 Q7 I- _' o" P! Y9 j& @IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The! O% z9 {: [! ?# T% V: n) d% C8 \; O- g/ {
number of warps allocated to each communication task is dynamically adjusted according to the
- z, p* p2 r7 U# lactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
; z8 |! J& q) Q. _& k( p. r6 C(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also+ \- @2 I4 q2 b5 [6 v8 y* c* Y
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels. r4 v$ Z. _4 N) s( p7 M
overlap with the computation stream, so we also consider their impact on other SM computation
) k0 N$ q) `6 k% a, B5 {! B2 Ikernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and2 E1 f: u5 r. A8 s0 n
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
F7 \7 c1 T) g+ qand the interference to other SMs.
. K# c' P" u8 u# O+ x& Y! E" m1 N' f f' x$ a, b; }# z7 W! ]* p1 r& a( a
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。1 m/ b4 q5 E8 b
4 O; ^ \5 d% x& M: W) n6 U7 L我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。) x9 y3 |1 ?% i4 v9 i, o3 ^3 ?
5 W- ^) C& ~) H7 l
目的不是为了绕cuda,反而是为了让cuda的效率更高。. ~. y' K* x* v2 ^" s) [
& K7 f& d! J# x
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|