TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
v% m: g" t! r# w1 z
在论文里,这是第3.2.2节的内容
7 l1 p! l; U$ P, m5 ^* t0 i; Q& L2 {. |/ \; ~% C& F0 C5 }) h
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication: f0 |% M. i) [( I4 {2 q/ X, y
In order to ensure sufficient computational performance for DualPipe, we customize efficient g; }' K+ ]: ?% P
cross-node all-to-all communication kernels (including dispatching and combining) to conserve- L p, W1 f2 ^9 m* l' M2 G
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 O8 L( r. @" ~( ?4 bin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
{; {3 Q, J3 s! l# eare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
) Z {! C& ?$ I! t8 ~% i! T& |(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
$ _8 ]4 L) c+ N3 Gtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
, @3 H: n" e3 `3 z3 q/ {2 Vrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
$ {9 |' v$ v& J/ q cindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is6 a8 F/ T. Q9 P/ P6 g2 k
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
' F1 L2 z" m7 g9 x" U/ y% O' ubeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink$ N9 W# Y6 B: _+ |7 Y1 H* C4 D3 e
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node* ~9 A, d& w5 F* J4 m# g# S
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
G; x: \) L) Q) |/ }$ c, X: U9 k13
' U7 O" U# }& S. ^' i# l# b( kselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts$ ?8 ^+ D# _$ E% l0 F# X& g
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under: [) P' N R' K4 `
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB, W: B4 y0 |* O
and NVLink.: Z5 \. o4 [. ~3 c/ e& Y
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
; }! I$ W" f$ p, Q# ^/ w4 F20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2) \2 `) D z. s
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The3 T' Q; y3 Y7 f! z! x1 c
number of warps allocated to each communication task is dynamically adjusted according to the
" }; ~4 Z- t$ B: }& Q' @5 z$ Oactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
: J, D' c6 C' E# W- I; \1 \/ @(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
5 {5 R: u3 Z+ w( L2 B [handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
; M8 l+ o! `0 p) a: ^overlap with the computation stream, so we also consider their impact on other SM computation
- a* f0 N/ ]: e9 A! s) \4 ]kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and
2 q* @5 I: ?! D; ]9 _' zauto-tune the communication chunk size, which significantly reduces the use of the L2 cache' f8 c+ v4 c) n9 c
and the interference to other SMs.4 X: x4 z' U& _% r2 j- a9 w9 ]
+ {' r: O u0 v; z' {, E通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。) D5 C0 ]9 l, z9 }1 z! Y! i
( c! a( E# z0 Y
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。2 }- W' I7 b5 x4 R, c' O) a# o4 N8 A' k
% H+ }7 z0 h8 y& o7 T6 C/ E1 B8 Y
目的不是为了绕cuda,反而是为了让cuda的效率更高。8 k/ E+ \% w* {. l% L+ i
0 x5 m `7 n8 M1 w# O+ q1 \类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|