TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
) G! I& X1 |# e
在论文里,这是第3.2.2节的内容
( O9 G# |2 k$ w5 D: h# T4 S$ O* h0 ^( ~0 A
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
! \$ w/ O' a; [. D' W3 |- ]In order to ensure sufficient computational performance for DualPipe, we customize efficient, K; \7 g0 e1 O- P
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
" ^1 ~3 v! `: a1 C% Q" P' Y+ jthe 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,
) s5 `* e3 R2 `2 Y+ [$ x( tin our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications7 N4 p, k/ @; q8 M. N2 W
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB, r- i$ u, r o' U# c; ?" u
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each G! o# S6 \4 @# }
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
! K' P& j2 w0 j7 d) O3 `routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node/ b6 \+ {; o; d
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is! f: E/ g; Z* X3 R4 z8 M
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
, r. v0 v; M, ~+ S4 J9 Rbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
4 {1 f( l1 k5 A' r+ s$ _- j8 Qare fully overlapped, and each token can efficiently select an average of 3.2 experts per node
2 |7 C9 ?' s3 }2 Pwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3# m4 q( ]; @5 e* ?7 T
13
! ~' W: g' } G! ~) q0 Q" w! Q) p# _selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts: U$ r7 |! R7 y; T$ V
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
* p) ]2 [9 C% ]7 }such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB: J- m1 s0 K4 q9 ?1 [
and NVLink.: V) n; L3 M' G1 S0 u$ `$ D; S
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition! s, `) M# H2 ?) e* I, y7 z
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)5 B: L) l' U* u, b/ q% n
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
. g: X5 Q2 L7 @) l/ k, Snumber of warps allocated to each communication task is dynamically adjusted according to the7 ^9 _9 p5 [- @" l6 ~9 u. k9 e
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
1 B" X! s/ f1 {7 Y(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also4 U. b K: U' @
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
4 T; x* d% N# N% `5 poverlap with the computation stream, so we also consider their impact on other SM computation
6 L2 R0 B' O) e+ w3 f9 Kkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and# P. L( d1 p. Q' Q; x( x1 X' L
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
8 e8 K3 K3 Z3 H$ i% O# j- Z& [/ ?and the interference to other SMs.& I9 ~* l8 W' S o* Z& H$ Z: M# Q! U2 t
+ t4 d4 z( U0 T" l/ q2 }% R4 Y6 t
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
; B$ K. k1 d1 h8 a- I- N s6 ]8 m7 q; h6 |+ m9 G2 i4 K A5 M+ j
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。: P' X% |) g1 y# F4 ~' [, r
) j) [1 u; i j; d% w# e m; T4 ~) ?目的不是为了绕cuda,反而是为了让cuda的效率更高。
; {- _- O1 \3 k4 P8 D) u0 W0 g$ ?2 d# ^8 C' M! R% p2 G T4 x
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|