TA的每日心情 | 开心 2020-4-8 10:45 |
|---|
签到天数: 227 天 [LV.7]分神
|
$ `+ I: N% B1 J2 _/ T' ?2 B( u) N在论文里,这是第3.2.2节的内容
' v. d; a2 Y$ C+ W& \4 Q- C6 ~) V
" E1 o( q$ }) `3 }5 O7 r. {3.2.2. Efficient Implementation of Cross-Node All-to-All Communication
( p7 l1 l; ~' G9 ?% bIn order to ensure sufficient computational performance for DualPipe, we customize efficient' j7 \3 C' u: r% K
cross-node all-to-all communication kernels (including dispatching and combining) to conserve
; j5 p9 u; l2 K9 ^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,( S- |6 x( b& i
in our cluster, cross-node GPUs are fully interconnected with IB, and intra-node communications: y8 l# r* f9 E% n/ k: T
are handled via NVLink. NVLink offers a bandwidth of 160 GB/s, roughly 3.2 times that of IB4 Y8 c7 }2 i; @ o
(50 GB/s). To effectively leverage the different bandwidths of IB and NVLink, we limit each) y3 s4 L" H. x) C0 O+ a; Q
token to be dispatched to at most 4 nodes, thereby reducing IB traffic. For each token, when its8 q2 l) n0 S5 b6 a3 q
routing decision is made, it will first be transmitted via IB to the GPUs with the same in-node3 j7 K V; @& ~! p i u0 ]7 ?4 T
index on its target nodes. Once it reaches the target nodes, we will endeavor to ensure that it is
, K& U, f0 x( a5 Xinstantaneously forwarded via NVLink to specific GPUs that host their target experts, without' w/ t, Z9 U9 z3 x% e6 q1 d
being blocked by subsequently arriving tokens. In this way, communications via IB and NVLink
# c( n& A$ Y5 f3 g7 N care fully overlapped, and each token can efficiently select an average of 3.2 experts per node$ Q# z" L* F }! `5 |6 f; w
without incurring additional overhead from NVLink. This implies that, although DeepSeek-V3+ D4 z# l8 j3 s c: m
13
, V1 N* J8 _7 [- u9 y9 j1 Iselects only 8 routed experts in practice, it can scale up this number to a maximum of 13 experts5 ^0 U- t% w# V9 g6 `4 T7 o9 l
(4 nodes × 3.2 experts/node) while preserving the same communication cost. Overall, under0 a5 m9 i8 l5 h! y$ ]5 L
such a communication strategy, only 20 SMs are sufficient to fully utilize the bandwidths of IB- B+ B4 a8 y }* C
and NVLink.
/ G% A. D) K& s% d. ]7 f! nIn detail, we employ the warp specialization technique (Bauer et al., 2014) and partition
2 y8 f, }& _% M; v" k& ]20 SMs into 10 communication channels. During the dispatching process, (1) IB sending, (2)9 }3 Z& V2 F! r- s. Y! o v
IB-to-NVLink forwarding, and (3) NVLink receiving are handled by respective warps. The' k+ I# ]' C$ ?) Y8 Y
number of warps allocated to each communication task is dynamically adjusted according to the: n+ s" x; D. T& l3 L& h; Z
actual workload across all SMs. Similarly, during the combining process, (1) NVLink sending,
: T" e6 G* Q$ c5 I2 y7 `3 z(2) NVLink-to-IB forwarding and accumulation, and (3) IB receiving and accumulation are also# Y! D& ^5 D8 J2 k; }1 h% Z
handled by dynamically adjusted warps. In addition, both dispatching and combining kernels- _3 T2 H6 n8 }
overlap with the computation stream, so we also consider their impact on other SM computation I# ^. u9 ~/ }/ z; \
kernels. Specifically, we employ customized PTX (Parallel Thread Execution) instructions and0 T1 x8 H) F' W6 B+ F/ B( W- q1 E! J
auto-tune the communication chunk size, which significantly reduces the use of the L2 cache" c1 a& s) k# ~8 S9 T+ c
and the interference to other SMs.
' Z4 M. H* n. L3 t2 n9 q% ]
. o& Q, Z% o1 W: Z6 u2 M通俗一点说,就是为了实现高效的跨节点全面通信。解决的问题本质上和唐家山老师日志里说的双机对拷的场景差不多。一般来说单机多卡之间用nvlink,多机多卡之间依赖IB网络,但nvlink的速率是IB网络的速率的3.2倍,需要通过一些优化来实现更好的传输策略。这是一整套方案。" n' a5 ]: F* y: ~8 b& ~$ A
1 D7 ^$ R8 P5 |0 Q" E
我的理解,使用PTX在其中,是为了更精准的定制线程执行减少通信块分配传输之间的串扰。 V$ f6 @9 Q& S" f& ~- V
2 K3 u3 m+ L3 Z& O目的不是为了绕cuda,反而是为了让cuda的效率更高。# ?8 G1 k! V8 j# @5 f5 \! w: S# ]
. p1 y5 W+ ?9 t- |类比一下,就好比发现网卡驱动在对拷特定内存块的时候会和应用的线程执行出现串行导致效率降低,而绕开操作系统定义的与网卡驱动的接口,直接使用网卡支持的指令集进行了优化。 |
评分
-
查看全部评分
|