TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
4 N- t5 p b" S/ v" v/ y% G在论文里,这是第3.2.2节的内容
" C# D- w- h& r0 k* U. ~1 q I* j0 G; z1 {- m! j
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication: B1 I$ l: s2 H/ `3 X
In order to ensure sufficient computational performance for DualPipe, we customize efficient
& p4 N( c) S& `; y" s7 W4 P5 dcross-node all-to-all communication kernels (including dispatching and combining) to conserve5 g; U L+ @4 ]1 U3 ~6 b
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,* o8 j l$ b6 u* r- v
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
" \9 N3 i- ~% s- L) vare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB! i. d0 C9 w* M, m4 x
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each- F3 s% M$ f, z- ?
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
. F8 F$ d5 W C- ]/ C6 urouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node9 ~' z; l9 N1 M
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
& x, C& H+ P# `1 L$ w4 V6 Yinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
6 z" Q& t& X. N# n. ~2 D3 nbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink7 @, k2 L2 M6 |5 y! y
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node2 p& o5 X' v. E @6 h
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
( {3 \! S* }: e8 t( s, }& H' u8 |13, h% i: B. r P W6 a
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts# f: Y3 a8 o+ C6 c: t4 \9 ^' w4 L
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
6 t- G4 N/ C7 N% Ssuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB$ o, H- }* y+ z4 z+ s+ Z
and NVLink.
" ]7 T" y. k8 ~' WIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
' F: W1 o& }, b# V- N+ K+ G7 ^20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
8 @& \2 ?. E8 s8 RIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
# i5 J) b& P0 {( q) Enumber of warps allocated to each communication task is dynamically adjusted according to the
! W1 U2 c5 C [/ z9 x) ]. v2 yactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
+ i: H& c v& }8 A; a3 B(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also7 T, P% L! |' z# @2 j! @5 Q4 z
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels2 V/ N: F; i. z
overlap with the computation stream, so we also consider their impact on other SM computation+ i- f: B7 \& Q
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and/ V9 N0 I" A. k! u
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache1 {! ?( x" i: u/ b6 a1 r
and the interference to other SMs.* y y. x1 R* }) c) Z1 y
* v. n2 ]% Q9 P4 s通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。4 r6 d4 ~% q. t
' {0 x7 e2 e: `7 D0 O0 O我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
6 w, }7 T6 A( a# D9 X$ F
2 z: S( w8 h4 Q/ F目的不是为了绕cuda,反而是为了让cuda的效率更高。 d0 t+ j$ o4 i3 V
/ h0 E1 J2 j! | c G+ j
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|