TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
. X' j7 J& s6 e! B& u. _$ U8 [; h: O
在论文里,这是第3.2.2节的内容
) t! |; L% a; f+ j$ h% [# _9 L) I0 C% @
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
7 O% `$ k) T8 ^In order to ensure sufficient computational performance for DualPipe, we customize efficient9 f! ^% w7 ?- d W5 Z8 ?
cross-node all-to-all communication kernels (including dispatching and combining) to conserve$ t7 V. D+ L, n7 V J
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,
$ e2 k: V0 m+ \7 `) N! B R+ gin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications0 \( D( n; H1 `/ U. I* X2 m$ d: K) Y
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB& |" e# j( ~6 L; p
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each# `: \( q0 @' m1 X& h: D0 w
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its5 X/ q% C& r. G5 v& D/ l
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
_* }( j# Y4 e. kindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
/ X' b8 K; a7 k. Ainstantaneously forwarded via NVLink to specific GPUs that host their target experts, without
5 \+ g8 |+ v7 H7 V4 i" ^being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
; x8 B! s% N9 ]; B0 }are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
* B! W+ l2 _( X6 E1 s) owithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
3 B: b/ ]9 R2 B; V$ G1 r& x13' f2 A/ d+ D' q" i! y `* }3 t5 _4 V
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts) W" O& N" o- t+ k
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under9 D8 Z: q7 }$ I5 o! D( u
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB5 C7 O& f+ y0 Q5 @ Y
and NVLink.! S- a% R. y+ t& s8 z: v$ u3 B' ]
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
9 D6 n0 Q) ?) T. |% _: @20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)$ i; `7 B& ~% t. N( J) q
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
+ h1 ]. G& w9 N% |/ Dnumber of warps allocated to each communication task is dynamically adjusted according to the
' w4 g o1 A1 c5 e% `7 l1 mactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
( F9 A# y, a- U7 c(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also" S- i6 G; ?: a
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
: E& ^4 n# Z: q% ]. a5 o+ Voverlap with the computation stream, so we also consider their impact on other SM computation
3 D3 u, [4 {2 z& Xkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and! U/ U. D9 E* k: A
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
8 Y4 d7 J9 Z) ?7 ]% pand the interference to other SMs., Y, _. [: A n M, V: f' [
4 _8 R0 n# R- K通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。' j6 q2 G# H! j
! C: R$ F& n9 X4 o; w2 r
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。2 v, M. v$ n5 X5 Z0 ^5 `$ G
7 L+ M1 M) Y4 c7 C* R- @/ \目的不是为了绕cuda,反而是为了让cuda的效率更高。
5 _6 B U" k$ M8 ]7 m+ s3 B+ g
* S: e/ x6 T8 V$ R2 z类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|