TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
: k$ Q4 X6 e3 L0 l$ Y/ ]- ]4 ^& k
在论文里,这是第3.2.2节的内容# _8 B7 T: W/ k a A' P
% j1 k3 k, @% E/ X' }* g8 W0 |" l3.2.2. Efficient Implementation of Cross-Node All-to-All Communication2 p1 S" E) v& r* y1 W, s s
In order to ensure sufficient computational performance for DualPipe, we customize efficient: O* F5 O/ W V( k [7 z( ?+ C
cross-node all-to-all communication kernels (including dispatching and combining) to conserve f/ a! u8 `' n* _ a! e5 W3 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,
0 l+ g6 s9 D) x5 W$ f; U3 ?in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
9 ^& j: `# G, k* i. pare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
& `) F/ A4 ^, _. Y( D(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
9 S0 t! Q# Y. c* _( Itoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
* I+ x/ J6 @! g) jrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node1 e0 R7 l' w/ }
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
3 p# l5 K8 I+ ]$ L0 \instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
$ y: {& e) ~' n. S! C/ Ibeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink' \% i/ z* d+ U: K9 ?. u
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node' o: I* Z. y& o c9 Q* t
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3& Z2 W0 ^1 p- e5 s( E2 ]0 L
139 g& C% P- }) L/ t7 u$ }( l
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
# J7 t6 \: d4 |. S" }8 W1 l& n(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
; C* p. }# `( m- ~. Rsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB8 A+ z. V7 Y5 U, l+ j: ~
and NVLink.5 T! A0 {! N- L2 J3 M9 ?/ Q
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition& Y5 P$ g; U& ^$ U+ X E l# p
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
& c# T9 L# n) {, h q- N# WIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The) N4 M k; S$ K, ~, B
number of warps allocated to each communication task is dynamically adjusted according to the
* C7 K N3 q5 N, Oactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
8 {7 o# H% W0 P5 b, h U$ H# ~3 A& P(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also1 e, T4 v2 B0 c: v- T% ^* e- A/ }
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
% I0 K9 Z+ e. \7 U2 O; Joverlap with the computation stream, so we also consider their impact on other SM computation
$ M5 u: K4 H S" ]+ N# tkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
( l6 ?) ^7 A' p- j0 g7 T: c7 Vauto-tune the communication chunk size, which significantly reduces the use of the L2 cache% B0 I# B- N! a* E% ~) I5 Z. M
and the interference to other SMs.
5 o3 |* a' Y5 G# ]& b4 m/ v# H1 {- ^ x# c* b- n
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
" X* l$ ]* u2 y
) X" u; ~. G* ^8 B3 S我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。( K. a: s2 f+ ~- l% D* ^
* c. }9 s3 \# e+ S
目的不是为了绕cuda,反而是为了让cuda的效率更高。
- ]# d+ X, `- ^2 C
p, b4 I4 x; i" |9 X3 `( J! U类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|