TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
$ M1 ]8 A, t, L7 ~& N
在论文里,这是第3.2.2节的内容, y: |. h5 E5 i) o$ N0 H* M% n
% t% L# p4 R5 c) D! i& I& N1 k+ P! O9 d
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication8 U" ]9 i9 Z, M7 U* a8 T- t
In order to ensure sufficient computational performance for DualPipe, we customize efficient5 i3 v# z- X- _
cross-node all-to-all communication kernels (including dispatching and combining) to conserve: N1 H1 m5 E& F, U
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,
5 l1 b/ K- m9 n: ]& _2 H4 \in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications/ y) f1 W9 I/ z0 q3 R
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
4 `: m7 j2 b: [& w- N(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each# k& V* { F4 ~' F( {8 T- E2 e% m
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
! A' M7 I; }; B. n# @' ~) ~0 y+ I( F9 erouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node/ o) g. U, z, M1 t. S3 a2 T* y
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is8 c) y0 |1 E* A) X8 r
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without! j- a* {- u. j5 S; }6 Z
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
) ~6 h% z. E6 |4 y7 \( U# Bare fully overlapped, and each token can efficiently select an average of 3.2 experts per node, L$ X; H% Q! f' {
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
$ e7 j a: F# x13
3 i. H) E' W. M* e: _7 `5 I- x; ?selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts% ?5 E7 u7 e. r
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
9 A7 a q9 ?2 T* Fsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB- @4 ?, n' o* V4 z3 {
and NVLink.
" e# q# u6 s( h9 X0 X+ mIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
' ~& M! f1 I1 e. k d' W- F20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)+ a/ S X! E$ R6 I: U
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The2 Z8 p) p4 M. R0 V- r O; R
number of warps allocated to each communication task is dynamically adjusted according to the* q8 o' F& R! e# r( }* y1 S
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
a v0 t; I2 b [' ^: H(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
/ w0 w5 z7 S7 W4 [/ bhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels& B# |4 ]: |! v/ s8 y
overlap with the computation stream, so we also consider their impact on other SM computation1 l* p$ G# \6 f- A4 a5 n
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and( r+ ~! S- L5 I6 U
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache: k4 f: k4 ?0 w$ S1 `
and the interference to other SMs.9 G+ K1 E4 y6 J' L G
2 L- x- F5 r) k1 K
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
1 Z' n5 W* \# B# \) c% o% \1 o& ]# D, M9 h
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。( ?. M5 J/ ?3 Z
' A/ F- v5 K0 Q0 S: `$ k% q
目的不是为了绕cuda,反而是为了让cuda的效率更高。- t+ V2 [7 J" a: i+ v
- I5 }8 W1 t1 d7 b类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|