TA的每日心情 | 开心 2020-4-8 10:45 |
---|
签到天数: 227 天 [LV.7]分神
|
; t* X# N ]5 K
在论文里,这是第3.2.2节的内容: @2 p* t4 ~' y: {3 B- O3 [4 x9 ^2 S
! e& J( y0 W' H+ o" T
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
) P* A4 _ G1 _+ p0 {In order to ensure sufficient computational performance for DualPipe, we customize efficient! c- ?, t( r( U7 R
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
8 Z. t. t$ T, e( l2 U: I" Athe 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,
- ]; m) ~7 C1 h% W" d7 X& q$ ain our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
. P: H P2 m5 d8 o& k5 L# ^/ ?are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB
3 |4 S1 ]8 x( {! C(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each, I$ X: E7 Y" l% x
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its h- ^& O7 F/ Z5 i X% W1 |
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node; J _/ c0 y W1 ]. J$ e
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is" [$ r y- B2 j/ n H
instantaneously forwarded via NVLink to specific GPUs that host their target experts, without
3 y3 B5 U* p* R4 Mbeing blocked by subsequently arriving tokens. In this way, communications via IB and NVLink- l. t' `0 L) n2 |+ e& T; J
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
" }4 P; |2 P- _- P& a; v1 owithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
+ v; E8 f+ V. a; x13
9 J& d$ H* T' L+ N( fselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts1 I p; z* o4 K9 M7 L3 O3 y
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
* [, B4 f( s* `$ |+ t9 i& V: p6 isuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB1 }- y- J# _* g1 p
and NVLink.
& l/ L( G! v, l- h4 J/ rIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition( F: M: A4 V4 f3 ]% z
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
+ f. ]8 [9 ?$ b A& {5 }% iIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The' j8 I- A6 g5 @* t, F' D
number of warps allocated to each communication task is dynamically adjusted according to the/ D9 y3 D! B' c5 Y$ l2 D& E; t
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,+ G4 {, S4 ?5 j$ ^6 i, q
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also! _: \" O. \6 @% F
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels: }! c5 L0 L( O8 p7 v# [
overlap with the computation stream, so we also consider their impact on other SM computation
# o$ R" S/ ^& Kkernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and2 N u; I8 Y' _# w
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
$ Q1 V! x0 z* W2 {& {5 P) j( y ]and the interference to other SMs.8 H5 s1 W; h6 W! P- O
2 K% ]1 e' {5 B+ l O' v+ p通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。3 `: H) {5 }/ K% l* R$ M: a0 w* {
( Q6 |. ^2 i( ^& K8 r; C我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。
: Y/ c& G5 o# ]; R% l5 k5 q
- ^* U2 O, J: t1 `2 N# w7 a目的不是为了绕cuda,反而是为了让cuda的效率更高。* @, ^9 T# l% h/ a
. |$ W3 a- y0 i2 q
类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|