TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
5 K$ k, M6 R$ E2 R/ M
在论文里,这是第3.2.2节的内容
, E$ x W/ N0 u9 k
$ w O# p2 g( e( @' e3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
' q" Y7 c6 `7 ~3 sIn order to ensure sufficient computational performance for DualPipe, we customize efficient) G9 y1 d8 g6 |% M' k
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
5 Y$ x: a! H) B2 z, z! mthe 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,! c% m: y9 W E% z+ k9 ^. I/ ^* }
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications) F, b: U/ `; B' M! H+ Y8 d" h
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB' I/ Z3 c0 T% ?! a' M1 A" }
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each
8 x5 D5 y! q$ f# o% N7 p7 itoken to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its
* l+ z8 R9 {* S% d" y: ]6 lrouting decision is made, it will first be transmitted via IB to the GPUs with the same in-node
6 q4 Y. a3 I6 [0 M; |5 A7 uindex on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
. b6 X( S% j5 V4 {9 d4 @instantaneously forwarded via NVLink to specific GPUs that host their target experts, without: ]9 K3 x8 V( P- k/ q P# U+ t1 J
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink4 L3 s6 C N% p0 k0 S
are fully overlapped, and each token can efficiently select an average of 3.2 experts per node
% B6 c$ n/ y! ^5 H, swithout incurring additional overhead from NVLink. This implies that, although DeepSeek-V3$ q& c: O7 H8 y1 k3 D. d) G& O% W
13; ]* c& V+ C& O1 o
selects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts) D l7 b4 j/ E, I, l! l
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under
9 b) |( g; }, Ysuch a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB
' [# u# G, p* A* s% e8 Oand NVLink. A; C; O& L3 y& ]3 N! U6 D6 z
In detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
9 O, s, ~. G- ^20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)
~& h# L; ~& ]* n( w* B2 yIB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The
# ?0 ~/ v* W _$ L+ g) xnumber of warps allocated to each communication task is dynamically adjusted according to the
) b0 I# r0 R+ sactual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,) { q' {9 Y4 R$ I1 `1 d
(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also
" ^: f/ y) p- x( V) e! m8 t+ Dhandled by dynamically adjusted warps. In addition, both dispatching and combining kernels
) f2 F' K$ X- R. S- qoverlap with the computation stream, so we also consider their impact on other SM computation
@# D& q4 s9 S( X! Ukernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and8 D0 `- {" s0 R$ B& n _
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache
6 D0 P2 c; z; t0 dand the interference to other SMs.
3 `" `' N3 I, z& ~' X K- r
/ ?6 @. s) s4 z3 k% X, O9 j通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。9 e2 F6 p& ]+ Q6 h/ ^6 F; I
/ Q- b: V5 W, q% p! D我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。* p! K, X3 S! X! W! i/ f
6 `. ~& l6 u6 M" Z% B! ?目的不是为了绕cuda,反而是为了让cuda的效率更高。
/ ~7 }8 D4 Z$ M
( c1 n" S- o! Y& F类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|