TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
3 b _$ u i" _/ ~ @
在论文里,这是第3.2.2节的内容& U; c4 C& g4 a' ?, M
" r* o$ @6 L7 r, X
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
5 X) q; N4 u6 P4 T' | {In order to ensure sufficient computational performance for DualPipe, we customize efficient
; H/ t+ H2 S5 M- t' N) d" Ycross-node all-to-all communication kernels (including dispatching and combining) to conserve
' k# A% H* y3 W5 {" \! 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,
6 n9 }- g% c/ S" u' U4 `; yin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications3 j, |2 F6 m' f3 S. t6 z! I K
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB) ]' E% F; {. l3 I b
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each3 ~4 o) o1 K6 G& u1 [$ ^
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its7 J [& Z& @" d/ |
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
1 x( l# F; d* K9 V% A; i; f" t4 H! h/ tindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is% a' G/ L# K0 k' o; a2 B) W
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without+ K, m4 A5 ^( \2 K7 _
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink# K. q! j1 U" z) z# c. @$ D' V
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node( F1 p& D% D. i9 ?6 A) L% b
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
2 X; O9 \% E: @, N& U13
( t( O5 s6 y0 e vselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
1 B9 i4 W: W4 f# K(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under+ C: r# G+ @% m! X$ v8 K
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB3 O( T' O# o, U1 T1 K7 O: g
and NVLink.
+ }; F) o/ X" n( e. Z( \8 HIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
# T( O' q) d: n% c' c2 w20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)5 U7 ^$ F. ^4 s$ h& c+ y; s
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The0 e1 `( M) [) W0 d+ L7 K9 U# h7 z0 _
number of warps allocated to each communication task is dynamically adjusted according to the0 _7 N4 N! d2 G! A, u9 N
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,7 x9 o6 u* O2 y5 c( |, U3 W/ D
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
) f" I% X5 ~+ I; N8 [handled by dynamically adjusted warps. In addition, both dispatching and combining kernels- [* K$ U$ }. P t! n* ~: [8 }6 Z
overlap with the computation stream, so we also consider their impact on other SM computation
+ Q. ~% U( A7 o5 t% ykernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
/ s w7 H3 ]' S9 \1 ] jauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
% r' a u1 u4 S0 M' x2 B& [and the interference to other SMs.
0 X+ x8 R, x- e1 H+ v: X. T; a' F8 {7 l8 Q6 W# e
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。$ s$ T# Z9 J8 D% M* ]7 g$ Y7 h
( c) `% f& t7 Y: z% d
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
6 ^, U* r+ S7 C! ]( u% m {+ m; f0 z1 g0 L' ~' ?1 Y* L h
目的不是为了绕cuda,反而是为了让cuda的效率更高。
+ R0 K1 B7 ?. f5 `' O2 T' T9 L% [6 S
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|