←All research digests研究導讀總表
Research digest研究導讀
Research digest 10 of 16 · Chapter 4: Collective communication
研究導讀 10 / 16 · 第 4 章:集體通訊

Swing: Short-cutting Rings for Higher Bandwidth AllreduceSwing:抄捷徑繞過環,提升 allreduce 頻寬

After reading, you can explain why two all-reduce schedules with equal steps and bytes run at different speeds on a torus, and how Swing's alternating peers cut link sharing.讀完後,你能說明為什麼步數與位元組都相同的兩種 all-reduce 排程,在環面上速度不同,以及 Swing 左右交替的夥伴如何減少鏈路共用。

≈ 10 min · 1 interactive panel · 5-question quiz≈ 10 分鐘 · 1 個互動面板 · 5 題測驗Chapter 4 ↗第 4 章 ↗Jump to the quiz ↓跳到測驗 ↓
If you read nothing else
只讀這一段也可以

On a torus, a message to a peer dd hops away occupies dd links, so the messages of one collective share links. Recursive doubling and Rabenseifner's algorithm pair rank rr with r⊕2sr \oplus 2^s, so the distance doubles at every step and the late steps congest. Swing keeps their log⁡2p\log_2 p steps and minimal bytes, but uses the offsets ρ(s)=1,−1,3,−5,11,…\rho(s) = 1, -1, 3, -5, 11, \dots: even ranks add them and odd ranks subtract them, so peers are about two-thirds as far. Plain plus mirrored copies keep all 2D2D ports busy. The paper's congestion factor Ξ\Xi is about 1.19, 1.03 and 1.008 on 2D, 3D and 4D tori, against 1.5, 1.17 and 1.07 for Rabenseifner tuned for tori. The evidence is this model plus simulation, so this page teaches the model.

在環面(torus)上,送給 dd 跳外夥伴的訊息會佔用 dd 條鏈路,所以同一集體操作的訊息會共用鏈路。遞迴倍增與 Rabenseifner 演算法把 rank rr 與 r⊕2sr \oplus 2^s 配對,所以距離每步加倍,後面幾步造成壅塞。Swing 保留它們的 log⁡2p\log_2 p 步與最少位元組,但改用偏移 ρ(s)=1,−1,3,−5,11,…\rho(s) = 1, -1, 3, -5, 11, \dots:偶數 rank 加上、奇數 rank 減去,所以夥伴只有約三分之二遠。plain 加上 mirrored 副本讓全部 2D2D 個埠都在工作。論文的壅塞因子 Ξ\Xi 在 2D、3D、4D 環面上約為 1.19、1.03、1.008,針對環面調整的 Rabenseifner 則是 1.5、1.17、1.07。證據是這個模型加上模擬,所以本頁教的是模型。

1. Where this paper sits1. 這篇論文的位置

Section 4.3 builds the α\alpha–β\beta model: each dependent step costs α\alpha, each byte β=1/B\beta = 1/B. There, Rabenseifner's algorithm sends the ring's minimal bytes in only 2log⁡2N2\log_2 N steps, on one condition: every pair of ranks can talk at full rate at once. The primer's Rabenseifner section says why: the later partners sit far apart, so their messages cross more links and share them.

第 4.3 節建立了 α\alpha–β\beta 模型:每個相依步驟花 α\alpha,每個位元組花 β=1/B\beta = 1/B。在那裡,Rabenseifner 演算法只用 2log⁡2N2\log_2 N 步就送出環的最少位元組,條件是任兩個 rank 能同時以全速通訊。總覽的 Rabenseifner 一節說明原因:後面幾步的夥伴相距很遠,訊息要跨更多鏈路並彼此共用。

A torus breaks that condition, because a message to a distant rank uses other nodes' links. Before Swing, ring and bucket algorithms avoided shared links but needed 2(p−1)2(p-1) or about 2D p1/D2D\,p^{1/D} steps; recursive doubling needed log⁡2p\log_2 p steps over long distances; schedule synthesis can take up to 11 hours for 128 nodes (TACCL, cited). Swing changes only the choice of peer. Panel 4 of Chapter 4 (section 4) animates its peers.

環面打破了這個條件,因為送給遠方 rank 的訊息要借用其他節點的鏈路。在 Swing 之前,環與 bucket 演算法避開了共用鏈路,但需要 2(p−1)2(p-1) 步或約 2D p1/D2D\,p^{1/D} 步;遞迴倍增只要 log⁡2p\log_2 p 步,但距離很長;排程合成在 128 個節點上可能要算 11 小時(TACCL,論文引用)。Swing 只改變夥伴的選法。第 4.4 節的面板 4 以動畫呈現它的夥伴。

2. The problem: same steps, same bytes, different time2. 問題:步數相同、位元組相同,時間卻不同

The paper's Figure 1 (below) makes the point on a 16-node ring (a 1D torus) with shortest-path routing. Both algorithms run the bandwidth-optimal reduce-scatter, so in step ss each node sends n/2s+1n/2^{s+1} bytes of its nn-byte vector. In step 1, recursive doubling sends n/4n/4 to r⊕2r \oplus 2, two hops away, so two messages cross the links 1–2 and 5–6 in the same direction. Swing sends n/4n/4 to the other neighbor, one message per link. In step 2, four doubling messages share the link 3–4; Swing's busiest links carry two.

論文的 Figure 1(下圖)在 16 節點的環(一維環面)上、以最短路徑繞送說明這一點。兩種演算法都執行頻寬最佳的 reduce-scatter,所以第 ss 步每個節點送出 nn 位元組向量中的 n/2s+1n/2^{s+1}。第 1 步,遞迴倍增把 n/4n/4 送給兩跳外的 r⊕2r \oplus 2,所以兩則訊息同向穿過鏈路 1–2 與 5–6。Swing 把 n/4n/4 送給另一側的鄰居,每條鏈路一則訊息。第 2 步,遞迴倍增有四則訊息共用鏈路 3–4;Swing 最忙的鏈路只有兩則。

Two columns of ring diagrams for recursive doubling and Swing over three steps, with the most congested links marked in red.
Figure 1 of the paper: recursive doubling (left) and Swing (right) on a 16-node ring, steps 0–2 of the reduce-scatter (an algorithm schematic). Both send n/2, n/4 and n/8 bytes, but doubling's peers are 1, 2 and 4 hops away in the same direction, so its busiest link carries 2 and then 4 messages (red). Swing alternates direction and reaches the far side through the wrap-around link, so its busiest link carries 1 and then 2.論文圖 1:在 16 節點的環上,遞迴倍增(左)與 Swing(右)執行 reduce-scatter 的第 0–2 步(演算法示意圖)。兩者都送 n/2、n/4、n/8 位元組,但遞迴倍增的夥伴往同一方向相隔 1、2、4 跳,所以它最忙的鏈路依序承載 2 則與 4 則訊息(紅色)。Swing 交替方向並經由環的回繞鏈路到達另一側,所以最忙的鏈路只承載 1 則與 2 則。De Sensi et al., NSDI 2024, Figure 1 (USENIX PDF, re-rendered).

A step lasts as long as its busiest link needs: the payload times the messages that share the link. In units of nβn\beta, the time to send the whole vector over one link:

一步的時間取決於最忙的鏈路:酬載乘以共用該鏈路的訊息數。以 nβn\beta(整個向量走一條鏈路的時間)為單位:

Step (16-node ring, Figure 1 of the paper)步驟(16 節點的環,論文 Figure 1)Calculation算式Result結果
Step 0, both: payload n/2n/2, one message per link第 0 步,兩者:酬載 n/2n/2,每鏈路一則12×1\tfrac12 \times 10.50.5
Step 1: recursive doubling (2 per link) / Swing (1)第 1 步:遞迴倍增(每鏈路 2 則)/Swing(1 則)14×2 / 14×1\tfrac14 \times 2\ /\ \tfrac14 \times 10.5 / 0.250.5\ /\ 0.25
Step 2: recursive doubling (4 per link) / Swing (2)第 2 步:遞迴倍增(每鏈路 4 則)/Swing(2 則)18×4 / 18×2\tfrac18 \times 4\ /\ \tfrac18 \times 20.5 / 0.250.5\ /\ 0.25
Three steps: recursive doubling / Swing三步合計:遞迴倍增/Swing(0.5+0.5+0.5) / (0.5+0.25+0.25)(0.5 + 0.5 + 0.5)\ /\ (0.5 + 0.25 + 0.25)1.5 / 1.01.5\ /\ 1.0doubling takes 1.5× as long遞迴倍增要 1.5 倍時間

Both send 78n\tfrac78 n bytes in three steps, yet doubling takes 1.5 times as long, and the α\alpha–β\beta model has no term for this. The paper's motivation is cited, not measured: all-reduce takes up to 40% of training time in other studies, and tori connect ML systems such as TPU v5p pods.

兩者在三步中都送出 78n\tfrac78 n 位元組,遞迴倍增卻要 1.5 倍時間,而 α\alpha–β\beta 模型沒有描述這件事的項。論文的動機是引用而非自己量測:其他研究指出 all-reduce 最多佔訓練時間的 40%,而環面也連接著 TPU v5p pod 這類 ML 系統。

3. The design3. 設計

3.1 Peers that swing left and right3.1 左右擺盪的夥伴

In step ss (counted from 0), node rr of a pp-node ring exchanges with

在 pp 個節點的環上,第 ss 步(從 0 起算)節點 rr 與下列節點交換:

π(r,s)={r+ρ(s) mod pr≡0(mod2)r−ρ(s) mod pr≡1(mod2) \pi(r,s) = \begin{cases} r + \rho(s) \bmod p & r \equiv 0 \pmod 2 \\ r - \rho(s) \bmod p & r \equiv 1 \pmod 2 \end{cases}
ρ(s)=∑i=0s(−2)i=1−(−2)s+13 \rho(s) = \sum_{i=0}^{s} (-2)^i = \frac{1-(-2)^{s+1}}{3}

So ρ(s)\rho(s) runs 1,−1,3,−5,11,…1, -1, 3, -5, 11, \dots: even ranks add it and odd ranks subtract it, so the two members of a pair name each other. The hop distance is

所以 ρ(s)\rho(s) 依序是 1,−1,3,−5,11,…1, -1, 3, -5, 11, \dots:偶數 rank 加上它、奇數 rank 減去它,所以一對節點會互相指向對方。跳數距離是

δ(s)=∣ρ(s)∣=2s+1−(−1)s+13≤2s \delta(s) = |\rho(s)| = \frac{2^{s+1} - (-1)^{s+1}}{3} \le 2^s

It is strictly below doubling's 2s2^s for s>1s \gt 1, and the ratio approaches 2/32/3. Diagram A draws the peers for six steps: Swing reaches far nodes by a shortcut across the ring instead of walking one way.

當 s>1s \gt 1 時它嚴格小於遞迴倍增的 2s2^s,比值趨近 2/32/3。示意圖 A 畫出六步的夥伴:Swing 從環的兩側抄捷徑抵達遠處的節點,而不是一路往同一邊走。

Swing: r ± ρ(s)XOR: r ⊕ 2ˢs = 0+1+1s = 1−1+2s = 2+3+4s = 3−5+8s = 4+11+16s = 5−21+32r
Diagram A. The peer of an even rank rr in steps 0–5, one row per step, with its offset. Orange: Swing's peer alternates sides. Blue: recursive doubling's partner r⊕2sr \oplus 2^s (shown for r=0r = 0) always lies on the same side, twice as far each step.示意圖 A。偶數 rank rr 在第 0–5 步的夥伴與偏移,每步一列。橘色:Swing 的夥伴在兩側交替。藍色:遞迴倍增的夥伴 r⊕2sr \oplus 2^s(以 r=0r = 0 為例)永遠在同一側,每步遠一倍。Drawn for this primer from Eq. 2 and §3.1.1 of De Sensi et al., NSDI 2024.

Appendix A proves that no block is reduced twice: a node reached through several steps sits at a sum of distinct powers of −2-2, and no number has two such representations.

附錄 A 證明沒有區塊會被歸約兩次:經由多步到達的節點位於一組相異的 −2-2 次方之和,而沒有任何數有兩種這樣的表示法。

3.2 Halve the data, then double it back3.2 先把資料減半,再加倍送回

The bandwidth-optimal form is a reduce-scatter, then an all-gather. Each node splits its vector into pp blocks. In step ss, node rr sends its peer qq the block that qq will own, plus every block that qq forwards later (the paper's Listing 1 finds this set recursively), so the payload halves at every step. The all-gather replays the peers in reverse order, farthest first. That is 2log⁡2p2\log_2 p steps (Λ=2\Lambda = 2) and the minimal 2n2n bytes (Ψ=1\Psi = 1). The latency-optimal form exchanges the whole vector in every step: log⁡2p\log_2 p steps and nlog⁡2pn\log_2 p bytes. For an even pp that is not a power of two, nodes never send a block twice, at no extra cost. For an odd pp, p−1p-1 nodes run Swing and the last node trades blocks directly, which adds 1/p1/p to Ψ\Psi. The paper's Figure 3 shows p=7p = 7.

頻寬最佳的形式先跑 reduce-scatter,再跑 all-gather。每個節點把向量切成 pp 個區塊。第 ss 步,節點 rr 送給夥伴 qq 的是 qq 將負責的區塊,加上 qq 之後要轉交的所有區塊(論文的 Listing 1 以遞迴找出這個集合),所以酬載每步減半。all-gather 以相反順序重走這些夥伴,最遠的先走。合計 2log⁡2p2\log_2 p 步(Λ=2\Lambda = 2),位元組為最少的 2n2n(Ψ=1\Psi = 1)。延遲最佳的形式每步交換整個向量:log⁡2p\log_2 p 步、nlog⁡2pn\log_2 p 位元組。若 pp 是偶數但不是 2 的冪,節點從不重複送同一區塊,不增加成本。若 pp 是奇數,由 p−1p-1 個節點跑 Swing,最後一個節點直接交換區塊,讓 Ψ\Psi 增加 1/p1/p。論文的 Figure 3 呈現 p=7p = 7 的情形。

Figure 3 of the Swing paper: the first two steps of Swing on a ring of 7 nodes, with node 6 sending n/7-byte blocks directly to nodes 0, 1, 2 and then 3, 4
Figure 3 of the paper: Swing on a 7-node ring, steps 0 and 1 (an algorithm diagram). Nodes 0–5 swing direction between the steps; node 6 sends n/7n/7-byte blocks straight to the others.論文的 Figure 3:Swing 在 7 節點環上的第 0 與第 1 步(演算法示意圖)。節點 0–5 在兩步之間改變方向;節點 6 把 n/7n/7 位元組的區塊直接送給其他節點。Screenshot of De Sensi et al., NSDI 2024, Figure 3 (p. 1450).

3.3 All ports, every dimension3.3 所有的埠、每一個維度

On a DD-dimensional torus, step ss uses dimension s mod Ds \bmod D and applies the ring rule to that coordinate, at in-dimension step ⌊s/D⌋\lfloor s/D \rfloor. To fill all 2D2D ports, Swing splits the vector into 2D2D parts. The DD plain collectives start in different dimensions, and the DD mirrored ones use the opposite sign. The paper's Figure 4 shows step 0 on a 4×4 torus: node 0 exchanges with nodes 1 and 4 (plain) and with 3 and 12 (mirrored).

在 DD 維環面上,第 ss 步使用第 s mod Ds \bmod D 維,並在該維座標上套用環的規則,維內步數為 ⌊s/D⌋\lfloor s/D \rfloor。為了用滿 2D2D 個埠,Swing 把向量切成 2D2D 份。DD 個 plain 集體操作從不同維度開始,DD 個 mirrored 集體操作使用相反的正負號。論文的 Figure 4 呈現 4×4 環面的第 0 步:節點 0 與節點 1、4 交換(plain),並與 3、12 交換(mirrored)。

Figure 4 of the Swing paper: the first step of Swing on a 4 by 4 torus, plain collectives on the left and mirrored collectives with wrap-around arrows on the right
Figure 4 of the paper: step 0 of Swing on a 4×4 torus (an algorithm diagram). Left: the two plain collectives. Right: the two mirrored ones, which go the opposite way.論文的 Figure 4:Swing 在 4×4 環面上的第 0 步(演算法示意圖)。左:兩個 plain 集體操作。右:兩個方向相反的 mirrored 集體操作。Screenshot of De Sensi et al., NSDI 2024, Figure 4 (p. 1451).

In the next step each collective moves to its other dimension, so the four again use four different ports (Diagram B). So Ψ=1\Psi = 1, and the step count does not change.

下一步每個集體操作換到另一個維度,所以四個集體操作仍使用四個不同的埠(示意圖 B)。所以 Ψ=1\Psi = 1,步數不變。

step 0第 0 步0123456789101112131415step 1第 1 步0123456789101112131415plain, starts horizontalplain,從水平維度開始plain, starts verticalplain,從垂直維度開始mirrored, starts horizontalmirrored,從水平維度開始mirrored, starts verticalmirrored,從垂直維度開始
step 0第 0 步0123456789101112131415step 1第 1 步0123456789101112131415plain, starts horizontalplain,從水平維度開始plain, starts verticalplain,從垂直維度開始mirrored, starts horizontalmirrored,從水平維度開始mirrored, starts verticalmirrored,從垂直維度開始
Diagram B. Node 0 of a 4×4 torus in the first two steps; each color is one of four concurrent collectives. Arrows that run around the outside of the grid travel over a wrap-around link. In each step the four collectives use the four ports once each.示意圖 B。4×4 環面的節點 0 在前兩步的情形;每種顏色是四個並行集體操作之一。繞到格子外側的箭頭走的是環繞鏈路。每一步四個集體操作各用一次四個埠。Drawn for this primer from §4.1 and Figure 4 of De Sensi et al., NSDI 2024.

Rectangular tori cost more. After Dlog⁡2dmin⁡D\log_2 d_{\min} steps the shortest dimension is done, and only two ports carry data. The paper's Eq. 3 approximates the extra congestion as

長方形環面成本較高。經過 Dlog⁡2dmin⁡D\log_2 d_{\min} 步後最短的維度就做完了,之後只有兩個埠載資料。論文的 Eq. 3 把額外的壅塞近似為

ΞQ≈log⁡2(dmax⁡/dmin⁡)6 dmin⁡D−1 \Xi_Q \approx \frac{\log_2 (d_{\max}/d_{\min})}{6\, d_{\min}^{D-1}}

For 1,024 nodes that is about 0.021 for 64×16, 0.083 for 128×8 and 0.25 for 256×4 (our evaluation). The paper's Figure 5 shows a 2×4 torus whose last step uses only the horizontal dimension.

對 1,024 個節點,64×16 約 0.021、128×8 約 0.083、256×4 約 0.25(我們代入計算)。論文的 Figure 5 呈現一個 2×4 環面,它的最後一步只用水平維度。

3.4 The congestion factor Ξ\Xi3.4 壅塞因子 Ξ\Xi

The paper writes the all-reduce time on a torus with pp nodes and 2D2D ports per node as

論文把 pp 個節點、每節點 2D2D 個埠的環面上 all-reduce 的時間寫成

T(n)=log⁡2p⋅α⋅Λ  +  nD β⋅Ψ⋅Ξ T(n) = \log_2 p \cdot \alpha \cdot \Lambda \;+\; \frac{n}{D}\,\beta \cdot \Psi \cdot \Xi

Here αlog⁡2p\alpha\log_2 p and (n/D)β(n/D)\beta are the optimum. Λ\Lambda counts extra steps, Ψ\Psi extra bytes or idle ports, and the congestion deficiency Ξ\Xi the slowdown from shared links; only Ξ\Xi depends on the network. In bandwidth-optimal Swing, step ss sends n/(2D⋅2s+1)n/(2D \cdot 2^{s+1}) bytes per port over δ(⌊s/D⌋)\delta(\lfloor s/D \rfloor) hops, so with both phases

其中 αlog⁡2p\alpha\log_2 p 與 (n/D)β(n/D)\beta 是最佳值。Λ\Lambda 計入多出的步數,Ψ\Psi 計入多出的位元組或閒置的埠,壅塞因子(congestion deficiency)Ξ\Xi 則是共用鏈路造成的減速;只有 Ξ\Xi 取決於網路。在頻寬最佳的 Swing 中,第 ss 步每個埠送出 n/(2D⋅2s+1)n/(2D \cdot 2^{s+1}) 位元組、走 δ(⌊s/D⌋)\delta(\lfloor s/D \rfloor) 跳,所以兩個階段合計

Ξ=∑s=0log⁡2p−1δ(⌊s/D⌋)2s+1 \Xi = \sum_{s=0}^{\log_2 p - 1} \frac{\delta(\lfloor s/D \rfloor)}{2^{s+1}}

The payload halves at every step, so the long steps carry little data, and the first 2D2D steps are one hop each. More dimensions therefore put more bytes on one-hop steps (Diagram C).

酬載每步減半,所以長距離的步驟只載很少資料,而前 2D2D 步每步只走一跳。所以維度越多,走一跳的位元組就越多(示意圖 C)。

00.511.5congestion factor Ξ壅塞因子 ΞSwing64×641.184Swing16×16×161.034Swing8×8×8×81.007Rabenseifner64×641.477Rabenseifner16×16×161.162Rabenseifner8×8×8×81.069optimum = 1最佳值 = 1one-hop steps一跳的步驟longer steps較長的步驟
Diagram C. Ξ\Xi for 4,096 nodes, from the sum above. Green bars are one-hop steps and orange bars are longer steps, while the grey vertical line marks the optimum, 1. Rabenseifner is the torus-optimized form, with distance 2⌊s/D⌋2^{\lfloor s/D \rfloor}. For large pp the sums approach Table 2's values.示意圖 C。依上式算出 4,096 個節點的 Ξ\Xi。綠色是一跳的步驟,橘色是較長的步驟,灰色直線標出最佳值 1。Rabenseifner 是針對環面最佳化、距離為 2⌊s/D⌋2^{\lfloor s/D \rfloor} 的版本。pp 很大時這些和趨近 Table 2 的數值。Computed and drawn for this primer from §4.1 and Table 2 of De Sensi et al., NSDI 2024 (model values).

The paper's Table 2, bandwidth-optimal rows (model values):

論文 Table 2 的頻寬最佳各列(模型值):

Algorithm演算法Λ\LambdaΨ\PsiΞ\Xi on 2D / 3D / 4DΞ\Xi:2D / 3D / 4D
Hamiltonian rings (2D only)Hamiltonian 環(只限 2D)2p/log⁡2p2p/\log_2 p11
Bucket2D p1/D/log⁡2p2D\,p^{1/D}/\log_2 p11
Rabenseifner, torus-optimized (one port)Rabenseifner,環面最佳化(單一埠)22D2D1.5 / 1.17 / 1.07
Swing, bandwidth-optimalSwing,頻寬最佳211.19 / 1.03 / 1.008

For very large vectors only the byte term matters. On a 64×64 torus (Ξ=1.184\Xi = 1.184) the model therefore caps Swing at 1/Ξ≈84%1/\Xi \approx 84\% of peak goodput (our computation). Bucket has Ξ=1\Xi = 1 but about 2D p1/D2D\,p^{1/D} steps, so it wins only for large vectors. Panel 1 evaluates the whole model.

向量非常大時只剩位元組項重要。所以在 64×64 環面上(Ξ=1.184\Xi = 1.184),模型把 Swing 的上限定在峰值有效吞吐的 1/Ξ≈84%1/\Xi \approx 84\%(我們的計算)。bucket 的 Ξ=1\Xi = 1,但約有 2D p1/D2D\,p^{1/D} 步,所以只在向量很大時勝出。面板 1 計算整個模型。

Panel 1面板 1

All-reduce goodput by Swing's cost model依 Swing 成本模型算出的 all-reduce 有效吞吐

Nodes pp
節點數 pp
Swing (B): Ξ\Xi and ceiling
Swing (B):Ξ\Xi 與上限
Fastest at this nn
此 nn 下最快
Swing (L) → (B) at
Swing (L) → (B) 的切換點
Bucket or ring passes Swing (B) at
Bucket 或環超越 Swing (B) 於

Model values only; the paper's simulated results are not shown. Each curve is the goodput n/Tn/T with T=Kα+∑kβ mkckT = K\alpha + \sum_k \beta\, m_k c_k, summed step by step with the paper's peers, payloads and ports: KK steps, mkm_k bytes per port in step kk, and ckc_k the peer distance in hops, which the paper takes as the number of messages on the busiest link. For the bandwidth-optimal rows (B) this is Eq. 1 with Table 2's factors. The latency-optimal rows (L) send the whole vector over one port in every step. Ring means Hamiltonian rings (2D only). Dashed line: peak goodput, DD × link rate. Defaults: the paper's 64×64 torus with 400 Gb/s links. The paper states no per-step α\alpha; 1.5 µs is the value that the Trivance paper uses when it reruns Swing's simulator. Try 3D: the Swing (B) ceiling rises to about 97%. Raise the link rate: every crossover moves to larger vectors, because one α\alpha is then worth more bytes.

只有模型值;不顯示論文的模擬結果。每條曲線是有效吞吐 n/Tn/T,其中 T=Kα+∑kβ mkckT = K\alpha + \sum_k \beta\, m_k c_k,用論文的夥伴、酬載與埠逐步加總:KK 是步數,mkm_k 是第 kk 步每個埠的位元組數,ckc_k 是夥伴的跳數距離,論文把它當成最忙鏈路上的訊息數。頻寬最佳的各列(B)就是 Eq. 1 配上 Table 2 的因子。延遲最佳的各列(L)每步都經由單一埠送出整個向量。「環」指 Hamiltonian 環(只限 2D)。虛線:峰值有效吞吐,即 DD × 鏈路速率。預設值:論文的 64×64 環面、400 Gb/s 鏈路。論文沒有給每步的 α\alpha;1.5 µs 是 Trivance 論文重跑 Swing 模擬器時使用的值。試試 3D:Swing (B) 的上限升到約 97%。提高鏈路速率:每個交叉點都移向更大的向量,因為一個 α\alpha 這時相當於更多位元組。

4. Implementation4. 實作

The authors implemented every algorithm in the Structural Simulation Toolkit (SST), a packet-level network simulator: Hamiltonian rings, bucket, both forms of recursive doubling, a mirrored recursive doubling that uses all ports, and both forms of Swing. The paper has no MPI or NCCL implementation and no hardware run. Its SST code is public, and the Trivance paper reuses it.

作者在 Structural Simulation Toolkit(SST,封包層級的網路模擬器)中實作了每一種演算法:Hamiltonian 環、bucket、兩種形式的遞迴倍增、使用所有埠的 mirrored 遞迴倍增,以及兩種形式的 Swing。論文沒有 MPI 或 NCCL 的實作,也沒有在硬體上執行。它的 SST 程式碼是公開的,Trivance 論文就重用了它。

5. What was evaluated5. 評估了什麼

The simulated network has 400 Gb/s links, 100 ns link latency, 300 ns of processing per hop and minimal adaptive routing. The shapes are square 2D tori from 64 to 16,384 nodes, three 1,024-node rectangles (64×16, 128×8, 256×4), 3D and 4D tori, two HammingMesh variants and a HyperX, with link rates from 100 Gb/s to 3.2 Tb/s and vectors from 32 B to 512 MiB or 2 GiB. The baselines are Hamiltonian rings, bucket and recursive doubling. The metric is goodput, vector bytes reduced per second, with a peak of DD × 400 Gb/s. All of the paper's speedups and crossover sizes come from this simulation, so this page does not show them. The analysis alone gives three results:

模擬的網路使用 400 Gb/s 鏈路、100 ns 鏈路延遲、每跳 300 ns 的處理時間與最小自適應繞送。拓樸包括 64 到 16,384 個節點的正方形二維環面、三種 1,024 節點的長方形(64×16、128×8、256×4)、3D 與 4D 環面、兩種 HammingMesh 與一個 HyperX;鏈路速率從 100 Gb/s 到 3.2 Tb/s,向量從 32 B 到 512 MiB 或 2 GiB。比較基準是 Hamiltonian 環、bucket 與遞迴倍增。指標是有效吞吐(goodput),即每秒歸約的向量位元組數,峰值為 DD × 400 Gb/s。論文所有的加速倍數與交叉點大小都來自這個模擬,所以本頁不列出。只靠分析就能得到三個結果:

  • HyperX links each node to its whole row and column. Swing talks only within a row or column, so every peer is one hop away and Ξ=1\Xi = 1.HyperX 讓每個節點連到整列與整行。Swing 只在同列或同行內通訊,所以每個夥伴都只隔一跳,Ξ=1\Xi = 1。
  • On a non-blocking fat tree neither Swing nor recursive doubling has a congestion term, so the paper expects equal performance.在非阻塞 fat tree 上,Swing 與遞迴倍增都沒有壅塞項,所以論文預期兩者表現相同。
  • Mirrored recursive doubling uses all ports like Swing, but its distances stay 2s2^s, so its Ξ\Xi stays higher.Mirrored 遞迴倍增像 Swing 一樣使用所有的埠,但距離仍是 2s2^s,所以 Ξ\Xi 仍然較高。

6. Limits and open questions6. 限制與未解的問題

The paper says that bucket and ring stay better for very large vectors on 2D and elongated tori, that only minimal adaptive routing was tested, and that the model leaves out the reduction cost γ\gamma and the latency that distance adds. A careful reader should add:

論文指出:在二維與細長的環面上,向量非常大時 bucket 與環仍然較好;只測試了最小自適應繞送;模型沒有包含歸約成本 γ\gamma,也沒有包含距離帶來的延遲。細心的讀者還應該補上:

  • No real implementation. There is no MPI or NCCL code and no GPU kernel, although in practice α\alpha is mostly software and kernel launches.沒有真正的實作。沒有 MPI 或 NCCL 程式碼,也沒有 GPU kernel,而實務上 α\alpha 主要來自軟體與 kernel 啟動。
  • Whole slices. The job must own a whole torus with ranks in order: true for a full TPU slice, not for a fragmented allocation.完整的切片。任務必須擁有整個環面且 rank 依序排列:完整的 TPU 切片成立,零碎的配置則不成立。
  • Clos fabrics. On the Clos and rail fabrics of most GPU clusters, any two GPUs are a few switch hops apart, so distance is a weak lever.Clos 網路。多數 GPU 叢集使用 Clos 或 rail 網路,任兩顆 GPU 只隔幾跳交換器,所以距離這個槓桿很弱。
  • Two normalizations. The Trivance paper re-derives these factors relative to mβ/Dm\beta/D; read each paper's table in its own model.兩套正規化。Trivance 論文以 mβ/Dm\beta/D 為基準重新推導這些因子;每篇論文的表都要在它自己的模型中解讀。

7. How it connects7. 與其他內容的關聯

  • Deep dive: Swing adds link sharing to the α\alpha–β\beta model of section 2; Panel 4 (section 4) animates its peers; section 9.2 compares it with Trivance.第 4 章:Swing 在第 2 節的 α\alpha–β\beta 模型中加入鏈路共用;面板 4(第 4 節)以動畫呈現它的夥伴;第 9.2 節把它與 Trivance 比較。
  • Trivance (SIGCOMM 2026) is the sequel: it reuses Swing's simulator, sends in both directions in every step and needs only ⌈log⁡3n⌉\lceil \log_3 n \rceil steps.Trivance(SIGCOMM 2026)是續作:它重用 Swing 的模擬器,每一步同時往兩個方向送,只需要 ⌈log⁡3n⌉\lceil \log_3 n \rceil 步。
  • TPU v4 builds 3D tori of up to 4,096 chips, the shape class of Table 2's 3D column. Rail-only and Alibaba HPN are Clos designs, where Swing's lever is weak.TPU v4 以最多 4,096 顆晶片組成三維環面,正是 Table 2 中 3D 欄的形狀。Rail-only 與 Alibaba HPN 是 Clos 設計,Swing 在那裡的槓桿很弱。
  • Theseus swaps schedules while a job runs; Swing could be one more schedule in its menu.Theseus 在任務執行中更換排程;Swing 可以是它選單中多一個排程。

Key numbers關鍵數字

Number數字Meaning (kind of value)意義(數值類型)
1, −1, 3, −5, 11Swing offsets ρ(s)\rho(s), steps 0–4 (formula)Swing 第 0–4 步的偏移 ρ(s)\rho(s)(公式)
≈ 2/3Late peer distance relative to doubling's 2s2^s (analysis)後段夥伴距離相對倍增 2s2^s 的比例(分析)
1.19 / 1.03 / 1.008Ξ\Xi of Swing on 2D / 3D / 4D tori (Table 2, model)Swing 在 2D/3D/4D 環面的 Ξ\Xi(Table 2,模型)
1.5 / 1.17 / 1.07Ξ\Xi of torus-optimized Rabenseifner (Table 2, model)環面最佳化 Rabenseifner 的 Ξ\Xi(Table 2,模型)
1.184 → 84%Ξ\Xi on 64×64 and the goodput ceiling 1/Ξ1/\Xi (our computation)64×64 的 Ξ\Xi 與有效吞吐上限 1/Ξ1/\Xi(我們的計算)
400 Gb/s · 300 nsSimulated link rate and per-hop processing (setup)模擬的鏈路速率與每跳處理時間(設定)

Terms used on this page本頁用到的術語

Congestion deficiency Ξ\Xi
How much the byte term grows because messages of one collective share the busiest link.
同一集體操作的訊息共用最忙鏈路,使位元組項變大的倍數。
Λ\Lambda, Ψ\Psi
Steps relative to log⁡2p\log_2 p; bytes or idle ports relative to 2n2n over 2D2D ports.
步數相對 log⁡2p\log_2 p 的倍數;位元組或閒置埠相對於 2D2D 個埠送 2n2n 的倍數。
Plain / mirrored collective
Swing's 2D2D concurrent sub-all-reduces, which use a different port in every step.
Swing 同時執行的 2D2D 個子 all-reduce,每一步各用不同的埠。
Bucket algorithm
Ring reduce-scatter and all-gather along each dimension in turn.
沿各維度輪流做環形 reduce-scatter 與 all-gather。
Goodput
Vector bytes reduced per second; its all-reduce peak is DD × link rate.
每秒歸約的向量位元組數;all-reduce 的峰值是 DD × 鏈路速率。

Check your understanding檢驗你的理解