TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
! n) U% Q* a& p0 ?( V0 i
在论文里,这是第3.2.2节的内容) T. d [. e, f( c9 e6 G$ G; B
" e/ P- b; c& s1 b3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
% g5 \( s; @6 Z& RIn order to ensure sufficient computational performance for DualPipe, we customize efficient
0 W+ o+ F% q9 v/ \# T1 u- w0 wcross-node all-to-all communication kernels (including dispatching and combining) to conserve
& ?) W* Y& g7 A' N- Wthe 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 w2 S9 A9 E$ Z0 P- Q% pin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
% i% [+ P/ z; V+ T* F3 dare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
0 |7 b4 B# y8 x(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
$ w' {9 m# k. Q5 b$ ]$ Ztoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
% U( A- B& b, E, w* jrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node* |" F) {9 L* ^: b. w
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
# Z9 O+ r7 w# Finstantaneously forwarded via NVLink to specific GPUs that host their target experts, without1 x+ W8 o/ n4 G! _: s4 y5 M
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink6 T, f8 C/ p) U' \
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node) ~. p; U- g6 @2 y
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
. t/ M# E2 V, n6 r/ s13
4 e9 G& f+ N8 G+ s/ j6 J E+ T3 ]selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts3 g" w% q+ L7 e- Z+ o
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under5 M! J: v$ U9 x7 E2 T' ]( Y/ B N
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
; ~6 d1 b' G w7 n% fand NVLink.
9 U" |8 A+ C4 J3 F. D8 NIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition& x. n, l$ W* l, I8 O, w' p
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
# V! X$ j1 T) ~" z3 r1 NIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
; \) ^$ Y( u3 T+ S0 `8 _number of warps allocated to each communication task is dynamically adjusted according to the
' @3 N3 ]( p7 V1 U' Z pactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,* q) |: D9 |- k4 C+ d0 T+ |
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also' u, |8 Z# k6 u7 W+ h/ c ~
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
" A0 E# Z8 M( V1 N7 Woverlap with the computation stream, so we also consider their impact on other SM computation8 E" D3 T1 \6 M
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
2 ?& W* c+ p" |# r5 Qauto-tune the communication chunk size, which significantly reduces the use of the L2 cache' Y# ~+ z% m- { ?$ F
and the interference to other SMs.
# t6 [/ p/ R" b& r2 r8 H+ u/ R0 m9 q w" Q# a- D+ r" n8 @
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
4 S: l3 S$ U6 u4 t+ ]2 h7 E8 Y$ d0 ?! S2 z& c9 o+ \
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
# s( q& z$ b3 |6 M6 A! b/ x# N2 e* M4 i. a' n8 u T/ P2 c5 F
目的不是为了绕cuda,反而是为了让cuda的效率更高。
5 B' z$ K$ C( c" A# l$ Q7 O
; H4 A8 W; ^" E& p类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|