TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
' z3 B, k$ F9 r0 M' E& Q: b在论文里,这是第3.2.2节的内容; R4 i$ A, E* I8 _3 E( Q( Z8 O
4 @1 a& ~/ l+ ]1 C8 p- G$ u
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
% R6 T* J K$ g" r3 Q9 BIn order to ensure sufficient computational performance for DualPipe, we customize efficient
' R" a8 z1 V- ]# ^0 r$ I7 qcross-node all-to-all communication kernels (including dispatching and combining) to conserve9 Y" M# r$ J; ]* ^$ z, p# N& D
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,5 d1 E/ B0 n9 U0 P6 I! O- d0 W$ S
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
+ g* Z1 g6 n# y* vare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
3 V/ o) A9 Z1 I! r q# I/ A6 f5 S4 o9 W(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each( T! u1 Y# M9 j' ^
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its) T7 Q# X. S$ X5 D
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
* E Z# P: Y& I9 I" o$ Uindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is( R7 V1 w2 r& O9 M
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
( i3 J# W7 K. u& F: Bbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
0 n2 E: B0 @: `. O5 L* M8 O/ f/ b, qare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
$ z# z3 U4 @, v$ t' d" t3 F- W$ dwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
0 E; [" L& R+ P5 O6 w13
5 T' |! Z" S3 t/ O6 o0 r4 L( Cselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts1 X; f' m/ Q/ t2 A6 A' u
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
+ b) ^( P, ~1 Q* h+ w9 t6 ]such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB1 i q1 N$ l2 `% B" r
and NVLink.
1 ?6 J( ~( N/ _6 k4 s; @$ j9 G4 M' CIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
5 O9 i, H" ]0 n' J3 H5 \$ a/ z20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
) u" Z2 g7 J3 @IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The3 w0 a( V# C, [9 ^7 P0 c2 _
number of warps allocated to each communication task is dynamically adjusted according to the* |( z5 _8 Q4 D7 o0 P
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
. L. M# R8 J( d6 p% ^4 a# b0 c( X(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also2 P& h9 a% C! H6 u
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
8 K' _8 T& m9 w( |overlap with the computation stream, so we also consider their impact on other SM computation
7 F3 u! O' ~: ^4 Bkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
' D1 m1 Y' p/ v5 z7 _' gauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
0 F! o, M5 c9 ? S/ U4 v" M( C% Oand the interference to other SMs.
1 p( T% {5 [2 z" m/ c: @* j3 V* ?( x( a2 `3 A' ?1 D
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。' h3 v( e' P* e# J
4 U( \/ m( k' T我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
9 X6 O& _+ [. F" W c+ R1 u- I+ G' o( g+ F5 j/ A
目的不是为了绕cuda,反而是为了让cuda的效率更高。& y+ O2 P4 E- x
* k& H9 `) K4 o" m# F& |
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|