TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
7 _, ~3 E& F$ U' F9 G在论文里,这是第3.2.2节的内容
7 c: t$ q$ O" ~7 u% T& W8 {6 @, F( x% I2 e2 q6 j
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication: u0 T# i3 h; T: m
In order to ensure sufficient computational performance for DualPipe, we customize efficient# P$ d- V7 g% a% T/ C3 j6 A# Z
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
6 C9 t: g5 ~" [' bthe 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,3 _% h, e( n5 a8 t
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
e% S9 Z* f" h0 o7 u" R; b% ware handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB0 |6 @9 r( ]! L1 @* w" Y( v3 l
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
: d* S+ _' ?+ W( l2 `$ otoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its4 S9 \3 S9 W, L+ ^ a% u9 i
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node6 W2 l. x. I& O& S
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
5 g# Z' J8 t1 a3 W& h2 T; yinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without0 D! w4 y" P' L% w/ }" o( g
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
, z- [! l0 V$ u0 Q) `3 ^2 T! Kare fully overlapped, and each token can efficiently select an average of 3.2 experts per node+ a. R7 Z( F* t4 u2 s
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
! F u5 Z5 ^! x' V) S* _13
3 E8 g, N, J6 n4 o. F/ L- ]selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
* c- A, [% M. b6 g+ V0 ^(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
~% m0 f# ]# R+ Isuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB( W" H2 f: `8 D4 A; z
and NVLink.# p9 Z* U( y7 ^4 v$ d' S
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
9 a. |; I2 B" O M" x& a/ @8 {' {20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
f4 w( `- `& m5 G3 b+ [4 AIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
' V7 k, {7 o8 m, x' A& T3 z2 O% |number of warps allocated to each communication task is dynamically adjusted according to the
x' }5 l' [9 P2 A+ w Uactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,8 t' R# F, L! q0 k' S% k2 I
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also7 ^# B" E2 f8 m0 V" m& J1 r
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
6 G0 E8 h3 p7 Coverlap with the computation stream, so we also consider their impact on other SM computation9 j* [! j& ^: ?, ?7 m- ?0 Z: t
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and Y' J/ z/ i' N
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
6 \7 u) V$ k2 Nand the interference to other SMs.
7 | N; _3 j% h$ ]3 W/ T; M3 |0 ~. t5 i ~- O
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。, @' v1 d0 |' [) W9 u4 Y0 h
" Z6 d2 k, v9 R' V# `: m我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
) w N6 e/ m" g
0 _6 r. W m7 P# e6 Z) g目的不是为了绕cuda,反而是为了让cuda的效率更高。
. `1 A, {6 N7 u% A( N4 \
2 C, m& y0 v/ ?1 y/ q$ g K类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|