TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
' w7 M6 d+ _# z( x. F) Y! V( u在论文里,这是第3.2.2节的内容( m6 U M/ A! M& w" C5 S) {# V
- @0 F6 g/ v0 X3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
6 R* v3 G/ N& b6 }% ?- O. YIn order to ensure sufficient computational performance for DualPipe, we customize efficient
/ c5 }" @/ w% _8 u4 O6 z& rcross-node all-to-all communication kernels (including dispatching and combining) to conserve, P7 C7 c8 ~4 ]- i
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,
+ @; p' g% ~/ a2 x* Min our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications" i- M1 N& K1 D6 S' w: k2 ^
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
- G m+ j; x: F& m' Q(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
( V1 `9 @: u' n( R" Dtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
& a$ G e1 E4 j* S6 xrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
# A" ]+ b) ]- Lindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is: [' E2 a; E6 ]& | T
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without& m5 s' F& A( e% |4 o
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink- @# X4 H8 X9 i
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node; A$ A& o0 B2 K
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3% U+ `" H3 \/ U' X- A: r3 `6 I5 ?
13
; [% i5 L. L. Nselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts; w6 M; d2 D( c, D' l0 {5 ^4 ^
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under; f# ^1 c: }4 [# `2 u, \. V# N
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB4 E, D8 ^1 R) L1 K# {
and NVLink." A0 l1 J4 y* k7 j9 S) m
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
" t$ B. Z( a6 p( |! Z1 z" j) |20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)# v5 X( x$ U- w6 {9 ]
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
) p4 l' Y) O6 W1 j7 z5 L0 Jnumber of warps allocated to each communication task is dynamically adjusted according to the2 Z+ Y8 E( C' g# u( h
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,0 Y# G M. Q+ e* `
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
" y9 n6 R1 Y4 z3 Y9 ?, F8 X5 A; H% Zhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels0 `/ w+ V+ v& A$ X
overlap with the computation stream, so we also consider their impact on other SM computation( ~8 F/ V2 r. o* k- H: S% k1 {
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
S; g, E8 L3 @3 O1 tauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
. {& W/ A+ T: E+ |/ ^4 X8 zand the interference to other SMs.
, b" l! H. Z4 X- b) q* k7 U) ^3 C( R8 `1 }, E6 i. |$ V
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。* P- O) x2 o8 \3 @- @
+ _$ Y, l" K6 b% g# s我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
2 j* r% ]) Q% R
* q3 T7 B* g: Q6 t4 g; |目的不是为了绕cuda,反而是为了让cuda的效率更高。
0 z. b. q/ v9 `& }7 |3 e; c; x ]$ q- y2 x% l
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|