TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
1 n' u" X, U8 @% ~; M在论文里,这是第3.2.2节的内容+ S9 V1 D1 l* Z9 t; C' b
M3 t* c/ b! ?. ~7 P) b2 Q0 j3.2.2. Efficient Implementation of Cross-Node All-to-All Communication: E- e. b- m' `& M& v4 s' _
In order to ensure sufficient computational performance for DualPipe, we customize efficient
% S) S& N# F7 k% jcross-node all-to-all communication kernels (including dispatching and combining) to conserve
0 H0 Q0 C( \. P- pthe 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,. y/ c w9 g" c) U
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications4 A$ ?! M' I' a5 S ^
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB6 d/ ~$ c- A# H5 Q, `
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each8 \% y1 j' N1 j" X
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its" P1 h1 ~0 Z# P5 A
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node
' q6 X- p/ X* [4 H7 G3 l7 ]8 t. b- Findex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
- ~5 s* u2 r4 |: e S; ?8 ^instantaneously forwarded via NVLink to specific GPUs that host their target experts, without9 F$ E3 p8 B Q4 c6 z" V& Q
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink' k! e4 I7 S6 A- u3 b% z C( ?
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
7 r% z2 J X6 {9 k: N( b, G. b9 Wwithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V33 W, I1 v) {$ U# [; B6 o: I( i& d
13
/ n9 M5 g z2 g" m$ y8 jselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
2 G" V* r; L1 u' j2 S(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under/ C; a; L$ K: j) b) g. X7 R
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
1 t2 U6 y- I. c) rand NVLink./ P0 F. M0 @* p4 g1 Z/ X$ h2 T, G6 j
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition4 I8 l+ k6 Z( s% U
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
: q6 H& e: T+ I- Z+ ]IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The0 U+ T; B* U. M& T% H- L
number of warps allocated to each communication task is dynamically adjusted according to the
8 o5 c! @$ V5 p, P" P, Qactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
% P! Q) G# _, u2 ^(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
- U3 G* r! i0 j# y/ k- T! H2 ghandled by dynamically adjusted warps. In addition, both dispatching and combining kernels2 x0 v- S4 O) V
overlap with the computation stream, so we also consider their impact on other SM computation
8 K+ L( i4 w" _5 gkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and& J( \5 I; k, W5 X0 ?
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
3 F. w4 K! }6 V( ~. K: u8 [' Hand the interference to other SMs.5 z9 H3 j: y o. E
3 i8 p! \& B7 i1 G* k通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
" _! G4 M& j8 r
6 F7 z9 L$ s+ S6 i& `我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
1 p1 n3 e6 t: z
3 ~8 D8 ?$ \) j6 O: |目的不是为了绕cuda,反而是为了让cuda的效率更高。
7 ]0 f" K- r* A7 f
G; ?! e& M1 O; a+ o, C/ M类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|