Gates → GPUs · Notes
Course notes · Units 1–4 of 7

From a tiny computer to modern CPUs and GPUs

A course built as a chain of problems. Start with a machine that can run one instruction at a time from sixteen bytes of memory. Then, one lesson at a time, add exactly the mechanism needed to get past the machine's latest limitation, and say what it costs.

The goal: look at an unfamiliar CPU or GPU block diagram and explain why each major part exists, trace how a program uses it, and predict what limits performance. You need basic programming experience. No electronics, assembly or architecture background is assumed, and nothing has to be installed: every explorer runs in these pages.

Every lesson answers the same questions

Each lesson opens with a four-part card, so you always know why you're learning something before you learn how it works:

LimitationWhat can the current machine do, and what wall has it hit?
New mechanismWhat single new idea do we add to get past it?
New stateWhat does it have to remember, and who owns that state?
CostWhat does it cost in area, energy, complexity or predictability, and when does it fail to help?

Then comes an explanation with diagrams, a worked trace, an interactive explorer, Predict questions whose answers stay folded until you've committed to one, and a checkpoint to explain in your own words.

The course map

Unit 1 · Lessons 1–4 ready

Build the smallest useful computer

  1. Bits and meaning
  2. Gates, muxes, adders, the ALU
  3. State and the clock
  4. A stored-program machine (NIB-8)
Milestone: explain how one fixed circuit can run different programs.
Unit 2 · Lessons 5–7 ready

Registers, programs & execution contexts

  1. Register machines and RISC-V
  2. One ISA, different hardware
  3. Calls, stacks, traps, thread contexts
Milestone: distinguish a program, process, thread, saved context and running hardware context.
Unit 3 · Lessons 8–15 ready

Make one CPU core faster

  1. Pipelining
  2. Hazards and forwarding
  3. Caches
  4. Virtual memory and the TLB
  5. Branch prediction
  6. Superscalar width
  7. Renaming and out-of-order
  8. Precise retirement, memory order
Milestone: trace a load, an independent add and a dependent branch through a small out-of-order core.
Unit 4 · Lessons 16–19 ready

Add parallelism

  1. Multicore and cache coherence
  2. Memory ordering, synchronization
  3. Hardware multithreading (SMT)
  4. SIMD, vectors and tails
Milestone: tell instruction-, thread- and data-level parallelism apart, and say what each still shares.
Unit 5 · Lessons 20–24 ready

Understand GPUs

  1. SIMT and the programming model
  2. Occupancy, scheduling, divergence
  3. GPU memory traffic
  4. Tiling and synchronization
  5. Roofline and measurement
Milestone: explain why a simple kernel is slow, predict its limit, and design the measurement that tests it.
Unit 6 · Lessons 25–28 ready

Connect the modern system

  1. Matrix hardware and number formats
  2. Heterogeneous SoCs and shared memory
  3. Packaging, HBM, NUMA
  4. Multiple GPUs and collectives
Milestone: follow bytes from host memory through a kernel and across GPUs, with an explicit time budget.
Unit 7 · Lessons 29–30 planned

Read real architectures

  1. Case studies of current CPUs, GPUs and accelerators
  2. Capstone: explain performance from first principles
Predict, measure, change one thing, explain.

The chain so far

Units 1–4 read as one continuous argument, where each mechanism answers the previous machine's bottleneck:

Problems on the left, the mechanisms that answer them on the right. Unit 5 continues the chain into GPUs: "enormous data parallelism" leads to SIMT, and "arithmetic units starved for bytes" leads to tiling and the Roofline model.

Companion: Stanford CS149 lectures

Self-contained study pages built from Stanford's Parallel Computing course, one per lecture. They look at the same hardware from a programmer's angle: what each feature demands from your code.

CS149 · Lecture 1 ready

Why parallelism? Why efficiency?

  1. Speedup, communication and load balance
  2. ILP limits and the power wall
  3. Memory latency, stalls and caches
Pairs with Units 1–3.
CS149 · Lecture 2 ready

A modern multi-core processor

  1. Multi-core, SIMD and hardware multithreading
  2. Divergence, latency hiding, throughput
  3. Kaby Lake core and V100 SM, with peak-rate arithmetic
Pairs with Units 3–4.
CS149 · Lecture 3 ready

Latency, bandwidth, and SPMD

  1. Latency vs throughput, Little's law
  2. Bandwidth-bound execution
  3. ISPC: abstraction vs implementation
Pairs with Units 3–5.
CS149 · Lecture 7 ready

GPU architecture and CUDA

  1. CUDA's thread hierarchy and memory model
  2. V100 SM, warps and SIMT
  3. Block scheduling and deadlock
Pairs with Unit 5.
CS149 · Lecture 10 ready

Efficiently evaluating DNNs

  1. Convolution layers and cheaper topologies
  2. im2col, implicit GEMM and blocking
  3. Fusion, fused attention, tensor cores
Pairs with Units 5–6.

All CS149 lectures →

Reference

A standalone map that ties the units and lectures together.

Reference ready

A map of parallel machines and programs

  1. Flynn's taxonomy, and seven machines running one job
  2. Systolic arrays, dataflow and spatial hardware
  3. Ten programming models, same computation
Pairs with Units 4–5 and CS149 Lecture 3.

How to study with these notes

The old limitation was  . We added  . The new state is  . On the worked example,   changes. The cost is  . The idea fails to help when  . I can test that by  .

Move on when you can explain the mechanism without its diagram and solve a changed version of the example. If you can name the parts but can't trace the behaviour, do one more small trace before adding complexity.

Ground rules these notes follow

RuleWhy
Separate the instruction contract from any one implementationMost of this course is hidden machinery that must never change a program's results.
Label teaching machines, invented timings and ideal boundsNIB-8, the 5-stage model and the tiny cache are for tracing, not specifications of real chips.
Keep latency, throughput, bandwidth, capacity and energy apartMost performance confusion comes from blurring two of them.
Always ask: whose state is it, is it private or shared, and when does it become visible?This question runs from function calls to GPU shared memory.
Name the cost of every mechanismNothing in hardware is free. Area, power and complexity are always in the trade.

Want the one-page, big-picture tour of every stage from gates to datacenter GPUs first? See the Gates to GPUs overview. These notes go slower and deeper.

Start hereUnit 1 · Build the smallest useful computer →