TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
' w4 M, y) R, P. o& J: W在论文里,这是第3.2.2节的内容
) T! F0 }$ j: ^# L) U
. e; A, Z/ n2 B }' }& P8 z3.2.2. Efficient Implementation of Cross-Node All-to-All Communication0 x3 K1 c# b; a/ i9 ]% ?0 Y! a
In order to ensure sufficient computational performance for DualPipe, we customize efficient
5 m, r/ {8 {' Ucross-node all-to-all communication kernels (including dispatching and combining) to conserve1 R+ b( \7 x. C4 V
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,, M! n$ K) G6 D' J) u5 W
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications3 e y& ~ S" a# S" E3 X' E! |" i
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
G' z' d+ ~% S+ N(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each0 N5 |: \9 `0 `3 M+ L
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
( f/ s# U/ p% Zrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node+ c# ]/ a* u5 k* R3 p& _
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is* C( s$ G6 G/ S) E1 H0 ]
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without4 ?$ B' j$ `. P5 E, M- }. c
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink5 v1 {+ k# m- m9 z6 f# |& z
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node7 x( m) D& j8 A$ M/ h. q
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3) x" G$ B o+ T- R9 b8 S
13
, Q3 s/ G: z+ V6 Iselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts% _6 l5 E2 g- p* Q+ ^9 k$ U1 y7 S
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
) P5 N2 y2 O5 ~% |7 A1 I5 b. a5 Hsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB- A' A5 V, c% M5 R. L6 W- D
and NVLink.
* U3 ~& b8 U" f( B* Z* t gIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
% c- ^2 `: [7 ^% z# `* }3 h20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)- A2 n& T6 m7 F, j1 D+ Q1 d, N
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The8 t6 y! R6 G, |/ ?/ o
number of warps allocated to each communication task is dynamically adjusted according to the3 [2 T3 m, g/ F3 J v
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
7 C2 F0 V0 `& P8 _(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
' ?9 J) G H1 x7 ~5 S+ Y2 Z) Ohandled by dynamically adjusted warps. In addition, both dispatching and combining kernels" \* }2 s$ _* O, K% ?" q' v2 M7 p- k
overlap with the computation stream, so we also consider their impact on other SM computation( f8 p7 J" k8 U- j
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and- R/ y. {7 {+ b, R @% b2 `
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
& p/ i. g% n8 @/ k) _6 \! i, ^. W# ` kand the interference to other SMs.
7 J* U; l+ D* l- H8 N& u8 n/ H' M% O! V9 d1 ~
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。; C# z! {/ R; o6 D
& F0 t" e6 g! ?; r& w( ?
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。4 G) c* N W/ p
2 W* O, c/ _# i# R, Q4 I. N目的不是为了绕cuda,反而是为了让cuda的效率更高。
' }$ m" Z! {1 m/ L+ `/ h/ J1 y3 E% D( t
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|