TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
! w K' F5 i3 B
在论文里,这是第3.2.2节的内容
* m/ z5 G3 D9 D8 \
! i! w/ b" [7 m3 ], ^/ @7 q% S3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
& c' a) q% H; ^* g' k# U+ e1 q2 VIn order to ensure sufficient computational performance for DualPipe, we customize efficient
) K3 V' [. l1 X- B6 i( ccross-node all-to-all communication kernels (including dispatching and combining) to conserve
5 m" ?% f" P# Vthe 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,
/ q& f1 m) J2 R4 y4 d4 V2 {3 ^in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications8 K* n5 Y1 L; |: `( Y! |
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
* _+ G ]' K, h(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
4 `4 E. t4 S' ?: Mtoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
; f0 o: Q$ w2 S; h: B) _' t2 Jrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
7 i8 s/ T0 Y) P8 [6 hindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is( ^' p# I! O, S) K/ @2 g
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without( Y5 t# x$ Z8 K% n& j
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink) c0 Q. b& ^6 B5 v; q0 R* t. G; z# u
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
9 E/ p* X, a4 s! Owithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V38 _* U' X4 s+ c3 X$ E
13. W5 U- Q4 O6 X- b5 }' I
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts: `5 J& r; X4 p9 Y/ |8 u( G8 w3 s( G
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under- N. V# r" B! E8 Z1 r1 R
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
: N L$ @% l( ]2 u0 j0 e3 Cand NVLink.. U! }# D% p/ a `( L' R4 X
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition' j- m0 ]. W0 L% S
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)8 z& p, @: T1 D8 g; J
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The% g0 N/ W2 v, y& k' ]0 G) u4 q0 ?! ^2 `
number of warps allocated to each communication task is dynamically adjusted according to the% H5 E( p7 G/ Z/ {- i
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,2 [9 _) C) O5 }/ Q+ @
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
- j) D! }9 N# P" z' O1 Qhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
/ M8 _, H" |" p$ ?overlap with the computation stream, so we also consider their impact on other SM computation
3 I) u+ o, @1 D7 gkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and0 y, g: ~ u3 @8 s
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
; u4 K/ W5 G5 U- m& l Fand the interference to other SMs.
+ L7 ^- V% f$ p: A) ]7 T8 D, J& W( a
通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
1 |+ W# f# d1 q; h& O9 R
7 U8 J1 r* S3 m7 h我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
& [4 ]2 M5 z1 z. X; `9 a4 {4 H. Z1 i: f" f' J/ k4 }/ b- D
目的不是为了绕cuda,反而是为了让cuda的效率更高。' G$ k, r- J: d; C! A
, X Y- m5 t; X' k/ `8 ?7 E8 n3 o类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|