TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
0 c/ p; _- E7 ^2 P" [2 R2 W" Q
在论文里,这是第3.2.2节的内容6 v! Y# R% o( r5 _; w1 r
. G/ Q! B* I8 t/ E3.2.2. Efficient Implementation of Cross-Node All-to-All Communication$ ]' E- z! i7 e* H
In order to ensure sufficient computational performance for DualPipe, we customize efficient! z* t8 \. A( ]. l8 G+ v0 r* c9 o
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
! j# }, Q ^& B. A" Fthe 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,
6 t/ c/ ]) K _% `/ k9 Xin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
- i/ k, C" m8 Z8 z) J4 Sare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
5 p5 ?; Y4 W3 b- i$ b3 Z(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each7 n9 Q, o2 T8 m- s. i
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its* b: ]- B, \7 w9 K k4 _
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
* U3 m4 O7 Y# G. @$ oindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is9 B( V! _2 T% v) ]. j; x6 F
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without# s+ Z& @; q) U: ]
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink- U. j7 G+ D# ]
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
9 X. c2 }7 Y) v! p1 Awithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3( Z1 U* [" R3 P: c3 r1 J' [
134 g& `( Q/ L+ g4 A
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
4 f8 [# ~, i O% }(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under( e2 f0 C, P5 v: ]( V
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
3 o0 L9 S' i8 E* f0 l C! Nand NVLink.* v5 m/ p/ |; x
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition' y1 z1 x3 \, T: J! N' P9 q
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)$ |) A, y) ~! L% N
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The* _, P, F3 z1 y
number of warps allocated to each communication task is dynamically adjusted according to the, q( E' J( B9 @5 c* ^; B9 {5 r8 n
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,% [0 V" Q) z. U2 ^
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also3 O: o; A) l, c
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels( m7 B5 C; T1 s- c9 R2 R
overlap with the computation stream, so we also consider their impact on other SM computation
$ T6 k0 d: R8 B$ x& _; A# ekernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
' v, J7 W! x; q& c6 Sauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
2 m8 _% [8 ]/ V# G. ?and the interference to other SMs.
- h3 o5 N2 z! r8 s) j: P8 t0 }
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
. h2 y' |1 {4 s" M$ q% r+ I9 } q4 ^
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
* B; o( u6 b* e. d* e K& j, u( t, F1 `; C1 Z
目的不是为了绕cuda,反而是为了让cuda的效率更高。. q+ m4 O! @5 A, z7 c
# Y, i' a' y8 m! N' X2 d类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|