TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
6 b+ ^2 C7 e% w. T0 ]. Y
在论文里,这是第3.2.2节的内容" Q4 S7 e5 \- g6 |' i0 Q
7 g( p. j6 [7 R8 }2 Z( c3.2.2. Efficient Implementation of Cross-Node All-to-All Communication) t+ b% N' }, N( F% q
In order to ensure sufficient computational performance for DualPipe, we customize efficient: k8 R2 S. b h/ t/ m T# t
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
( O/ A- {4 `, n5 hthe 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,
& P2 @, ~- T' i; c& M. |* Yin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications+ h; D9 n- [1 z/ O
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB3 o X/ L, F$ R
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each, ~) d' u( K+ V& w) C5 o: U: y
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
U/ r! N( I# E# b' ?routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
! O r- Y% p, F- x+ A' Yindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
% g+ n2 D/ `1 jinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without T( {$ n) r# C& L+ B9 b3 P- a, T
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
, g5 `7 _. V7 o' V# nare fully overlapped, and each token can efficiently select an average of 3.2 experts per node& K: U. X! L+ T
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
; B- C# Z' X$ J2 G! R* p" i- K9 ~13. [+ B5 V- A" M0 Y9 j" P
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
/ ]! i$ t- f5 x$ {(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under# J9 A. @, ~" g& `7 N: u& c
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB; ^; y H9 T6 [
and NVLink.
& k8 F% F C, t/ G+ T4 |In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
2 Q" w4 _$ E7 K8 Z: W20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
; t/ O: E4 Y) f0 K' G, vIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The7 M& y' q { V2 Y' Y) P9 `
number of warps allocated to each communication task is dynamically adjusted according to the
# v+ i' Y7 a, N) @$ Kactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,+ u6 g7 g5 s3 ~# D* i4 h6 _
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also/ `3 y: \ E; Z" D0 L5 t7 @ w2 b
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
9 J8 Z+ K7 A+ z* b# L, f9 N6 s0 d/ loverlap with the computation stream, so we also consider their impact on other SM computation: Z) p: n# l! I9 W3 X3 A1 E: U3 H
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
2 H% w- B6 x% u {* \5 nauto-tune the communication chunk size, which significantly reduces the use of the L2 cache5 D* u3 z- u+ [$ w/ @# Z1 I5 \( O
and the interference to other SMs.
9 D T a9 A+ v6 S* X0 B# c+ P: s* q% X* L
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。3 N( |% C% ~8 p) m! M# q
5 _5 b$ {' |! s我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。( Y5 M* B7 P4 a K0 d1 b; ~1 u I6 C
8 S" i& \- n/ h. b0 F
目的不是为了绕cuda,反而是为了让cuda的效率更高。
7 }: t7 [5 l4 B+ `5 ?4 [2 Z8 w* Q( Z; g
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|