TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
0 X6 K) j) P% ?3 p2 l1 }2 H/ p在论文里,这是第3.2.2节的内容. \$ F& V- O2 D- T" q& K% c
' Y w+ B7 J R1 _8 o& x% f, C3.2.2. Efficient Implementation of Cross-Node All-to-All Communication3 {& o, n J" @2 ~& Y. i* |
In order to ensure sufficient computational performance for DualPipe, we customize efficient
9 E( ?9 v( J: ]$ }0 B$ P7 ecross-node all-to-all communication kernels (including dispatching and combining) to conserve
1 O# i, g/ E" Z, W9 X8 ~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,# x/ _: M9 T# h
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications. X) X6 K0 j0 K7 @) N' r
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB& ]! ^. F6 @+ t4 y, \9 ~- M2 R
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each& D; ?' R8 m7 R' j$ e* ]
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
- j2 ^9 V! s8 y- \9 N) D3 j9 vrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
# L a5 u" _) O2 t) r4 j. x* @index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
5 o1 ]2 X7 R% f$ Cinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without+ v4 t5 d8 N5 l$ ^' }
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink6 D* T5 H5 A, u& j5 x
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
3 m0 y! o- u* s- v- O* i) swithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V35 r5 A5 F$ a1 W0 j
133 ~6 `. A8 K* x4 A5 H
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
# T7 |( b( {1 H+ U(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under: S5 Z, h: F4 N' p. \
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB8 T v" l% s1 M3 Z b/ g8 Q5 [9 F( N( F
and NVLink.: j1 m' j: E, d. T N+ b- k! R
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition4 u$ m+ e1 Q* u1 Z
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)2 j" H3 L1 V6 `9 v+ M' m
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
# Z& Q0 t2 f/ a) g6 g( j/ h- [number of warps allocated to each communication task is dynamically adjusted according to the8 j& d _3 V- ?, R
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,* C2 _! C; [. p" v0 [. Q6 } q
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
5 ^- r; n8 U' A7 l* U$ ^6 Qhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
! r+ j4 i# O) q) b8 woverlap with the computation stream, so we also consider their impact on other SM computation
3 P. g+ L3 P1 i3 f7 p2 G* p% Hkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and- v. R/ T" |" |% {+ ?& U( z
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
! O& E' ^) j+ r b! k; D/ b. n# Qand the interference to other SMs./ \7 p% {' L- o( G- ^1 }
, V7 F+ Y) k1 J# d7 n* k+ u通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
% [# p- W* D) V# q9 o2 \9 z7 L; r" s1 e3 I) y
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。! z, U, {0 j6 s' n# o
. }/ h* J+ L1 e- _; l' Y6 G
目的不是为了绕cuda,反而是为了让cuda的效率更高。
6 B4 J/ L/ D- D& o$ F/ l& I- w, ] f- @3 n, S0 _+ i$ j( f1 K
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|