TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
: I: \3 j9 X9 Y3 k& X" m' C e在论文里,这是第3.2.2节的内容) q6 ~7 h& b6 f0 l
& x* `9 J' c: H# U
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
7 b9 C! Q% b: dIn order to ensure sufficient computational performance for DualPipe, we customize efficient
- @% }# }) H, n8 kcross-node all-to-all communication kernels (including dispatching and combining) to conserve8 d* Z5 n1 R# y2 a* ^, T" v' P
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,7 k1 [* x6 B; M$ j0 D, h
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
9 _' z# d% g* I& S" ?+ i/ T: care handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
9 b) ^1 B$ O+ x; Q8 \. C(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each8 R8 U# {1 n0 u7 x9 K% h4 @* a0 a9 g
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its% E \1 o2 n9 R2 k4 T
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
. C: {" w/ M3 V; q$ Z; w0 Vindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is/ @/ G( r/ K( V( G3 R# c
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
/ P8 S, z: T# O% i1 Ybeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink0 Z. ^' ^3 S8 I5 W* I- c' f
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node$ @/ G1 c. v/ c, h3 G5 Z; I& C
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
\) {2 M& ~& s6 K4 i7 l133 S% z8 L: G. [1 u* @" k5 k s
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts: C# b# D O. ?: d, q3 T+ k
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
, y w `5 Z5 \! H( p w" Msuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB3 b+ K$ T$ B( N; S
and NVLink.
0 z1 E* ~6 ~7 _In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
+ E& J+ _" T( Y: M% ~7 w, Z9 F20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
. V! a; v0 x9 I" f8 IIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
9 b: n+ E/ ?% \4 ?( Inumber of warps allocated to each communication task is dynamically adjusted according to the/ p" w1 S) {4 P3 K8 ~. B1 a
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
- n. p3 X& u0 H6 D- V7 }(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also9 ], ] @$ O/ D0 C
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels' B# {- E4 R( ^- o$ o9 c$ N* V
overlap with the computation stream, so we also consider their impact on other SM computation
; ?& h/ v5 @1 F# g* rkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
, ^6 s0 s: a' j g% E3 U, `5 [auto-tune the communication chunk size, which significantly reduces the use of the L2 cache4 u4 j4 T) N* y( c) p
and the interference to other SMs.
( q) E0 O/ I: o' v
4 b+ e F1 A) K2 W通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
6 r" V" o1 f, v$ a1 {! G: J2 n
7 l4 e! F% i& U& X我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。% ]" c! H2 a, |
: u7 V% u1 }6 M目的不是为了绕cuda,反而是为了让cuda的效率更高。
* B( H! C6 C3 k+ X0 B) k, F, C$ V7 K0 Y
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|