TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
- x) x/ t; U5 ]+ V. Q- D* a在论文里,这是第3.2.2节的内容
9 `1 a C( o; \; H; v/ S
5 w, [% G- y- x+ T5 |; `% P3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
0 x# s" Q- w# l4 yIn order to ensure sufficient computational performance for DualPipe, we customize efficient
5 f: z0 \+ O& D' h% hcross-node all-to-all communication kernels (including dispatching and combining) to conserve2 w1 L2 x( f! k+ |) x9 H
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,6 @+ L( V, s8 C/ p; { x
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
2 R. _# y5 |6 G7 l Z- h7 _are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
# N9 l) p- H7 C7 c! \(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
, D# H/ r+ v* n$ ] `token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its2 p2 A* ], k! b, ]5 `; ?
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
# N* a0 k9 K% n$ y; xindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is4 F' h1 v; [+ j2 U2 o5 N s6 H
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without. ]2 M5 [4 s; c5 N* d/ K5 v3 h$ \
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink' o& O- O0 X& }
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
2 y0 W+ K j( K' I/ {# |without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
) a6 P! N [% w+ d s3 Q/ v! t13
7 h: K) \$ K, P0 Kselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
( t$ y& v0 @( p) s(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
4 x5 y. w! u+ m' T! `2 v7 P* r4 k Q' Csuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB+ C4 V: l+ X; O; @' ^
and NVLink.
' E- X6 K& }9 D1 i$ ~7 b, eIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition3 f- m& h1 X; m& U& h( z
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)% x* O2 ]& P; p; W6 [
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
% A/ x3 c0 G7 }' [* K; Jnumber of warps allocated to each communication task is dynamically adjusted according to the" ^ s2 k& O# p1 q Y
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,5 u2 C) j P# p
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
) H/ R2 E, c2 h l0 C2 ohandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
& y% A( T0 k$ i) v/ Y4 zoverlap with the computation stream, so we also consider their impact on other SM computation- [/ r- i1 u* ~. {* ^+ w1 ]5 j* E) O3 G
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
+ `* T% ]* ?/ b; I1 ~* h1 lauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
6 C* ~3 n6 Z! h5 q( U5 g: land the interference to other SMs.
, f4 p$ f! R9 f6 i# Y/ g
! Z: |( U+ j+ d" s9 Z. F6 E) ?通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。, _4 v: W$ a( t' B, D. m6 W
! p: v m- h; o# Z% m
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。% M( x* E8 d$ r4 `, q- H' g
5 e* V' F4 B. g0 |3 k, W" r目的不是为了绕cuda,反而是为了让cuda的效率更高。
/ e/ @; _( Y( B. M7 ~. D1 y+ X9 Q$ e- x! D
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|