TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
" g8 L" W7 q. f* v+ T+ }7 k0 H
在论文里,这是第3.2.2节的内容# `9 M+ [( T- a2 Y$ p( N1 y
2 i6 u6 ^/ i/ Q* N& Q3.2.2. Efficient Implementation of Cross-Node All-to-All Communication- k9 e4 J% I' a0 d1 t$ {/ I
In order to ensure sufficient computational performance for DualPipe, we customize efficient2 r% g" |" N, H9 z
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
. b8 [" s+ @3 V9 Dthe 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,* D. ^ x; {! @ a# i. E9 I
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
; n m( o. \1 }8 I0 x# V) gare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
; z; \, r0 n2 I2 t0 D(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each2 q4 k$ @- A7 A* m% E. f4 {/ [, S
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its0 I. a+ u6 I% c; t) I& [+ l) p% ?
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node- }% s4 x6 Q. ~$ N! N2 ^& G% c
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is, w( O6 c. D% O% H- ?
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without, E! X& v! q2 T( [5 G; [6 m
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
' z8 a4 R8 Q4 n( G9 b6 qare fully overlapped, and each token can efficiently select an average of 3.2 experts per node) O1 W" f+ h2 f) Q; A2 S/ W
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
9 S* A4 p& l$ E13
! B' g- A; R: uselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
- d5 i$ \1 s$ ^(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under$ X- l9 j% m4 a! N; |0 a: a
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB" w0 `* h% {7 E; q) V+ m7 l5 R! w
and NVLink.
( I1 C0 p, I, s4 f% ^# R' [In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
% L" a4 r0 b+ }. X20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)4 a5 X( r% W8 D; y
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The; {9 m0 |' ~" r5 R5 }% l# S6 v+ q
number of warps allocated to each communication task is dynamically adjusted according to the
; E3 c+ p0 t3 P- ]actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
5 \, S0 O6 z0 r(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
7 w( O+ R( U0 Yhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels: R/ K. ` l3 B+ w; w) `3 m- E
overlap with the computation stream, so we also consider their impact on other SM computation
+ L# {8 ~& Q$ K2 `$ \/ L# kkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
l# k$ ^& I6 p, o2 i7 ?2 y% O' n4 ?& ]auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
2 ^2 _8 s- b( W! ^, D' T8 G3 Kand the interference to other SMs.
4 o' S' P& p% x
& h9 O; H+ r6 h+ Y! a$ I5 l通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
* s7 E0 m* E- V3 s" g7 t3 e/ q) d1 ~* `# J3 _! I. Y- B% [6 S3 x
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
' A( u. |/ G! O* S) P
7 P- e* o0 P# A( Y! B; B% a' @8 p目的不是为了绕cuda,反而是为了让cuda的效率更高。
2 K& W+ u9 |0 T& M8 ]. w: Y
; i3 R# H2 V5 B类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|