TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
2 g# U2 N- M7 t, H) \在论文里,这是第3.2.2节的内容4 O9 M T- @7 B; \1 j
: s3 k9 M3 J- E, z1 r. n. Z3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
9 h6 N( p: V' V0 w1 p: SIn order to ensure sufficient computational performance for DualPipe, we customize efficient! S! v. ?3 }& X9 _0 i; J
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
* c, x/ u8 g/ N4 ^* i1 w# Xthe 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,4 y* V3 t' I# ^7 p6 A
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications: m6 B# s/ H; m, W
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
- v7 Z4 ]! A/ d4 G# w3 c$ g; }(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
9 w2 q& s7 A" V9 n" _- y, etoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
7 u' e4 h& M- n7 i% t: Xrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
( i! W5 n+ j$ }: {& _# dindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
/ M' m: f% T" w) i6 xinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without$ [% W# X- {' N1 ?# h" |9 J; F
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
) c* c3 l# i r: Yare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
8 f5 `8 D T+ k" k+ Z+ nwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
0 t- N; V5 u- F6 @8 Q13
* g; u) Z3 A2 U v5 E2 rselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts8 x. K8 ^8 j' M& J( Z* H
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under# _( P" p- N" ~& b5 v& a& m
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB/ M, J& y2 a4 D: C1 O( D4 G
and NVLink.& j9 R6 @7 C0 b
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
3 h1 A( o7 o3 ~ X8 D, f# s20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2): m U% O! R4 f: R: \4 V
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The4 E# t$ y8 y! B" C0 T
number of warps allocated to each communication task is dynamically adjusted according to the
! m) k$ f5 e% D; Q5 _actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
' i6 a; O( U7 z2 D. q5 @# T( i(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also q* i/ f1 R2 |6 S4 G
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
. l+ k% K }" t9 H Joverlap with the computation stream, so we also consider their impact on other SM computation/ q' C. Q0 m) j* e$ r6 X# Y
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
* a1 T/ @8 l7 n+ I$ `7 Lauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
; J. V f* g) e% z9 C4 B! Xand the interference to other SMs.
/ A- Y- q0 c) z7 P
. o. p) I# S2 v+ L8 i4 x通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。4 M. P# A1 a. @. C6 j! f
! _, R8 `; U" t% e: T我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。4 x7 o) ~8 t8 a1 y% d
3 R/ c, u, t' N6 U* o! J" R* i
目的不是为了绕cuda,反而是为了让cuda的效率更高。) K9 b" ]2 \1 d2 N) {! A2 G
* G0 K. s! b: I* e3 k
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|