Worked examples — NVLink and GPU interconnects
6.3.4 · D3· Hardware › Interconnects, Buses & SoC › NVLink and GPU interconnects
Yeh page ek drill hall hai. Parent note ne theory build ki; yahan hum har tarah ke NVLink arithmetic question ko hammer karte hain, ek worked example har case ke liye. Har solution se pehle main aapko Forecast karne ko kehta hoon — pehle guess karna hi woh tarika hai jisse number yaad rehta hai.
Scenario matrix
| Cell | Case class | Tricky kyun hai | Example |
|---|---|---|---|
| A | 8b/10b payload from line rate | multiply karna hoga | Ex 1 |
| B | PAM4 + 128b/130b payload | 2 bits/symbol AUR naya encoding ratio | Ex 2 |
| C | Raw vs payload (datasheet twist) | headline number ≠ usable number | Ex 3 |
| D | Direction bookkeeping (uni vs bidir) | factor-of-2 trap | Ex 4 |
| E | Aggregate over many links | per-link ko link count se multiply karo | Ex 5 |
| F | Saturated link (buffer ≥ BDP) | efficiency = 100% | Ex 6 |
| G | Degenerate: buffer too small (< BDP) | stall, efficiency < 100% | Ex 7 |
| H | Limiting case: zero latency / infinite buffer | boundary sanity check | Ex 8 |
| I | Real-world all-reduce word problem | ring algorithm, many peers | Ex 9 |
| J | Exam twist: NVLink vs PCIe crossover | NVLink kab worth it NAHI hai? | Ex 10 |
Har cell neeche fill ki gayi hai. Chalte hain.
Ek aisa tool banana jo hum har jagah reuse karein
Lagbhag har example mein same conversion chain use hoti hai, toh ise ek baar define karo, plain words mein, koi bhi symbol aane se pehle.
Neeche di gayi figure ko ek pipe ki tarah padho jo har stage par narrow hoti jaati hai. Baayi taraf wide mouth se shuru karo — raw GT/s ke symbols. Pipe apni width "×1 bit/symbol" stage se le jaati hai (on/off signaling kuch add nahi karta). Orange "×8/10" stage par pipe narrow hoti hai: width ka ek panchwa hissa encoding overhead ko jaata hai, aur hum 128 Gb/s par aa jaate hain. Aakhir mein green "÷8" stage phir narrow karti hai bits ko bytes mein convert karne ke liye, 16 GB/s spout par khatam hoti hai. Visual point: har stage flow ko sirf shrink kar sakti hai, kabhi grow nahi — isliye aapka final payload hamesha chain mein sabse chhota number hoga, aur koi stage bhool jaane ka matlab hai over-reporting.

Cell A — 8b/10b payload
- Bits per lane per second . Yeh step kyun? Raw symbols ko real payload bits mein convert karta hai encoding tax pehle pay karke.
- Saare 8 lanes . Yeh step kyun? Lanes parallel mein run karti hain, toh unke payloads simply add ho jaate hain.
- Gigabits → gigabytes: . Yeh step kyun? Ek byte 8 bits hota hai; datasheets GB/s mein bolte hain.
Verify: Master formula mein plug karo: . ✓ Units: . ✓ Parent table row NVLink 1.0 se match karta hai.
Cell B — PAM4 + 128b/130b
Example se pehle, yahan raw parent-note figures reproduce ki gayi hain taaki aapko context-switch na karna pade:
- Bits/lane/s . Yeh step kyun? Ek saath do cheezein change hui hain — bits/symbol AUR encoding ratio — toh dono yahan enter hoti hain.
- 9 lanes: . Yeh step kyun? Parallel lanes add hoti hain; note karo odd lane count (9, 8 nahi).
- Gigabits → gigabytes: . Yeh step kyun? Exactly Ex 1 ki tarah — ek byte 8 bits hota hai, toh bit-rate ko 8 se divide karo bytes report karne ke liye. Result GB/s mein hai, Gb/s mein nahi.
- Parent ke 46.5 se reconcile karo: parent ka datasheet-consistent figure GB/s/dir hai. Pure master-formula number 58.8 GB/s hai; real silicon mein extra framing/protocol overhead hota hai jo marketing payload fold in karti hai. Is drill ke liye hum formula value 58.8 GB/s report karte hain aur flag karte hain ki datasheet-consistent NVLink 4.0 near 46.5 quoted hai.
Verify: GB/s (formula). ✓ aur bits/symbol hi Ex 1 se single structural differences hain. 46.5 se gap protocol overhead hai encoding se pare — mistake box dekho.
Cell C — raw line rate vs payload (datasheet twist)
- 25 decode karo: per lane raw symbols ka. 8 lanes par: raw. Yeh step kyun? Dikhata hai ki "25" symbols-as-bytes hai, encoding haircut se pehle.
- 8b/10b apply karo: payload. Yeh step kyun? Transmitted bits ka sirf aapka data hai.
Verify: GB/s. ✓ 25 pre-encoding line rate hai; 20 woh hai jis par aapka data actually move karta hai. Timing calculations se pehle hamesha convert karo.
Cell D — direction bookkeeping
- Full duplex matlab simultaneous hai: send-lanes aur receive-lanes physically alag hain, toh directions bandwidth share nahi karti. Yeh step kyun? Isliye aap inhein add kar sakte ho; half-duplex bus par aap nahi kar sakte.
- Add karo: bidirectional.
Verify: GB/s. ✓ Parent table "Bidir/link = 40 GB/s" NVLink 2.0 ke liye match karta hai. Trap: 40 GB/s kabhi one-way transfer time karne ke liye mat use karo — ek single flow sirf 20 dekhta hai.
Cell E — kai links par aggregate
- Per-link bidir = 40 GB/s (Ex 4 se).
- Chhe links = aggregate. Yeh step kyun? Links independent physical ports hain; unki bandwidths add hoti hain.
Verify: GB/s. ✓ Parent 240 GB/s aggregate kehta hai, aur PCIe Gen3 x16 se zyada. ✓ Caution: aggregate ≠ jo koi ek peer dekhta hai; ek peer 40 par capped hai (ya 20 one-way).
Cell F — saturated link (efficiency 100%)
Pehle do tools define karo jo saturation govern karte hain: BDP aur efficiency law jise hum Cells F, G aur H mein lean on karenge.
- BDP compute karo (decimal KB). Yeh step kyun? BDP zero stalls ke liye minimum buffer hai — yardstick.
- Efficiency law apply karo: . Yeh step kyun? Buffer ≥ BDP matlab ratio ≥ 1, toh cap fire hoti hai aur koi stall nahi.
- Timeline se cross-check karo: buffer mein drain hoti hai; pehla ack par return karta hai, exhaustion se pehle credits replenish karta hai. Yeh step kyun? Efficiency-law verdict ko actual clock ke against confirm karta hai.
Verify: ack 500 ns par aata hai, buffer 800 ns par empty hone se pehle → no stall. Efficiency . ✓
Neeche di gayi figure ko sender ki fill-and-refill timeline ki tarah padho. Blue curve "in flight" data ki amount hai jaise time aage badhta hai (rising kyunki sender 20 GB/s par pour kar raha hai). Gray dashed line 10 KB par BDP mark karti hai; orange dashed line 16 KB par buffer ceiling mark karti hai. Green dotted vertical 500 ns par hai jab pehla acknowledgement return karta hai. Key cheez jo dekhni hai: green line us point ke left par aati hai jahan blue curve 16 KB ceiling hit karti (800 ns par), toh credits buffer ever empty hone se pehle refresh ho jaate hain — blue curve kabhi flat nahi hoti, matlab link kabhi idle nahi hoti. Yeh geometric "ack-before-ceiling" exactly buffer ≥ BDP condition hai.

Cell G — degenerate: buffer too small (stall)
- 6 KB bhejne mein time . Yeh step kyun? Jab credits zero hite hain, itne time tak useful kaam chala.
- Ack 500 ns par aata hai; sender 300 → 500 ns tak idle. Yeh step kyun? Yeh gap forced stall hai.
- Stall .
- Efficiency , se match karta hai. Yeh step kyun? BDP se neeche cap fire nahi hoti, toh efficiency bas raw ratio buffer/BDP hai.
Verify: aur agree karte hain. ✓ Effective throughput GB/s. ✓ Rule confirm: BDP se neeche, efficiency . ✓
Cell H — limiting cases (boundary sanity)
- (a) . Phir kisi bhi ke liye. Yeh step kyun? Law ko low boundary par test karta hai — koi in-flight data nahi matlab buffer requirement zero ho jaati hai.
- (b) Jaise , , toh . Yeh step kyun? Dikhata hai ki cap efficiency ko exactly 100% par rakhta hai, kabhi usse zyada nahi — ek sanity guard.
Verify: dono limits mein. ✓ Dono degenerate ends 100% dete hain, intuition se match karta hai: sirf finite latency paired with too-small buffer (Cell G) hi stall kar sakta hai.
Cell I — real-world all-reduce word problem
Numbers se pehle, algorithm carefully fix karo — common trap yeh assume karna hai ki har hop poora gradient move karta hai.
- Steps (reduce-scatter + all-gather). Yeh step kyun? Ring do -step passes mein reduction complete karta hai, ek mein nahi; dono count karne chahiye.
- Chunk per step . Yeh step kyun? Yahi poora correction hai — ek hop ek chunk carry karta hai, poora gradient nahi.
- Per-step time . Yeh step kyun? Saare links parallel mein apna chunk move karte hain, toh ek step ek single chunk-transfer time karti hai.
- Total NVLink . Yeh step kyun? Steps ek ke baad ek run karte hain; multiply karo.
- PCIe (5 GB/s effective): per step ; total . Yeh step kyun? Same algorithm aur data volume, slower link.
Verify: NVLink ms. ✓ PCIe ms. ✓ Speedup . Note karo yeh ek naive model (full 1.5 GB per hop) ko correct karta hai jo NVLink time kaafi × se over-estimate karta; parent ka ~10× headline ek more pessimistic PCIe figure aur "full-gradient" simplification use karta hai, toh uska arithmetic aur hamara differ karte hain — method yahan correct wala hai. Units: GB ÷ (GB/s) = s throughout. ✓
Cell J — exam twist: NVLink vs PCIe crossover
- Har path model karo fixed cost + transfer time ke roop mein: NVLink time ; PCIe time . Yeh step kyun? NVLink ka advantage speed hai lekin setup tax pay karta hai; PCIe ka fixed cost ~0 hai yahan.
- Equal set karo: . Yeh step kyun? Crossover exactly wahan hai jahan dono times match karte hain.
- Solve karo: , toh .
- plug karo: (decimal KB). Yeh step kyun? 333 KB se neeche setup overhead NVLink ko plain PCIe se slower bana deta hai.
Verify: GB par: NVLink ; PCIe . Equal ✓.
Neeche di gayi figure ko do cost lines ki tarah padho jo cross karti hain. Blue line (NVLink) par zero se upar shuru hoti hai — woh raised intercept fixed 50 µs setup tax hai — phir dhheere charhti hai (gentle slope ). Orange line (PCIe) origin se shuru hoti hai lekin steeply charhti hai (slope , chaar guna steeper). Dono red dot par milti hain: KB, µs. Dot ke left orange line lower hai — chhote messages ke liye PCIe jeet ta hai. Right mein blue line lower hai — bade messages ke liye NVLink jeet ta hai. Sabak us intersection mein rehta hai: NVLink bade transfers ke liye shine karta hai (gradients, activations); chatty tiny messages ke liye setup tax winner flip kar sakta hai.

Drill hall band karo — das cells ke lessons
Recall Self-test: cell ka naam batao, phir answer do
NVLink 1.0 8-lane 20 GT/s 8b/10b unidirectional payload? ::: 16 GB/s (Cell A) NVLink 4.0 raw master-formula payload/dir (9 lanes, 26.56 GT/s, PAM4, 128b/130b)? ::: 58.8 GB/s formula (46.5 datasheet) (Cell B) NVLink 2.0 ke liye datasheet "25 GB/s/dir" kis payload correspond karta hai? ::: 20 GB/s after 8b/10b (Cell C) Ek V100 ka aggregate NVLink 2.0 bandwidth (6 links)? ::: 240 GB/s bidirectional (Cell E) 20 GB/s par 500 ns latency ke liye BDP? ::: 10 KB decimal (Cell F) 6 KB buffer ke saath efficiency jab BDP 10 KB hai? ::: 60% via min(1, 6/10) (Cell G) Ring all-reduce time, 8 GPUs, 1.5 GB, 20 GB/s (chunks, both phases)? ::: 131.25 ms (Cell I) Crossover payload jahan NVLink overhead 50 µs PCIe ke barabar ho (5 vs 20 GB/s)? ::: 333 KB (Cell J)