TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
$ F, s$ H/ r% W& h: D/ c, @' t) m
在论文里,这是第3.2.2节的内容
& c) x- X3 p9 c+ m2 c" U9 }
& e% s* ~# h/ W5 C# l3.2.2. Efficient Implementation of Cross-Node All-to-All Communication0 A+ S2 f* E6 s, V) L
In order to ensure sufficient computational performance for DualPipe, we customize efficient
1 Z, E) N$ V* E3 bcross-node all-to-all communication kernels (including dispatching and combining) to conserve
: \" O9 q# u3 A3 @, K) `! }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,2 A7 r& t7 ]! T9 a% J4 E
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications# H8 b2 d7 h" u' d) G
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB% l/ J3 t" p) p, @. Z+ m
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each( H8 U. @& @0 F% }8 ]% f2 b
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its$ |. C3 j* Y9 d- I! c& h( V1 D8 d
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
c9 i- }$ K% d2 c: J. _: Aindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is3 U4 |6 X) w7 X% x
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without( N1 D- a: H6 Z
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
* f4 s ]. T4 z& c9 o7 Tare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
; Z2 u+ o. h1 F ?/ Q. G _0 Y+ jwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V32 x6 S5 {" n* X8 Z k5 ~6 C
139 p3 }/ q: j9 j. t+ ~
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
$ X+ s& m0 f; h) }, `% }(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
; z$ D5 z# J$ s/ v1 }, b }. zsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB! m) y% c; f7 V7 g% D. V
and NVLink.* f1 k% l \1 j; U9 J) g
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition. u c2 P7 s5 ? K. m4 e
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)9 }* P" R4 R" m
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
6 r2 d5 w& W) F: z% J! \number of warps allocated to each communication task is dynamically adjusted according to the
3 l" W% c2 G8 a3 a" a5 g6 Oactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,9 a' `4 W5 o6 P7 D- ^/ t
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
+ l9 E6 o6 O3 b/ U/ W6 [5 N2 rhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
5 T$ D. n3 h; Hoverlap with the computation stream, so we also consider their impact on other SM computation
5 `. Z0 J' T# S: f, q9 akernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
" s' E' `3 z! \( B0 b/ Cauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
" D: ?8 v/ E5 r* ~% s2 ]; Y* F6 aand the interference to other SMs.
6 a, V+ b( z" |" b; R6 C/ y, X3 d$ \* T& _; J g
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
7 Z; ?- F x1 [* M! l. J
5 N3 B* L2 t, R5 m. @我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。5 p! l9 G1 B2 L0 p6 Y }
: V- {4 k: b' j. d, S目的不是为了绕cuda,反而是为了让cuda的效率更高。
7 R- U+ m1 h* P9 f- N4 A- e* o2 x# G" \' X
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|