TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
* E( v$ h- R5 ~6 j5 ~) o
在论文里,这是第3.2.2节的内容. m) t5 c- Y3 M- @8 K# |
6 j0 J6 E* B1 m3 H2 @3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
" n! h7 o( Y. J% ~3 P. H$ [In order to ensure sufficient computational performance for DualPipe, we customize efficient; |; ~! P$ i f9 B; @1 }- t' b" J
cross-node all-to-all communication kernels (including dispatching and combining) to conserve) n4 d/ {* W3 d! Q( C" r8 W4 d
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,2 x, @5 u. Q# [: T( T$ w
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
3 T* p# M7 g5 N# U$ K- uare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB# J4 i8 a9 E. B9 b+ U) S" Q) X
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each! a# p& p2 I9 C0 h6 B5 ^
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
' _$ M7 Q8 a Nrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
; ~8 S. b8 d e. Aindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
# v, D% P- m/ }4 U3 I! \$ T3 Zinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without1 C* ^. R0 @/ _4 r, U
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink! i- E$ G$ Z1 s- n
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node( d( C9 y E" ~. x
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3& x; |+ N" }+ p
13: G5 x0 q0 x X) W( {# x* N4 c" x; \
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts) L; p9 i" r, n: t# L9 Q2 C
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
1 j4 t. q0 e, b" zsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB2 ^: x+ U- n8 P7 [0 S) g$ T; E
and NVLink.3 L; S6 n. d% b- g
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition0 E/ G' ?7 I5 y
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)6 C: a1 y# }. K) \' j% B$ v
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The9 L( Q" m1 ]0 y. \( N3 j5 y
number of warps allocated to each communication task is dynamically adjusted according to the
: x7 f% l6 _ q: M) ^, _actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
3 P; g$ l. X& p* v(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
; n1 t- P# i8 H# v+ shandled by dynamically adjusted warps. In addition, both dispatching and combining kernels3 ?) {+ E& @: {% _0 H
overlap with the computation stream, so we also consider their impact on other SM computation
0 M/ y/ W' s. G6 Okernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
$ G4 L E B1 `5 w6 t9 b0 I9 y' G6 [auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
; ]% D0 G0 u9 v" `6 O f$ xand the interference to other SMs.) Z, i' a- e4 p b) U( ` u* S
- C1 G& e8 H2 m通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
- G3 l! _: R+ e4 s- G9 g& I% p; f$ M: t* a, q7 Z3 G
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
8 M. p* l! [* n, s/ m& L- r/ u) v5 q
目的不是为了绕cuda,反而是为了让cuda的效率更高。1 T% q0 L9 j6 P+ t5 q2 M
% W8 J7 I1 h# T. P: Y" I
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|