TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
# s6 D* y& y' v- P
在论文里,这是第3.2.2节的内容. K( o& j2 F* Q8 h% s
4 r4 Z U0 G' z' ^! Q0 ]9 T7 K4 H
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication0 K: R8 N$ ^8 M" u8 E e* O5 q
In order to ensure sufficient computational performance for DualPipe, we customize efficient& l7 a5 E/ X& d$ O2 {! d
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
) _ `3 k) R# y) X- C9 a: r Qthe 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,2 i3 q* q, H$ N( `9 ]( I
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications# |0 g# F4 ` F0 B4 K
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB9 M) e7 e) V" \/ w
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each1 |4 E9 C0 ~9 ?+ G" s+ b
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
7 D$ a6 `6 [: t2 }routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node; B8 A: @- a+ c& B4 d3 M3 q% U
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
- X- s) }8 ~4 s, Ninstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
3 O( q C0 h- a4 ]. r4 ibeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
2 Y! Q- [+ u" Q# q5 |5 W$ Z; t- Mare fully overlapped, and each token can efficiently select an average of 3.2 experts per node! o# v5 O, B/ v5 [# i; g9 v
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3! ^5 k5 R- m; k6 T/ |% D( G) L
13
6 C6 k0 K$ R) ~+ gselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
4 x# n+ S, C9 u0 n7 ~(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under1 p/ ?, f5 g' `- S$ g
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB; M& D' \6 h! X* h+ B/ h: P+ J
and NVLink./ R0 ] T0 L+ d- e0 }" f
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition/ w3 N% ?: ~# a; Q5 n" h, j( J
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2). F% y, @( D2 g# U! `! y8 }4 K
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
j. j4 v0 Z4 j* B9 snumber of warps allocated to each communication task is dynamically adjusted according to the( u% S! H" X5 U' R( ]- w0 n
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
4 |: g# P' Y, z2 l(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also6 `8 |8 {4 O* ]8 E- x) x
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels4 z& H9 T% n' J" }/ a5 {
overlap with the computation stream, so we also consider their impact on other SM computation3 ]5 i$ d8 G/ q. S- t
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
$ v9 x v7 D5 J2 s: {* R5 ^8 fauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
) T1 T R, g( Z/ d% Pand the interference to other SMs.3 f# |/ L9 m) ~$ z3 V
]. f6 {2 w9 _: v9 N# O, F通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。0 A9 u! }8 F: d" ^- Z
4 `) F' \2 Y2 f+ E: i, B" }我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
# D$ l0 j) u5 A4 c' x' X& b9 Q$ J: }6 h$ g
目的不是为了绕cuda,反而是为了让cuda的效率更高。
) l; x4 {" S# b8 q9 [7 I/ \9 \+ K# K2 G& p
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|