TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
& Z$ b h7 `7 ]" z& q2 O3 K在论文里,这是第3.2.2节的内容8 K& y/ x: F/ N9 h6 t
* h, e) m V2 u. V
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication) I# U$ g" k7 v% R
In order to ensure sufficient computational performance for DualPipe, we customize efficient5 x( I: I2 ^& l1 c
cross-node all-to-all communication kernels (including dispatching and combining) to conserve# o# N1 l- Z" K& X8 M& O* {
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,; p9 c8 u. a# U9 S& d
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications7 I. o6 e V B; f/ K+ h5 ], w, ^
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB& y; ~+ a) u6 t- E
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each% U2 n! I% ]0 ^% @/ u
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
F' b+ s9 L( }routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node( d$ s9 a3 y" @) k: O |
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
5 o- `7 V# n1 U2 F; p1 ~instantaneously forwarded via NVLink to specific GPUs that host their target experts, without5 K& k* \" u) G
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
6 {* m9 Z" y+ mare fully overlapped, and each token can efficiently select an average of 3.2 experts per node- P. D) h2 \# Z& {
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3 s; [% ]# E p, ?, N C" \$ f
13& Q9 \0 j! M' U7 u6 k
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
4 A2 [2 v1 t2 O) `(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
8 `4 Q/ V+ x& H) Zsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
/ `* e3 z) o/ q! T) n& fand NVLink.1 O; t1 U9 e: b
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition% w$ v& g% \' @) \2 n
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
G2 i# U! t3 ]5 gIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
/ y; {5 P" j1 g( k1 [. f8 Anumber of warps allocated to each communication task is dynamically adjusted according to the
0 d1 V$ s* S: Q# @% D% O/ factual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
8 K( D' t# C. }; M7 u(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
2 _7 S1 m$ ?- ^: R* Uhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
" o# ]& o& X/ e' Moverlap with the computation stream, so we also consider their impact on other SM computation
3 X" }$ Q7 O, o. e# pkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
+ Y1 }+ T* i5 ~* J6 d6 Hauto-tune the communication chunk size, which significantly reduces the use of the L2 cache: g2 m3 |% b7 v- k4 p- z
and the interference to other SMs.$ M) Q, d0 D! F; s7 S% h! `
8 w8 q( m+ H5 X
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。6 ?1 d: F; Q# ^, }( e) S
; [9 B" I- L# F9 c2 W
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
# T w8 D( S9 X* X; r: Z6 H( ~
% \! |9 N* U9 M. m目的不是为了绕cuda,反而是为了让cuda的效率更高。
" f# m& B/ l k+ A8 s, n" S \( f! C
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|