TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
. Z5 k9 c8 h7 [* U) u( D# @在论文里,这是第3.2.2节的内容: a% R1 y4 @8 p; L/ \. J
! o- ]. Q# F$ m2 N3 r" u1 \- @
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
8 e, v& X( Y; j: B0 X5 [In order to ensure sufficient computational performance for DualPipe, we customize efficient2 [0 p9 ~, f: I2 i! b" b8 X
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
' ~' Y. n+ y. z, rthe 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," X- R, v+ q' w% @3 x. B
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
9 n) w0 M2 y1 n5 ~are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
Q' B8 [% C0 T) |( x. h: ~(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each# Q1 d) M7 \" B# b& a' J/ y
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its6 ]! d+ x% C! Y
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node: x) M+ Y) S7 k8 N7 n
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
) e6 l0 p n7 W: D' Z9 G! rinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without! c" n- E7 K4 ? ^/ \, e# @; ^7 o0 N
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
+ g+ | l2 H# a! h1 Pare fully overlapped, and each token can efficiently select an average of 3.2 experts per node: _7 c4 |; u' v: ?
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V37 S1 a4 R0 V# U8 K5 e* Q
13
) N `0 w4 Q7 \+ Bselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts! i# W* V9 M% O
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
* s, ~5 ]7 ?) G+ U, A4 e3 o2 Rsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
* R' g: v" I' [/ M' L5 j9 @& h$ v% Wand NVLink.
. K. F3 z' R5 D# q- f, @In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
7 L. B! n2 M( W$ P20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2); x( u4 h- p$ W, [" O" n
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
+ H! t# o3 [0 J. \3 Z& E' Lnumber of warps allocated to each communication task is dynamically adjusted according to the; Z, N8 d3 Y& Q. y) Y& ]$ h/ V
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
& G; G& }7 V* U. F0 O(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also% x+ t% n& a9 a
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels, M7 I+ p; d! v( f9 H! t4 e. C3 M/ T
overlap with the computation stream, so we also consider their impact on other SM computation
; T7 W' v! S# k. ?8 X# S. ~kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
" e2 A5 o, ^4 _6 W: {6 Jauto-tune the communication chunk size, which significantly reduces the use of the L2 cache
9 S8 C' j6 \( J9 wand the interference to other SMs.+ {5 M$ d* {+ E; r% x0 J
' u4 S& U, Y" R: c3 e3 `6 m1 n通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。- d6 G0 g4 E9 M" V# n/ c
6 j# K+ F e6 i# w0 e
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。, l' L8 `, \* Z; @8 k# h; ^
_& a7 F4 c N/ u1 ]8 g* |2 g% w目的不是为了绕cuda,反而是为了让cuda的效率更高。
6 E$ D8 f9 d4 V; ~+ H% K& ]' ]7 u1 P& ~4 C( Q5 x5 ?
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|