Lecture 13 · SambaNova's Reconfigurable Dataflow Architecture (guest lecture)

Hardware Accelerators for Machine Learning · Lecture 13。个人学习讲义与配套实验,按主题整理并持续修订。

课程源码 ZIP ↓

个人整理的学习笔记,非官方讲义;课程来源与整理说明见课程介绍。配套示例未逐一运行验证。

本篇目录

Maps to: Stanford CS 217 Hardware Accelerators for Machine Learning (Winter 2026), Lecture 13 · Tue 02/24/2026 · SambaNova RDA, guest lecture by Raghu Prabhakar (SambaNova Systems). Reading: none is listed on the schedule. These notes are written only from public material:

  • R. Prabhakar et al., SambaNova SN40L: scaling the AI memory wall with dataflow and composition of experts, MICRO 2024 (arXiv:2405.07518);
  • SambaNova’s Kernel Looping: eliminating synchronization boundaries for peak inference performance (arXiv:2410.23668, 2024);
  • the SN10 RDU talk at Hot Chips 33 (2021), as reported in public coverage;
  • Lecture 12’s Plasticine paper.

Basis: The guest lecture’s slides are not public. Nothing here reflects what was said in class.

The experiments use a roofline-style model of the published SN40L design written for these notes (rdu.py). It reuses:

  • Lecture 10’s decoder-block graph and kernel cost model;
  • Lecture 12’s pipeline balancing;
  • Lecture 1’s model shapes.

Kernel-call overheads, all-reduce latency, tile size and expert popularity are assumed and swept. The papers’ measurements are quoted next to the model’s estimates and labelled. Code: code/lecture13/ (4 scripts + 1 module; under 1 s each) Reading time: 2.5–3 hours including running the code


0. How to read this lecture

0.1 Learning goals

After this lecture you should be able to:

  1. Describe how Plasticine’s ideas became SambaNova’s SN10 and SN40L Reconfigurable Dataflow Units (RDUs), and what changed: scale, number formats, and above all the memory system.
  2. Explain streaming dataflow: fusing a whole decoder layer into one spatial kernel. Estimate what it saves over unfused kernels and over already-fused kernels.
  3. Decompose an LLM decode step on a multi-socket system into memory streaming, communication and call overhead. Explain hardware-orchestrated calls and kernel looping.
  4. Explain the three-tier memory (SRAM, HBM, DDR) and the composition of experts it enables. Reproduce the published footprint and switching ratios from capacities and bandwidths.
  5. Weigh the dataflow design’s bets against the GPU’s, using numbers rather than marketing.

0.2 Prerequisites and scope

AssumedIntroduced hereDeveloped later
Lecture 10: fusion, decode vs prefill, PagedAttentionstreaming dataflow of whole layersmemory-centric computing for decode (L14–15)
Lecture 11: GPU kernels, launches, tensor parallel GEMMshardware-orchestrated calls, kernel loopingAWS Inferentia/Trainium (L16)
Lecture 12: Plasticine, PCUs/PMUs, balancing, spatial vs kernelsthree-tier memory; composition of expertsNVIDIA’s view of AI hardware (L17)
Lecture 8: all-reduce, chip-to-chip links

0.3 Map

§1  from Plasticine to SN10 and SN40L                                ← code 01 (Part 1)
§2  the memory tiers and what fits where                             ← code 01 (Parts 2-3)
§3  streaming dataflow: one decoder layer as one kernel              ← code 02
§4  decode: call overheads, hardware orchestration, kernel looping   ← code 03
§5  composition of experts and the three-tier memory                 ← code 04
§6  a balanced view: what the dataflow bet buys and costs
§7  summary   §8 pitfalls   §9 exercises   §10 further reading   §11 next lecture

0.4 Notation

SymbolMeaning
RDUReconfigurable Dataflow Unit (one socket)
PCU / PMUpattern compute / memory unit (Lecture 12)
node8 RDU sockets (or 8 GPUs in a DGX)
TPtensor parallelism: one model’s layers split across sockets
CoEcomposition of experts: many models plus a router
callone invocation of a configured kernel on the RDU (a “launch” on a GPU)

1. From Plasticine to a product

1.1 Three generations

Script 01, Part 1 (published numbers):

ChipYearUnitsOn-chip SRAMPeakOff-chip memory
Plasticine (research)201764 PCU + 64 PMU16 MiB12.3 TFLOPS fp32DDR3, 51.2 GB/s
SN10 “Cardinal”2021640 PCU + 640 PMU320 MB~320 TFLOPS bf16DDR4, up to 1.5 TB
SN40L20231,040 PCU + 1,040 PMU520 MiB638 TFLOPS bf1664 GiB HBM (~2 TB/s) + up to 1.5 TiB DDR

The SN40L paper describes:

  • a 5 nm, two-die package (CoWoS) with HBM on the package and DDR DIMMs behind it;
  • PCUs whose body is either an output-stationary systolic array (Lecture 5) or a pipelined SIMD datapath, with a “tail” stage for transcendental functions, random numbers, stochastic rounding and format conversion;
  • PMUs as distributed SRAM;
  • a peer-to-peer network between sockets, 8 sockets and a host forming a node.

The compute grew ~50× from Plasticine (fp32 → bf16 accounts for part of it). The bigger change is in kind: the memory system went from one DDR tier to three tiers.

1.2 Why the PCU gained a systolic mode

Plasticine’s PCU was a SIMD pipeline. For matrix multiplication, Lecture 11’s energy analysis showed the cost lies in moving operands and accumulators, not in the arithmetic: an accumulator-stationary unit spent 89% of its energy on math against 13% for SIMD FMAs. A PCU that can switch into an output-stationary systolic configuration keeps the GEMM’s partial sums inside the array, as a TPU does. The same unit can still run element-wise and reduction patterns in SIMD mode. Reconfigurability at the level of the unit’s mode, not just the routing, is how the product covers GEMMs and the “glue” operators at once.


2. Three memory tiers

2.1 One socket and one node vs an H100

Script 01, Part 2:

SN40L socketH100
peak bf16 (dense)638 TFLOPS989 TFLOPS
on-chip SRAM520 MiB50 MB L2 (+ 33 MB registers, 33 MB L1/shared)
HBM64 GiB at ~2.0 TB/s80 GB at 3.35 TB/s
third tierDDR up to 1.5 TiB at > 200 GB/shost DRAM over PCIe
ridge on HBM319 FLOP/B295 FLOP/B
node: copy into accelerator memory> 1 TB/s DDR → HBM (paper)64 GB/s (the paper’s comparison)

Per chip, the H100 has 1.6× the FLOPs and 1.7× the HBM bandwidth. The SN40L has 10× the SRAM and a DDR tier 25× its HBM. The designs bet on different things:

  • the GPU on raw throughput per chip;
  • the RDU on keeping data on chip (fusion) and on capacity (many models per node).

The DDR tier’s ridge (3,190 FLOP/byte) says it is for holding models, not for serving them token by token.

2.2 What fits where

Part 3 (bf16 weights, per 8-chip node):

ModelWeightsNode SRAM (4 GiB)Node HBM (512 GiB)Node DDR (12 TiB)DGX H100 HBM (640 GB)
Llama 2 7B13.5 GBno842 µs per read8.4 ms503 µs
Llama 3 8B16.1 GBno1.0 ms10 ms599 µs
Llama 3 70B141 GBno8.8 ms88 ms5.3 ms
Llama 3.1 405B812 GBnodoes not fit507 msdoes not fit

A full read of the weights is the floor of a batch-1 decode step (Lectures 1 and 10). Decode therefore runs from HBM. No listed model fits in a node’s SRAM, so weights stream from HBM while the activations stay on chip. The DDR tier pays off only if models are copied into HBM rarely, which is the composition-of-experts design of §5.


3. Streaming dataflow: one layer, one kernel

3.1 The idea

Lecture 10 fused a few operators per kernel: element-wise chains, matmul epilogues, FlashAttention. Lecture 12 laid an MLP block out in space. The SN40L paper takes this to whole layers. Its compiler fuses an entire decoder layer into one kernel call, a coarse-grained pipeline in which:

  • tiles stream from operator to operator through PMUs with arbitrary access patterns;
  • HBM is used “only for streaming weights and KV cache values”;
  • the fused layer uses ~90% of the PCUs and PMUs and sustains over 85% of the HBM bandwidth (paper).

rdu.stream_layer models this on one socket:

  • every operator of Lecture 10’s decoder-block graph gets PCUs in proportion to its FLOPs (Lecture 12’s balance() over 936 of the 1,040 units);
  • tokens stream in 32-token tiles;
  • the pipeline runs at its slowest operator’s rate, plus a fill: the first tile’s trip along the critical path of the operator graph;
  • HBM carries weights, the layer’s input and its output.

For a fair comparison, kernel-by-kernel execution gets the same 90% / 85% efficiencies.

3.2 Results

Script 02, Part 1 (a Llama-3-8B-sized layer with multi-head attention, as in Lecture 10; one socket):

Tokens20 unfused kernels7 fused kernels (Lecture 10)1 streaming kernelvs unfusedvs fused
128526 µs / 555 MB372 µs / 513 MB297 µs / 489 MB1.77×1.25×
512800 µs / 860 MB524 µs / 591 MB608 µs / 495 MB1.32×0.86×
2,0483.55 ms / 3.59 GB1.97 ms / 906 MB2.07 ms / 520 MB1.71×0.95×
8,19228.8 ms / 38.7 GB9.11 ms / 2.16 GB9.27 ms / 621 MB3.10×0.98×

Three conclusions follow.

  • Against unfused kernels, the streaming kernel is 1.3–3.1× faster and moves 6.9× less HBM traffic at 2,048 tokens. That matches the paper’s 1.5–3× for prefill and training over an unfused baseline. Its overall 2–13× range includes decode and FlashFFTConv.
  • Against already-fused kernels, the advantage disappears once the layer is compute-bound (0.86–0.98×). Both run at the PCUs’ peak, and the streaming kernel pays a pipeline fill and one-PCU-per-operator granularity. The plan said one streaming kernel would win everywhere, and the model disagreed (see the code README’s “Plan vs reality”). Streaming wins where calls and HBM traffic matter: small token counts and, above all, decode (§4).
  • Per chip, an H100 is faster (1.25 ms vs 2.07 ms at 2,048 tokens with fused kernels in the same model), because it has 1.6× the FLOPs. The RDU’s case rests on system-level behaviour, not per-chip prefill speed.

3.3 Inside the kernel

Part 2 (2,048 tokens):

  • PCU allocation: gate, up and down get ~208 PCUs each, Q/K/V/O ~60 each, the two attention matmuls 30 each; 11 small operators get one PCU each.
  • Pipeline timing: the slowest operator takes 1.88 ms; fill and one call bring the kernel to 2.07 ms, 81% of peak.
  • SRAM: 32-token tiles in flight need 47 MB of the 520 MiB.

Part 3 varies the tile size. 8-token tiles give 86% of peak, 512-token tiles 35%, because the fill grows with the tile. Our model does not charge the inefficiency of very small tiles, so their numbers are optimistic. With 50 µs per call, the single call makes streaming 3.9× faster than unfused kernels at 128 tokens.


4. Decode: calls, communication, kernel looping

4.1 Where a token’s time goes

A decode step streams every weight once (shared by the batch) and each sequence’s KV cache (Lecture 10), across all the sockets of a tensor-parallel group. On top of that come:

  • kernel calls: one per kernel per layer if operators are separate kernels, one per layer if each layer is one streaming kernel;
  • all-reduces: two per layer for tensor parallelism (Lecture 8), latency-bound for the small messages of decode.

Script 03, Part 1 (Llama 3 8B, 16 sockets, batch 1, 8K context):

Call modeHBMAll-reducesCallsPer tokenTokens/s/user
per-kernel calls (224/token)630 µs320 µs2.24 ms3.19 ms313
per-layer calls (32/token)630 µs320 µs320 µs1.27 ms787
per-layer, hardware-orchestrated630 µs320 µs32 µs982 µs1,018
kernel looping (1/token)630 µs320 µs10 µs960 µs1,042

The call overheads (10 µs software, 1 µs hardware-orchestrated) and the 5 µs all-reduce are assumptions.

  • Hardware orchestration: the SN40L schedules kernel calls on the chip instead of from host software. The paper reports 1.4–8× for decode benchmarks, and at most 1.1× for prefill and training, where kernels are long.
  • Kernel looping (arXiv:2410.23668): the repeated calls to the same layer kernel become one call to a kernel with a pipelined outer loop over layers, which removes the synchronization at layer boundaries. That paper reports up to 2.2× (1.6× geometric mean) on SN40L decode, over 90% of peak performance on 8 and 16 sockets, and up to 3.7× over a DGX H100. It also measures GPUs using only 21% of their peak memory bandwidth in token generation because of kernel-boundary synchronization. All numbers are the authors’ own.

What remains after the calls are gone is communication: 64 small all-reduces cost a third of the step in our model. Decode at batch 1 across many sockets is a latency problem (memory and synchronization), not a FLOPs problem.

4.2 Models, sockets and the published numbers

Part 2 (kernel looping, batch 1, tokens/s per user):

ModelSN40L × 8SN40L × 16DGX H100 (model)Paper, 16 sockets
Llama 2 7B6111,017501–
Llama 3 8B6291,0425081,042
Llama 3 70B88164107457 (speculative decoding)
Llama 3.1 405B5 (overflow from DDR)32does not fit129 (speculative decoding)

Read this table carefully.

  • The paper’s Table IV uses bf16 weights and 8K context. It employs speculative decoding for 70B and 405B, which produces several tokens per pass over the weights, so those numbers exceed a plain weight-streaming bound. Our model does no speculation.
  • The 8B match is a coincidence of the two assumed overheads. Part 3 shows 781–1,421 tokens/s for other plausible values.
  • The DGX H100 column applies the same model with 3.35 TB/s per GPU and 224 launches per token.
  • 405B does not fit in 8 sockets’ HBM (101 GB per socket). The RDU can stream the overflow from DDR, at 5 tokens/s.

Across the assumed overheads, kernel looping is worth 1.2–3.1× over per-layer calls and 2.7–16× over per-kernel calls. With 50 µs software calls, hardware-orchestrated per-layer calls beat even a single looped call. This is why both papers report ranges.

4.3 Batching

Part 4 (Llama 3 70B, 16 sockets). Batching amortizes the weights but not the KV caches (Lectures 1 and 10). At 8K context:

  • batch 1 → 164 tokens/s per user;
  • batch 32 → 109 per user, 3,495 total;
  • batch 128 → 54 per user, 6,871 total.

At 32K context and batch 128 the KV caches need 95 GB per socket, more than its 64 GiB of HBM.


5. Composition of experts and the three-tier memory

5.1 The idea

Training and serving one giant model is expensive. A composition of experts (CoE) serves many smaller specialized models plus a router that sends each request to the right one. SambaNova’s Samba-CoE in the paper has 150 Llama-2-7B experts, over a trillion parameters in total, on one 8-socket node.

On conventional hardware CoE has two problems (paper):

  • small models have low operational intensity unless their operators are fused, which §3 addresses;
  • switching among many models is slow or requires holding all of them in expensive HBM.

The three-tier memory addresses the second:

  • DDR holds the library of experts (12 TiB per node);
  • HBM caches the hot ones (512 GiB per node);
  • SRAM holds the running layer’s tiles.

Copies from DDR to HBM run at over 1 TB/s per node.

5.2 Footprint and switching from first principles

Script 04, Parts 1–2 (13.5 GB per expert):

ExpertsSN40L nodesDGX H100 nodes
5012
15014
850119
NodeCopy bandwidthSwitch one expertvs SN40L
SN40L> 1 TB/s (DDR → HBM)13.5 ms1×
DGX H10064 GB/s (host → GPU, paper’s comparison)211 ms15.6×
DGX A10032 GB/s421 ms31.2×

Both published claims follow directly from the published capacities and bandwidths:

  • one node serves up to 850 experts where a DGX needs 19 nodes;
  • model switching is 15–16× faster than a DGX H100 and 31× faster than a DGX A100.

This is the course project shape “reproduce a published result with an analytical model” (Lecture 10, §7) in miniature.

5.3 Serving a routed request stream

rdu.simulate_coe routes 400 requests to experts with Zipf(1) popularity. The node’s HBM caches the most recently used experts (28 on the SN40L node, 33 on a DGX, keeping 30% for KV caches), starting warm. A miss waits for the expert’s copy, and decode then runs at §4’s speed. Part 3:

ExpertsOutput tokensSN40LDGX H100DGX A100H100 / SN40LA100 / SN40L
202027 ms (100% hits)37 ms45 ms1.3×1.6×
502030 ms (80%)66 ms (44% switching)102 ms2.2×3.4×
1502033 ms (57%)121 ms (70% switching)214 ms3.7×6.5×
150200278 ms451 ms615 ms1.6×2.2×

With few experts everything stays in HBM and only decode speed differs. With many experts a DGX spends most of its time copying models.

The paper reports a similar order over 50 experts: 2.8–3.7× vs DGX H100 and 4.8–6.6× vs DGX A100. Under 50 experts it reports 1.5× / 2× at 20 tokens and 2.3× / 3.2× at 200 tokens. That is a larger per-token decode advantage over its GPU baseline than our model’s 1.3×, a reminder that the GPU baseline’s software matters as much as its hardware.

Part 4 shows the sensitivity:

  • Popularity: uniform popularity makes almost every request miss (5.4× advantage); strong skew (Zipf 1.5) keeps the hot experts cached (2.1×).
  • Copy bandwidth: at 0.25 TB/s DDR → HBM much of the advantage is gone (2.4×).

The CoE bet is a memory-system bet: many models are cheap to serve only if switching between them is cheap.


6. A balanced view

What the dataflow design buys:

  • Fusion by construction. A whole layer is one kernel, so intermediates never touch HBM (6.9× less traffic) and there is one call instead of 20.
  • Decode efficiency. With hardware orchestration and kernel looping, the per-token overhead falls from milliseconds to microseconds and the remaining time is HBM streaming and communication. The paper reports >85% of HBM bandwidth.
  • Capacity and model switching. The three tiers let one node hold hundreds of models and swap them in milliseconds.
  • One chip for many operator types. PCUs switch between systolic and SIMD modes, so GEMMs and glue operators share the same fabric.

What it costs, or where it does not win:

  • Per-chip throughput. 638 vs 989 TFLOPS and 2.0 vs 3.35 TB/s against an H100. Compute-bound prefill is faster on a GPU per chip.
  • Against well-fused GPU kernels, streaming is at parity for compute-bound work (§3.2). Its gains are largest against unfused baselines and in overhead-bound regimes.
  • Compiler dependence. Mapping a whole layer onto ~1,000 units, balancing it, placing and routing it, and choosing tile sizes are all compiler problems (Lecture 12). New operators must fit the spatial model.
  • Communication. Multi-socket decode is limited by all-reduce latency, which neither fusion nor looping removes.
  • Software baselines move. GPU stacks keep adding fusion, CUDA graphs and persistent kernels that attack the same overheads.

The deeper lesson is architectural. For LLM inference, memory capacity, memory bandwidth and synchronization matter as much as FLOPs: Ma and Patterson’s argument, which opens Lecture 14. SambaNova’s answer is a memory hierarchy (SRAM, HBM, DDR) plus a spatial execution model that wastes neither bandwidth nor time between kernels. Lectures 14–15 consider moving the compute into the memory instead.


7. Summary

  1. Plasticine became the SN10 (640 + 640 units, 320 MB SRAM, DDR) and SN40L (1,040 + 1,040 units, 638 TFLOPS bf16, 520 MiB SRAM, 64 GiB HBM, 1.5 TiB DDR). The biggest change is a three-tier memory.
  2. Per chip an SN40L has less compute and HBM bandwidth than an H100 but 10× the SRAM and a DDR tier 25× its HBM. Its DDR tier holds models; HBM serves them.
  3. Streaming dataflow fuses a whole decoder layer into one kernel. In our model it is 1.3–3.1× faster than unfused kernels with 6.9× less HBM traffic (paper: 1.5–3× for prefill), but at parity with well-fused kernels once compute-bound.
  4. Decode is HBM streaming + communication + call overhead. Per-layer streaming kernels, hardware-orchestrated calls and kernel looping remove the call overhead (313 → 1,042 tokens/s for Llama 3 8B on 16 sockets, in a model with assumed overheads). All-reduces remain a third of the step.
  5. The paper’s 70B and 405B numbers use speculative decoding and exceed a plain weight-streaming bound. The 8B agreement with our model is a coincidence of assumptions.
  6. Composition of experts: one SN40L node holds 850 7B experts against 19 DGX H100 nodes, and switches an expert 15.6× / 31× faster than a DGX H100 / A100. Both ratios follow from published capacities and bandwidths. Serving 150 experts is 3.7× / 6.5× faster in our model, with the advantage set by popularity skew and copy bandwidth.

8. Common pitfalls

  • “Streaming dataflow beats any GPU kernel.” It beats unfused baselines; against well-fused kernels in compute-bound regimes it is at parity (§3.2).
  • “Per-chip FLOPs decide.” Decode is bound by memory, calls and communication; CoE by copy bandwidth and capacity (§4, §5).
  • “Our model matches the paper, so it is right.” The 8B match is a coincidence; 70B/405B differ because the paper uses speculative decoding (§4.2).
  • “DDR is too slow to matter.” It is too slow to serve from (10 ms per weight read of an 8B model), but fast enough to switch models in milliseconds (§2.2, §5.2).
  • “LRU is the natural expert cache.” For stationary Zipf popularity a static top-k cache does better (Exercise 12); LRU adapts when popularity shifts.
  • “Kernel looping helps prefill too.” Long prefill kernels hide call overheads; the paper’s gains are for decode (§4.1).

9. Exercises

Exercise 1 (ridges). Compute the SN40L’s ridge points against HBM and against DDR. At what batch size do Llama 3 8B’s projections stop being HBM-bound in decode?

Answer
  • HBM: 638 TFLOPS / 2.0 TB/s = 319 FLOP/byte.
  • DDR: 638 / 0.2 = 3,190 FLOP/byte.

A projection’s intensity in decode is ≈ batch FLOP/byte (bf16 weights shared by the batch, Lecture 11, Exercise 11), so it becomes compute-bound at batch ≈ 319. KV-cache traffic in attention never does (intensity = the GQA group size, Lecture 10).

Exercise 2 (fitting a model). How many SN40L sockets does Llama 3 70B (bf16) need if 30% of each socket’s HBM is kept for KV caches? How long does one weight read take on that many sockets and on 16?

Answer

Usable HBM per socket = 0.7 × 64 GiB = 48 GB; 141 GB / 48 GB = 2.9, so 3 sockets.

One read: 141 GB / (3 × 2 TB/s) = 23.5 ms, against 141 GB / (16 × 2 TB/s) = 4.4 ms on 16 sockets. More sockets buy bandwidth, not just capacity.

Exercise 3 (streaming traffic). For the 2,048-token layer of Script 02 (MHA, d = 4,096, d_ff = 14,336, bf16), compute the streaming kernel’s HBM traffic and compare it with the unfused 3.59 GB.

Answer
  • Weights: 4·4096² + 3·4096·14,336 = 243.3 M parameters → 487 MB, plus norms.
  • Input and output: 2 × 2,048 × 4,096 × 2 B = 33.6 MB.

Total ≈ 520 MB, against 3.59 GB unfused (6.9× less). The 3.07 GB difference is the intermediates: scores, probabilities, activations.

Exercise 4 (pipeline fill). In Part 2 the slowest operator takes 1.88 ms for 2,048 tokens. With 32-token tiles, estimate the fill from the critical path q → s → p → attn → o → gate → down (plus small operators), and compare with the model’s ~0.18 ms.

Answer

Each heavy operator holds a tile for 1.88 ms × 32/2,048 = 29 µs. The softmax p holds one for 1.09 ms × 32/2,048 = 17 µs.

Path: q, s, attn, o, gate, down (6 × 29 µs) + p (17 µs) + the small operators (a few µs each) ≈ 0.2 ms. Minus one bottleneck tile (29 µs) gives a fill of ~0.18 ms. The model’s 2.07 ms = 1.88 ms + 0.18 ms + one 10 µs call.

Exercise 5 (decode floor). For Llama 3 8B on 16 sockets, what are the per-token HBM time and the all-reduce time in the model? What is the best possible tokens/s per user if calls cost nothing and all-reduces 1 µs?

Answer

Per socket: (16.06 GB + 8,192 × 128 KiB of KV) / 16 ≈ 1.07 GB → / (0.85 × 2 TB/s) = 630 µs. All-reduces: 64 × 5 µs = 320 µs.

With free calls and 1 µs all-reduces: 1 / (630 + 64) µs ≈ 1,440 tokens/s (Part 3: 1,421 with a 10 µs looped call).

Exercise 6 (why hardware orchestration). At 10 µs per software call, how much of a per-layer-call decode step (Llama 3 8B, 16 sockets) is call overhead? What does 1 µs per call change?

Answer

32 calls × 10 µs = 320 µs of 1.27 ms: 25%. At 1 µs per call: 32 µs of 982 µs, 3%.

Moving the scheduling of kernel calls onto the chip removes the host round trip from every layer. The paper reports 1.4–8× for decode benchmarks.

Exercise 7 (speculative decoding, hypothetically). A draft model proposes k = 4 tokens, each accepted with probability α = 0.7 independently, and the large model verifies them in one pass over its weights. How many tokens per pass on average? Apply it to the model’s 164 tokens/s for Llama 3 70B.

Answer

Expected tokens per pass = (1 − α^{k+1}) / (1 − α) = (1 − 0.168) / 0.3 = 2.77. So 164 × 2.77 ≈ 455 tokens/s, close to the paper’s 457.

This ignores the draft model’s own cost and the verification FLOPs, and α is a guess. It shows how speculation can lift decode above the weight-streaming bound, not what SambaNova measured.

Exercise 8 (footprint). Reproduce “850 experts: 1 SN40L node vs 19 DGX H100 nodes” with 95% of the holding memory usable for weights.

Answer

Experts: 850 × 13.5 GB = 11.5 TB.

  • SN40L node DDR: 8 × 1.5 TiB × 0.95 = 12.5 TB, so 1 node.
  • DGX H100: 640 GB × 0.95 = 608 GB per node, i.e. 45 experts, so 850 / 45 = 19 nodes.

Exercise 9 (switching cost). A DGX H100 serves 150 experts with a 60% hit rate and ~2 ms per token in the model. How many output tokens per request make switching less than 10% of the time?

Answer

Per request, the expected switching time is 0.4 × 211 ms = 84 ms. We need 84 / (84 + n × 2 ms) ≤ 0.1, so n ≥ 9 × 84 / 2 ≈ 380 tokens. Short answers (20 tokens) are dominated by switching; long generations dilute it, as Part 3 shows.

Exercise 10 (copy bandwidth). What DDR → HBM bandwidth would make an SN40L node’s expert switch as slow as a DGX H100’s? What does that say about the design?

Answer

To match 211 ms for 13.5 GB, the copy would have to run at 64 GB/s, the DGX’s host link.

The CoE advantage is entirely the copy path. DDR capacity without a fast path to HBM would only reproduce a GPU server’s host memory. Each socket’s >200 GB/s of DDR bandwidth, times 8 sockets, is what makes the paper’s >1 TB/s aggregate copy rate possible, and that rate is the feature.

Exercise 11 (static vs LRU caching, analytically). With Zipf(1) popularity over 150 experts and 28 HBM slots, what hit rate does a static cache of the 28 most popular experts achieve?

Answer

Hit rate = H₂₈ / H₁₅₀, where H_n is the n-th harmonic number. H₂₈ ≈ ln 28 + 0.577 + 1/56 ≈ 3.93 and H₁₅₀ ≈ 5.59, so the hit rate is ≈ 70%.

That beats the simulated LRU’s 57%: LRU keeps evicting popular experts after runs of unpopular ones. It adapts if popularity changes; a static cache does not.

Exercise 12 (programming: cache policies). Add a static top-k policy to rdu.simulate_coe: keep the k most popular experts, and load misses into a scratch slot that is evicted at once. Compare with LRU for 150 experts, 20 tokens, batch 1.

Answer

In the author’s run:

  • SN40L node: static gives 70% hits and 12.5 s, against LRU’s 57% and 13.2 s.
  • DGX H100: static gives 72% and 38.0 s, against LRU’s 60% and 48.6 s.

The H100/SN40L ratio falls from 3.7× to 3.0×: a better cache helps the machine with the expensive misses more.

Implementation: draw the expert, then check e < slots. On a miss, add switch_time without changing the cache.


10. Further reading

  • R. Prabhakar et al., “SambaNova SN40L: scaling the AI memory wall with dataflow and composition of experts”, MICRO 2024 (arXiv:2405.07518).
  • SambaNova Systems, “Kernel looping: eliminating synchronization boundaries for peak inference performance”, arXiv:2410.23668, 2024.
  • R. Prabhakar, S. Jairath, “SambaNova SN10 RDU: accelerating software 2.0 with dataflow”, Hot Chips 33, 2021; and the ISSCC 2022 paper on SN10.
  • R. Prabhakar et al., “Plasticine: a reconfigurable architecture for parallel patterns”, ISCA 2017 (Lecture 12).
  • Y. Leviathan, M. Kalman, Y. Matias, “Fast inference from transformers via speculative decoding”, ICML 2023.
  • N. Shazeer et al., “Outrageously large neural networks: the sparsely-gated mixture-of-experts layer”, ICLR 2017 (experts inside one model, for contrast with composition of separate models).

11. Next lecture

Lecture 14, Memory-centric computing (Part 1): processing near memory, starts from the conclusion of this lecture and of Ma and Patterson’s paper: for LLM inference, memory and interconnect, not compute, are the primary challenges. Instead of moving data to the compute faster, we will move compute into or next to the memory:

  • Kautz’s cellular logic-in-memory arrays (1969);
  • bulk bitwise operations inside DRAM rows;
  • bank-level processing units in HBM (Samsung’s HBM-PIM) and DRAM-bank processors (UPMEM).

We will measure when a GEMV runs better next to the banks than on a GPU, and what that means for decode.

← 返回课程目录