TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
( `/ p9 X1 g/ F* Q. g8 W
在论文里,这是第3.2.2节的内容* A! x7 p9 _2 d8 }) l
3 ^9 m7 g4 J" R% T0 m2 S" h3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
2 E" s0 e6 S! O8 YIn order to ensure sufficient computational performance for DualPipe, we customize efficient, O! j% ]8 @1 I2 l6 r5 t( X1 L
cross-node all-to-all communication kernels (including dispatching and combining) to conserve7 s3 K1 y: x' R
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( Y# h* n' t: K# }8 u9 Cin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
, r, F3 |) S0 f& S8 Jare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
( P# f C5 U. N# f) ?; } N4 i(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
) n& D; Y4 P1 |% d9 Ctoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
/ Y1 p5 q4 J7 [& e* h4 h# erouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node) A, z; b0 H+ m4 u- j- k% h. p
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
2 N5 y/ I ]4 p0 R6 T+ Pinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
( l6 F0 @/ t" M; D3 Kbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink7 ~8 v0 b' I( Z, i% ^
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node8 @/ W, l5 k" @8 F2 H% N. t
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3, _( ^) ^$ c1 D) ]! X6 x' D
13
; ?! D$ t! x+ gselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts! m, P# m0 t# q1 u0 s! z0 _, V- } n
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
, P( C1 Z: Q* p2 l) K( z5 u6 ysuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB7 v/ B& A2 D B- w7 S
and NVLink.4 B, T% l7 p2 E$ Q+ M9 t
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition* e3 [) e4 X$ x; C$ ]8 o
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
8 l R! X/ j+ D* j) sIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The, H2 c' R# Z$ z% t/ s a4 {: k1 @1 T
number of warps allocated to each communication task is dynamically adjusted according to the
; A ~& a1 A: ^( z- x4 k- i- W: X' ], H+ ?actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
4 z/ o% E j9 Q6 W* r(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also2 @: e+ F9 e% S5 P$ A
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels0 R# P1 z8 G0 m8 P0 T, e: ^
overlap with the computation stream, so we also consider their impact on other SM computation8 [' k4 L7 D; U
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
" \! ~1 n+ t" f7 h0 y1 I) wauto-tune the communication chunk size, which significantly reduces the use of the L2 cache2 C/ W. ]! `8 D4 T7 ]
and the interference to other SMs.
0 M1 p9 j( L+ z0 j3 o3 O. c6 Y( x1 N1 f2 e
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。, d; d# s! {) `& b9 f9 n
5 \) k* [$ B4 S" {: \# L我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
" N7 y6 y0 {' a* Y% i( s
6 A6 M2 `6 g" j/ H" m) N' U目的不是为了绕cuda,反而是为了让cuda的效率更高。
; d8 r7 E8 {# {" l! f
% j3 \, I1 P# F% D类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|