TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
) p2 T B) L t: u8 e* x! Q
在论文里,这是第3.2.2节的内容
( ]3 x. H$ D+ C' g) P9 |) g+ F3 e4 f. r# u N
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
, l( B7 q+ g2 Y+ _# e: q$ ~/ Z+ v3 EIn order to ensure sufficient computational performance for DualPipe, we customize efficient) \2 t* x+ G2 e+ e6 Z* ^
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
# q7 u) h, \* H+ Wthe 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 Z+ r) d8 B9 }4 n/ Kin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
* o/ M1 \$ b1 f8 Z& c( Sare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB0 U: c& V* a5 c/ ?" K: X
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
+ k4 [' K2 ^$ V) w9 O; Mtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its( a3 f5 m- a) O$ h- F& ~+ [
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
# s$ n2 x# `+ U% g) m! ~, f: findex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is u$ ?4 Z& x& O$ ~, r
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
n2 u# |7 }9 lbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
6 I) R7 ]* `& d x3 rare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
* U3 v1 d+ w: }8 |/ o, l/ nwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
3 L& X5 q5 b5 n& B0 j5 A$ x6 g13
& D l" `% ~! c$ J" g& cselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
8 p& x4 ?& y$ e$ e8 x& ~; J4 ](4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
3 j6 e i* c( i5 s: osuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB$ W$ a3 f; ?* y
and NVLink./ r6 Q- S9 g) T b H
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
- M6 V$ T6 R+ X20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
0 y+ ?1 Q$ N0 V" T2 DIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
3 e& m! _- p$ x. v' k ?0 qnumber of warps allocated to each communication task is dynamically adjusted according to the
$ ?7 G1 i& J, U- h: Nactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
: x- }1 O4 c j(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
; |3 I+ n0 x z! r2 ` bhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
( b7 O: z, v, _; S4 q9 I! u$ T7 Goverlap with the computation stream, so we also consider their impact on other SM computation
% f, _1 W7 t4 E! s/ r5 T* A2 mkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
9 k& C! K$ f* J1 G, t. ]+ w% Bauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
; v$ V' l2 l/ Z7 [6 i5 p; Oand the interference to other SMs.
4 { q- P, c- j3 s7 V
9 ^- K& v5 a! D, Z& e7 E" b通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
2 A" u0 z! F+ Y1 a# Z: F% A9 ~/ |0 ]7 Q+ W7 Q* X$ D
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。- D4 E! t% i! w: o% Y1 n# Y$ _
0 H# Q, S; g2 k) G0 N目的不是为了绕cuda,反而是为了让cuda的效率更高。
- [* L1 j8 k6 R% q2 f7 C! P9 w, d A, `) |% {$ G9 ?( n" ]
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|