TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
& }5 l% E6 U8 w- l. E) _
在论文里,这是第3.2.2节的内容
' A* f: u. B, o" T4 P
7 i+ T q6 t# n5 I; r3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
) w1 F% _( O: p2 ]0 d: s* WIn order to ensure sufficient computational performance for DualPipe, we customize efficient
; {+ Z8 V" A$ V/ r7 Rcross-node all-to-all communication kernels (including dispatching and combining) to conserve' J( w& z+ w8 }* M, p" a
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,8 \+ I& z. w9 r% c Z3 ?/ P1 B) F4 C
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications$ p, i$ v) C# {1 _' S
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB8 A8 ]- L8 q# T( {- T% L+ j1 K/ E& G
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
) S: V" j4 R: G$ Qtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its1 m* O- S/ {( S9 z& N* t
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
; W2 V& A6 ]- N2 s( A4 L, {9 w5 Tindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
& g) i2 p% G/ Ainstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
& h& Z; @9 T9 B$ M6 wbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
8 s% w$ Z1 m- y) A% B- g8 w" g0 Sare fully overlapped, and each token can efficiently select an average of 3.2 experts per node( i/ E: n% M/ P3 C
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
7 e3 _4 c% I. _' J8 Y13" C' {+ w( f2 J
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts1 q* `* e6 F4 N( w
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under; m. Y/ h% | f" ]/ Y) S
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB3 L' R1 R4 {' e
and NVLink.
j$ i; }1 L C% E% o1 Q9 q2 bIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition6 Z" R) l1 R: X$ I
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)% r# P: R3 P0 u5 Z/ j
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
- n2 a7 E& y0 H% gnumber of warps allocated to each communication task is dynamically adjusted according to the1 H P& ^: ~5 [" |
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending," p7 A, w( W6 L0 N
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
' M4 ? J( J* x1 {handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
R1 }' A) g( I+ w4 J+ xoverlap with the computation stream, so we also consider their impact on other SM computation
6 X' U& W, c! G) | Hkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
# l4 x5 G" y ^3 k3 l/ ?auto-tune the communication chunk size, which significantly reduces the use of the L2 cache5 H+ j. o. P: S
and the interference to other SMs.; s# E. m w, f
6 ~& q; p* x3 d, q: f通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。2 w5 O+ u5 w, Y
/ D- B+ q9 M/ A我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
1 L5 U' G) B0 L9 [( h2 m& s: C8 `' ^& ]; X6 o& ~' Y% I, w
目的不是为了绕cuda,反而是为了让cuda的效率更高。9 i3 w" X% ~" w+ b Y# G: a
a B9 R* A$ p& n+ P' q2 s% h& v
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|