TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
- x2 [+ \& F2 F [在论文里,这是第3.2.2节的内容7 u \ U7 c, N
9 i4 ]. j8 f2 e6 l* [
3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
5 \9 ~) u# X$ O. w' n2 m: j' GIn order to ensure sufficient computational performance for DualPipe, we customize efficient7 X5 J$ T& ?# W$ ^5 p0 m
cross-node all-to-all communication kernels (including dispatching and combining) to conserve: Y w5 p2 u5 ?7 ~+ ~; ~
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," U s, [+ Y; W ]
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications
$ ^5 A; _+ H I$ f1 M& E8 Dare handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB. L0 I) U+ Q! \" Y0 u
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
3 o) ^8 V9 y8 B" e, Etoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
* F: ^( r7 ]- @3 _routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node1 O4 [. C/ e" h( y% X$ ~+ s
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
# W( p P3 ~% G& i" P; \instantaneously forwarded via NVLink to specific GPUs that host their target experts, without! N9 i! y3 C; k- ]1 k8 x4 N z
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink p+ E# L9 Q. Y! I" b/ ?; H' T, m4 C& J, L
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node$ {& ^9 S2 W3 Y1 p
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3
/ i, o, H; c; S; z5 z13- K1 Q( z1 D# Q; s( @
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts
6 _! n6 b! [8 ^: R3 @(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
* C4 K0 Q# d, P0 L0 vsuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB4 O- k7 z: \ V( N: m; Y( Y* ~
and NVLink.. M! u! B, z5 J
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition( T: F' c7 T8 P0 ]" t+ s
20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)+ D; v; ^! Y0 k& u
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
! @6 L8 t2 o8 h7 D% t/ u4 Wnumber of warps allocated to each communication task is dynamically adjusted according to the
/ ~5 G# U. e' Y. g' x. Iactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
3 L! K- u3 _+ n( L& t(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also$ \: ~) C- R7 u; }) O/ D, i* H8 c
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels
* O0 r \' f% w( @2 ooverlap with the computation stream, so we also consider their impact on other SM computation- [1 [- o1 L+ h! \: {6 c$ P
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and5 I% h5 }; }% b- E8 P1 z
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
# Q- R& V+ n( s6 c1 Z' {. t5 y- s7 ?and the interference to other SMs./ y ~6 A* U+ |, Y% e# H
9 p, u, \/ i: i: D通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。
2 w0 H: j( b# w+ m
: [% A: s' Z- a% @2 f& Y我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。9 v) {" ~+ u0 N
. b, l; L% _7 k! `5 P2 ~5 g' ]3 x
目的不是为了绕cuda,反而是为了让cuda的效率更高。
4 a2 Z( |. z( d) O1 u
0 ~6 o6 M& J$ t4 T2 Q类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|