TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
' R9 x. c9 s/ t$ V" z, z. T7 C4 D4 B
在论文里,这是第3.2.2节的内容& D- {1 ^2 s8 s) Q$ h1 a" D' w# i
! v! t% v6 N9 v! ]5 q3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
8 V. H4 [. V. I% e- [: f8 A; pIn order to ensure sufficient computational performance for DualPipe, we customize efficient; w7 |3 g. V& g, x; _ h4 j
cross-node all-to-all communication kernels (including dispatching and combining) to conserve# B+ n) @9 G2 E
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,
' M- x8 x. n L3 \* ^: Oin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
( c* f3 y M" rare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
r S: j3 V* d(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
5 |4 ^: B; t/ d% }token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
, c: e$ \. A& {( z; o7 }$ x g `routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node! w3 E9 _' L+ a# w0 r2 M
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
9 z N/ ~# l1 A# b) l; Z: A; z; B7 [instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
9 B1 n6 y- }$ ubeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
4 A6 E% M/ Q; R8 D' {, ]are fully overlapped, and each token can efficiently select an average of 3.2 experts per node& v; b; ~% E1 U: A/ d
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V38 i- V+ D- M* F' a3 \' Z) J
13
5 U- t1 }* p. h9 A. xselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
' ?3 y+ B# R( N(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under" P. K, k/ r, U1 r! O9 b
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
: C# \( }8 T+ x7 T! @' Eand NVLink.
8 t" L7 g% ^9 W( S$ |In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
/ {4 r: e; k# u: M; ^20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
% ?' ~ y) l% o aIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
' k: J$ |& w- V1 x! onumber of warps allocated to each communication task is dynamically adjusted according to the, r4 ]6 B, @, W: v J! x
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,( z* f" V4 q, y5 n+ d' C) v
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
% z Q7 |0 K- ^* Ihandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
4 @8 X& d' C6 C! zoverlap with the computation stream, so we also consider their impact on other SM computation; \' Q f9 {' F, C1 X
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and3 h4 _. \4 Y# c: I
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache4 K. Z0 D w [( E: Y7 Y
and the interference to other SMs.
! K- C: g$ J" @, M
. h5 P5 D* ^5 C, P通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
# c% [; f) c1 D5 E4 W3 O1 L* p3 M; B8 S
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
6 ~7 k2 t) {$ L6 J7 ]' R1 J
* n7 c) }: S) B5 Z目的不是为了绕cuda,反而是为了让cuda的效率更高。
5 ]; i/ A9 Y: L4 y) K' @
+ j3 n( [: s# u5 G类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|