Trivance: Latency-Optimal AllReduce by Shortcutting Multiport NetworksTrivance:在多埠網路上抄捷徑,達到延遲最佳的 AllReduce
After reading, you can explain how Trivance uses both ports of a ring node to finish an all-reduce in ⌈log₃ n⌉ steps, and what it pays in link load and synchronization.讀完後,你能說明 Trivance 如何同時使用環上節點的兩個埠,以 ⌈log₃ n⌉ 步完成 all-reduce,以及它在鏈路負載與同步上付出的代價。
A ring node has two ports, so in one step it can learn from two new peers and its reach can triple: the lower bound for all-reduce is steps, not . Bruck's algorithm meets the bound but sends both messages the same way, so links carry three times the needed load. Recursive doubling and Swing need steps and use the second port only for a mirrored copy. In Trivance each node exchanges in step with the peers to its left and right, and reduces both inputs with its own partial result before it forwards. That takes about 37% fewer steps than , puts exactly chunks on every link, and keeps the minimal bytes in the bandwidth-optimal form. The evidence is a cost model plus simulation, so this page teaches the model.
環上的節點有兩個埠,一步之內可以從兩個新夥伴取得資料,涵蓋範圍可以變成三倍:all-reduce 的步數下限是 ,而不是 。Bruck 演算法達到這個下限,但兩則訊息都往同一方向走,鏈路負載是必要值的三倍。遞迴倍增與 Swing 需要 步,第二個埠只用來跑 mirrored 副本。在 Trivance 中,每個節點在第 步與左右各 遠的夥伴交換,並把兩個輸入與自己的部分結果一起歸約後再轉送。步數比 少約 37%,每條鏈路恰好承載 個 chunk,頻寬最佳的形式仍只送出最少的 位元組。證據是成本模型加上模擬,所以本頁教的是模型。
1. Where this paper sits1. 這篇論文的位置
The Chapter 4 charges once per dependent step (section 2). Its section 9.2 gives Trivance's step count for 4,096 ranks, 8 against 12 for recursive doubling, and Panel 4 in section 4 animates its peers on a ring. The Swing digest shows how distance becomes link sharing on a torus.
第 4 章對每個相依步驟收一次 (第 2 節)。它的第 9.2 節給出 Trivance 在 4,096 個 rank 上的步數,8 步對遞迴倍增的 12 步;第 4 節的面板 4 以動畫呈現它在環上的夥伴。Swing 導讀說明在環面上距離如何變成鏈路共用。
What was missing: every logarithmic all-reduce used one peer per step. A mirrored copy on the second port halves each message but keeps steps. Bruck (1994) showed that two ports allow steps for all-gather and all-to-all, and Chan et al. proved a lower bound of steps on a -dimensional torus with ports. No all-reduce reached the bound with an even load on all links.
缺少的是:每一種對數步數的 all-reduce 每步都只有一個夥伴。在第二個埠上跑 mirrored 副本能讓每則訊息減半,但步數仍是 。Bruck(1994)證明兩個埠能讓 all-gather 與 all-to-all 只要 步;Chan 等人證明,在每節點 個埠的 維環面上,步數下限是 。過去沒有任何 all-reduce 在所有鏈路負載均勻的情況下達到這個下限。
2. The problem: three ways to use two ports2. 問題:使用兩個埠的三種方式
The paper's Figure 1 (below) compares three schedules step by step: recursive doubling on an 8-node ring, and Bruck and Trivance on a 9-node ring. Arrows are messages; the label under each step is the largest number of messages that share one link.
論文的 Figure 1(下圖)逐步比較三種排程:8 節點環上的遞迴倍增,以及 9 節點環上的 Bruck 與 Trivance。箭頭是訊息;每一步下方的標示是共用同一條鏈路的訊息數最大值。

The table restates the figure (all values are counts from the schedules, not measurements):
下表重述這張圖(數值都是由排程數出來的,不是量測):
| Schedule (ring size)排程(環的大小) | Steps步數 | Use of the second port第二個埠的用法 | Link load鏈路負載 |
|---|---|---|---|
| Recursive doubling (8)遞迴倍增(8) | 3 | independent mirrored copy獨立的 mirrored 副本 | at most 1, 2, then 4 messages per link每條鏈路最多 1、2、4 則訊息 |
| Bruck (9)Bruck(9) | 2 | second message, same direction第二則訊息,同一方向 | at most 3, then 9; all traffic one way, reverse links idle最多 3、9 則;全部流量走同一方向,反向鏈路閒置 |
| Trivance (9)Trivance(9) | 2 | second peer, opposite direction第二個夥伴,反方向 | exactly 1, then 3, on every link每條鏈路恰好 1、3 則 |
The paper's motivation is cited, not measured: on large production systems more than 40% of MPI time goes to all-reduce and reduce, and TPU v4 builds 3D tori of up to 4,096 chips.
論文的動機是引用而非自己量測:在大型正式系統上,超過 40% 的 MPI 時間花在 all-reduce 與 reduce,而 TPU v4 以最多 4,096 顆晶片組成三維環面。
3. The design3. 設計
3.1 Two peers per step, reduced together3.1 每步兩個夥伴,一起歸約
In step , node of an -node ring talks to two peers at once:
在 個節點的環上,第 步節點 同時與兩個夥伴通訊:
It must receive and reduce both inputs, with its own partial result, before it sends in step . The paper calls this joint reduction. By Lemma 4.2, after step node holds the data of every node within distance
它必須收到兩個輸入,並與自己的部分結果一起歸約,才能在第 步送出。論文稱之為聯合歸約(joint reduction)。依 Lemma 4.2,第 步之後,節點 持有距離在下列範圍內所有節點的資料:
Why (Appendix A): the nodes between and its right peer split into two ranges of nodes, one known to and one known to the peer. Each exchange brings only new data, so the covered set triples each step (Figure 1). For the ring's diameter equals , so steps reach every node.
原因(附錄 A): 與右側夥伴之間的 個節點分成兩段,各 個,一段 已知,另一段夥伴已知。每次交換帶來的都是新資料,所以涵蓋的集合每步變三倍(圖 1)。當 ,環的直徑等於 ,所以 步就能到達每個節點。
The paper's Figure 3 (below) follows every node on a 9-node ring: node 0 gets nodes 1 and 8 in step 0, then 2, 3 and 4 through node 3, and 5, 6 and 7 through node 6.
論文的 Figure 3(下圖)追蹤 9 節點環上的每個節點:節點 0 在第 0 步得到節點 1 與 8 的資料,接著經由節點 3 得到 2、3、4,經由節點 6 得到 5、6、7。

3.2 Bandwidth-optimal form and the congestion bill3.2 頻寬最佳的形式與壅塞的帳單
The bandwidth-optimal form splits the vector into blocks and runs a reduce-scatter, then an all-gather. In step , node sends each peer the blocks for that peer and for every node the peer reaches later: blocks, or bytes, where . Lemma 4.1 sums both peers over one phase:
頻寬最佳的形式把向量切成 個區塊,先跑 reduce-scatter,再跑 all-gather。第 步,節點 送給每個夥伴的是該夥伴、以及該夥伴之後會到達的每個節點的區塊:共 個區塊,即 位元組,其中 。Lemma 4.1 把兩個夥伴在一個階段內的量加總:
So the two phases send the minimal bytes in steps. The cost model charges each step plus , with the chunks that share a link. Both peers sit hops away, so every link carries exactly chunks. The payload falls by 3 as the load rises by 3, so the byte factor (in units of ) is . Bruck's messages travel and hops the same way, so its links carry three times as many chunks. The paper's Table 1 (model values):
所以兩個階段以 步送出最少的 位元組。成本模型對每一步收 加上 , 是共用一條鏈路的 chunk 數。兩個夥伴都隔 跳,所以每條鏈路恰好承載 個 chunk。酬載除以 3、負載乘以 3,所以位元組因子 (以 為單位)是 。Bruck 的兩則訊息往同一方向走 與 跳,所以它的鏈路承載三倍的 chunk。論文的 Table 1(模型值):
| Ring, two ports環,兩個埠 | Steps (B)步數 (B) | (B) | Steps (L)步數 (L) | (L) |
|---|---|---|---|---|
| Ring環 | — | — | ||
| Recursive doubling遞迴倍增 | ||||
| Swing | ||||
| Bruck | ||||
| Trivance |
(B) is the bandwidth-optimal form; (L), the latency-optimal form, forwards the whole vector in every step. The (L) columns show the trade-off: Trivance saves steps but puts 1.5 times Swing's byte load on the busiest links, so the winner depends on against .
(B) 是頻寬最佳的形式;(L) 是延遲最佳的形式,每一步都轉送整個向量。(L) 欄呈現了取捨:Trivance 省下步數,但在最忙的鏈路上放了 Swing 1.5 倍的位元組負載,所以誰勝出取決於 與 的大小。
3.3 Sizes that are not a power of three3.3 不是 3 的冪的大小
For other , Trivance runs normal steps. In the last step both peers sit at distance , just enough to cover the missing nodes. A 32-node ring knows 27 nodes before its last step and needs 5 more, while an 81-node ring would need 54. The step count stays . Figure 2 shows the paper's Table 2.
對其他的 ,Trivance 先跑 個一般步驟。最後一步兩個夥伴的距離是 ,剛好補齊缺少的節點。32 節點的環在最後一步前已知 27 個節點,只需再補 5 個;81 節點的環則需要 54 個。步數仍是 。圖 2 呈現論文的 Table 2。
Against , the paper counts 25–57% more steps for Swing and recursive doubling at power-of-two sizes, up to 75% at other sizes, and 58.5% as grows ().
與 相比,論文算出:在 2 的冪的大小上,Swing 與遞迴倍增多出 25–57% 的步數,其他大小最多多出 75%, 變大時多出 58.5%()。
3.4 Multidimensional tori3.4 多維環面
On a torus, Trivance runs one collective per dimension, each on of the vector, mapped to distinct dimensions in every step; on a 9×9 torus the two collectives swap dimensions after each step. Messages get smaller and shorter. Table 3 gives the byte factor relative to the optimum ; for Trivance (B) it is (Figure 3).
在環面上,Trivance 每個維度跑一個集體操作,各處理向量的 ,每一步對應到不同的維度;在 9×9 環面上,兩個集體操作每一步都互換維度。訊息變小、距離變短。Table 3 給出相對最佳值 的位元組因子;Trivance (B) 是 (圖 3)。
Panel 1 evaluates the model of Tables 1 and 3 for every ring or torus size and vector size.
面板 1 依 Table 1 與 Table 3 的模型,計算每一種環或環面大小與向量大小。
4. Implementation4. 實作
The authors implemented Trivance and Bruck in SST, a packet-level simulator, and took bucket, recursive doubling and Swing from Swing's public code, with recursive doubling extended to all ports. For a fair baseline they improved Bruck: shortest-path routing, joint reductions, and a reversed all-gather after NCCL's PAT algorithm. There is no implementation in a production library.
作者在封包層級模擬器 SST 中實作了 Trivance 與 Bruck,bucket、遞迴倍增與 Swing 則取自 Swing 公開的程式碼,並把遞迴倍增擴充為使用所有的埠。為了公平比較,他們改良了 Bruck:最短路徑繞送、聯合歸約,以及仿照 NCCL PAT 演算法的反向 all-gather。沒有在正式函式庫中的實作。
Appendix D (not peer-reviewed) sketches one: a backend schedule like PAT emits one work item per rank, step and chunk, with both peers, and a per-chunk readiness entry with two bits lets the reduction run only when both receives are done (Figure 4). A library should pick Trivance only if each dimension has two independent paths.
附錄 D(未經同儕審查)勾勒了一種實作:後端排程像 PAT 一樣,為每個 rank、步驟與 chunk 產生一個帶有兩個夥伴的工作項目,而每個 chunk 的就緒項目有兩個位元,兩個接收都完成後才執行歸約(圖 4)。函式庫應該只在每一維都有兩條獨立路徑時才選用 Trivance。
5. What was evaluated5. 評估了什麼
The simulated network has 800 Gb/s links, 100 ns propagation, about 200 ns per hop, 8,192 B packets, a per-step latency , network interfaces per node with their own engines, credit-based flow control and shortest-path routing. The shapes are rings of 8 and 64 nodes, 2D tori 32×32, 8×64 and 27×27, and a 16×16×16 torus. Link rates range from 200 Gb/s to 3.2 Tb/s, and vectors from 32 B to 128 MiB. The baselines are bucket, recursive doubling, Swing and the improved Bruck, each in its better form. All of the paper's speedups and crossover sizes come from this simulation, so this page does not show them.
模擬的網路使用 800 Gb/s 鏈路、100 ns 傳播延遲、每跳約 200 ns、8,192 B 封包、每步延遲 ,每節點 個各有獨立引擎的網路介面,以及 credit-based 流量控制與最短路徑繞送。拓樸包括 8 與 64 節點的環、32×32、8×64、27×27 的二維環面,以及 16×16×16 的環面。鏈路速率從 200 Gb/s 到 3.2 Tb/s,向量從 32 B 到 128 MiB。比較基準是 bucket、遞迴倍增、Swing 與改良的 Bruck,各取較好的形式。論文所有的加速倍數與交叉點大小都來自這個模擬,所以本頁不列出。
The model alone gives crossovers. With Table 1, and 800 Gb/s (100 GB/s) on a 64-node ring, one row per switch (our computation):
只靠模型也能算出交叉點。用 Table 1、 與 800 Gb/s(100 GB/s),在 64 節點的環上,每列一個切換點(我們的計算):
| Switch (64-node ring, model)切換(64 節點的環,模型) | Calculation算式 | Result結果 |
|---|---|---|
| Trivance (L) → (B): 4 more steps, 32 → 2.52Trivance (L) → (B):多 4 步, 32 → 2.52 | KiB | |
| Trivance (B) → Swing (B): 4 more steps, 2.52 → 2Trivance (B) → Swing (B):多 4 步, 2.52 → 2 | MiB | |
| Swing (B) → ring: 114 more steps, 2 → 1Swing (B) → 環:多 114 步, 2 → 1 | MiB |
The simulator adds per-hop delay, packets and finite-size effects, so its crossovers differ from these.
模擬器另外包含每跳延遲、封包化與有限大小的效應,所以它的交叉點與這些值不同。
6. Limits and open questions6. 限制與未解的問題
The paper lists its limits (§7): simulation does not replace a library implementation; joint reduction needs stronger synchronization, and if one peer sends chunks in ascending order and the other in descending order, about half a message waits; Clos fabrics are future work; and using all ports at once could reach steps only with very specific sizes. A careful reader should add:
論文列出了自己的限制(§7):模擬無法取代函式庫中的實作;聯合歸約需要更強的同步,若一個夥伴以遞增順序送 chunk、另一個以遞減順序送,大約半個訊息要等待;Clos 網路是未來的工作;同時使用全部 個埠只有在非常特定的大小下才能達到 步。細心的讀者還應該補上:
- Power-of-two sizes are common. At 64 nodes the last step costs 70% of the 81-node case (Figure 2).2 的冪的大小很常見。64 個節點時,最後一步的成本是 81 節點情況的 70%(圖 2)。
- Endpoint model. Each simulated interface injects on its own, with no node-wide limit. A GPU whose two streams share one NIC or PCIe path would serialize them.端點模型。每個模擬的介面各自注入,沒有全節點的上限。若 GPU 的兩條資料流共用一張 NIC 或同一條 PCIe 路徑,就會被串行化。
- Reduction cost. The model leaves out , although each step reduces three operands. The paper notes that the reduced volume falls from about to .歸約成本。模型沒有包含 ,雖然每一步要歸約三個運算元。論文指出歸約的總量從約 降到 。
- No straggler test, although joint reduction is more sensitive to a late input than independent copies.沒有 straggler 測試,雖然聯合歸約比獨立的副本更怕輸入遲到。
7. How it connects7. 與其他內容的關聯
- Swing (NSDI 2024) is the direct predecessor: same simulator, same direct-connect setting, and the strongest baseline. Swing cuts distance; Trivance cuts steps.Swing(NSDI 2024)是直接的前作:相同的模擬器、相同的直連拓樸情境,也是最強的比較基準。Swing 削減距離;Trivance 削減步數。
- Deep dive: Panel 4 (section 4) animates Trivance's peers; section 9.2 gives its step table.第 4 章:面板 4(第 4 節)以動畫呈現 Trivance 的夥伴;第 9.2 節給出它的步數表。
- TPU v4 is the paper's target: 3D tori of up to 4,096 chips, where the 3D column of Table 3 applies.TPU v4 是論文的目標:最多 4,096 顆晶片的三維環面,正適用 Table 3 的 3D 欄。
- Theseus, in the same SIGCOMM session, hot-swaps schedules at run time; a Trivance schedule could be one entry in its menu.Theseus 與本文同屬 SIGCOMM 的同一場議程,能在執行期熱抽換排程;Trivance 的排程可以是它選單中的一項。
Key numbers關鍵數字
| Number | 數字 | Meaning (kind of value) | 意義(數值類型) |
|---|---|---|---|
| Steps of latency-optimal Trivance; the two-port lower bound (proof) | 延遲最佳 Trivance 的步數;兩埠的下限(證明) | ||
| ≈ 37% | Fewer steps than , as grows (analysis) | 變大時比 少的步數(分析) | |
| · 3× | Chunks per link in step ; Bruck's load relative to Trivance (analysis) | 第 步每鏈路的 chunk 數;Bruck 相對 Trivance 的負載(分析) | |
| vs | of latency-optimal Trivance vs Swing (Table 1, model) | 延遲最佳 Trivance 與 Swing 的 (Table 1,模型) | |
| 1.33 / 1.08 / 1.02 | of Trivance (B) on 2D / 3D / 4D tori (Table 3, model) | Trivance (B) 在 2D/3D/4D 環面的 (Table 3,模型) | |
| 11.1% · 70.4% | Last-step congestion of 32 and 64 nodes vs 81 (Table 2, model) | 32 與 64 節點最後一步相對 81 的壅塞(Table 2,模型) | |
| 800 Gb/s · 1.5 µs | Simulated link rate and per-step latency (setup) | 模擬的鏈路速率與每步延遲(設定) |
Terms used on this page本頁用到的術語
- Joint reduction
- Reducing both incoming messages of a step with the local partial result before forwarding.
- 在轉送前,把一步中收到的兩則訊息與本地部分結果一起歸約。
- Bruck's algorithm
- A two-port all-gather in steps, with peers at and in one direction.
- 兩個埠下以 步完成的 all-gather,夥伴在同一方向的 與 。
- Byte factor
- The sum over steps of bytes sent times chunks per link, relative to (ring) or (torus).
- 各步送出的位元組乘以每鏈路 chunk 數之和,相對於 (環)或 (環面)。
- (L) / (B) form
- Latency-optimal: the whole vector in every step. Bandwidth-optimal: reduce-scatter plus all-gather with the minimal bytes.
- 延遲最佳:每步送整個向量。頻寬最佳:reduce-scatter 加 all-gather,位元組最少。
- PAT
- NCCL's Bruck-derived all-gather and reduce-scatter.
- NCCL 由 Bruck 衍生的 all-gather 與 reduce-scatter。