6.2.1 · D4GPU Architecture

Exercises — GPU vs CPU design philosophy

3,303 words15 min readBack to topic

These problems climb from recognising the vocabulary to synthesising whole design decisions. Every solution is hidden inside a collapsible callout so you can test yourself first. Do the arithmetic on paper, then reveal. Parent note: GPU vs CPU design philosophy.

Before we start, one reminder about the two words that everything hangs on:

Figure 1 (below) is your compass for the whole page: the left half is the CPU's single fast lane (small latency), the right half is the GPU's stack of slower lanes (huge throughput). Every exercise is really asking "am I on the amber lane or the cyan lanes?" — glance back at it whenever you feel lost.

Figure — GPU vs CPU design philosophy

Figure 1. Latency vs throughput. Amber box = one fast CPU worker finishing a single task quickly. Cyan boxes = many slower GPU workers finishing a whole flood of tasks per second. Note that no single cyan arrow is as fast as the amber one — the win comes from having many of them.

We will reuse two formulae from the parent note. They are written out here so no symbol appears unexplained.


Level 1 — Recognition

Before Exercise 1.1 uses the word, one piece of vocabulary must exist first:

Exercise 1.1

For each phrase, say whether it belongs to a latency-oriented (CPU) or throughput-oriented (GPU) design: (a) branch predictor, (b) 8704 simple cores, (c) 64 MB L3 cache, (d) warp scheduler hiding memory stalls, (e) out-of-order execution.

Recall Solution
  • (a) branch predictor → CPU (speculates to keep one thread moving fast = latency).
  • (b) thousands of simple cores → GPU (many workers = throughput).
  • (c) huge L3 cache → CPU (keeps one thread's data 1 tick away = latency).
  • (d) warp scheduler → GPU (swaps stalled work for ready work = keeps throughput high).
  • (e) out-of-order execution → CPU (reorders to raise a single thread's = latency). Map each answer onto Figure 1: (a),(c),(e) sharpen the single amber lane; (b),(d) feed the cyan stack.

Exercise 1.2

Fill in the blank: a group of 32 threads on a GPU that all execute the same instruction at the same time is called a ______, and this execution model is called ______.

Recall Solution

A warp; the model is SIMT (Single Instruction, Multiple Threads). Why 32 matters: the scheduler issues one instruction to all 32 at once, so it only needs one decoder for 32 lanes — that is exactly how a GPU saves control-logic transistors.


Level 2 — Application

Exercise 2.1

A CPU runs a thread of instructions at and . Compute .

Recall Solution

Plug into . Denominator: instructions/second. What it means: at 12 billion finished instructions per second, six billion take half a second.

Exercise 2.2

An image has pixels, each an independent task taking . Compute the batch time on (a) a CPU with cores, (b) a GPU with cores (assume the same for simplicity).

Recall Solution

Use , with s.

(a) CPU: tasks per core.

(b) GPU: tasks per core.

Reading it: the only thing that changed is . More workers → the same pile of work is split thinner → shorter batch time. This is the whole throughput story in one division — exactly the cyan stack in Figure 1 doing the amber lane's job many times over.

Exercise 2.3

Using the parent note's simplifying assumption that a batch's speedup equals the core-count ratio, find the speedup of the GPU over the CPU for , .

Recall Solution

This holds only when so both machines stay fully busy.

Exercise 2.4 — The edge case: fewer tasks than cores

A GPU has cores. You launch a batch of only independent tasks, each ns. (a) How many cores actually do work? (b) What is the batch time ? (c) What speedup did you get over using a single core, and why is it far below 4096×?

Recall Solution

(a) One task per core, so only 512 of the 4096 cores light up; the other 3584 sit idle. (b) . Here , which rounds up to 1 wave of work (you cannot run a fraction of a pass), so (c) Versus one core doing all 512 tasks ( ns), the speedup is not 4096×. Why the ceiling is , not : you can never get more parallel speedup than you have independent pieces of work. When , the effective speedup is capped at , and cores are wasted silicon. This is the throughput machine's worst regime — a giant cyan stack in Figure 1 with most lanes empty. Feeding a GPU too little work is the single most common way to get a "GPU is slower!" surprise.


Level 3 — Analysis

Before the exercise, we earn the GPU formula rather than quoting it. Start from the batch model and refine each piece for a real GPU.

Exercise 3.1

A GPU kernel launches on a chip with , , occupancy , and . Each task costs cycles. Compute . Then state what happens to if occupancy drops to (half).

Recall Solution

Effective working cores: workers. Task-slot rate (denominator): cycles/second. Units check: . ✓ Halving occupancy halves the denominator, so doubles to . Why occupancy is the hidden villain: the GPU hides memory latency by having many warps ready to swap in. Low occupancy = too few ready warps = cores sit idle waiting on DRAM. The arithmetic units exist but nothing feeds them.

Exercise 3.2

Explain, using , why a CPU designer who cannot raise the clock any further would spend transistors on branch prediction and out-of-order execution.

Recall Solution

has exactly three knobs. is fixed by the program. hit a power/heat wall around a few GHz. The only remaining knob is — instructions finished per tick. Branch prediction stops the pipeline from stalling on unknown branches, and out-of-order execution finds independent instructions to run while others wait. Both raise , which shrinks without touching the clock. That is precisely why those transistors are worth it.


Level 4 — Synthesis

Exercise 4.1 — Amdahl's ceiling

A program is 95% parallelisable () and 5% strictly sequential. Using Amdahl's law where is the number of processors and the speedup, compute the speedup with GPU cores. Then compute the theoretical maximum speedup as .

Recall Solution

Sequential fraction . With : As , the term : The punchline: 4096 cores buy you , and infinite cores buy only . The tiny serial 5% caps everything. This is why a GPU's raw core count does not translate into raw speedup unless the workload is nearly embarrassingly parallel.

Exercise 4.2 — Crossover point

Suppose a task has independent sub-tasks. CPU: cores at ns each. GPU: cores at ns each (slower cores), plus a fixed launch overhead of . Find the smallest for which the GPU beats the CPU.

Recall Solution

CPU time: . GPU time: . Set and solve for : So the GPU wins for sub-tasks. This is the crossover marked in Figure 2. Why the crossover exists: the GPU pays a fixed launch tax and uses slower cores. Only once the pile of work is big enough does its 4096-way parallelism pay back that tax. Small jobs belong on the CPU — this is the quantitative version of "don't launch a kernel to add two numbers."

Figure 2 plots both times against . Read it like a race: the amber CPU line starts at the origin (no launch tax) and climbs steeply; the cyan GPU line starts high (the tax) but climbs almost flat. Where they cross is the answer to 4.2 — left of it the CPU wins, right of it the GPU.

Figure — GPU vs CPU design philosophy

Figure 2. Crossover of CPU (amber) and GPU (cyan) batch time versus problem size . The white dot at is exactly the break-even point solved in Exercise 4.2. Notice the GPU's flat slope — this is throughput; the CPU's steep slope is what limited latency looks like at scale.


Level 5 — Mastery

Exercise 5.1 — Design your own budget

You have a transistor budget . A simple GPU-style core costs transistors; a complex CPU-style core costs transistors. (a) How many cores of each type can you build if you spend the entire budget on cores? (b) A latency-bound task uses only 1 core but needs 4× the per-core performance a simple core gives; a throughput-bound task has independent sub-tasks. For each task, which chip finishes first? Justify with numbers.

Recall Solution

(a) All-simple: cores. All-complex: cores. The ratio is , exactly as the parent note predicts ().

(b) Latency task uses 1 core. The complex core delivers the 4× single-core performance; the simple core cannot (it is a plain in-order lane). So the 1200-complex-core chip wins here — 11,999 of the 12,000 simple cores would sit idle, useless for a single dependent chain.

Throughput task has independent sub-tasks. Even at slower per-core speed, the 12,000-core chip splits the work more finely: tasks/core vs tasks/core. Assuming the simple core is even up to slower per task it still wins, because . The many-simple-core chip wins.

The mastery point: the same silicon budget produces two opposite machines, and the right choice is dictated entirely by whether your work is one dependent chain or a million independent pieces. That is the GPU-vs-CPU philosophy, reduced to a budgeting problem — the two halves of Figure 1.

Exercise 5.2 — Explain the choice in one sentence each

Match the mechanism to the goal, then state why the alternative would be wrong on that chip: (a) GPU uses hardware threading instead of big caches. (b) CPU uses speculative execution instead of more cores.

Recall Solution

(a) With 1000s of cores, a private cache per core would blow the transistor budget, so the GPU instead keeps many resident warps and swaps a stalled warp for a ready one — hiding DRAM latency with parallelism rather than with memory. A big cache would be the wrong buy: it optimises one thread's latency, which a throughput machine does not care about. See GPU memory hierarchy. (b) A CPU's job is one fast dependent thread, so extra cores it cannot use are wasted silicon; speculation instead raises that single thread's . More cores would be the wrong buy for code that cannot be parallelised — recall the von Neumann sequential fetch-decode-execute chain, and how SIMD vs SIMT handles width differently.


Recall Self-test recap

A GPU beats a CPU only when ::: the work is highly parallel, big enough to pay launch overhead, and has a small serial fraction. The only CPU knob left after the clock wall is ::: IPC (instructions per cycle), raised by branch prediction and out-of-order execution. Occupancy enters as ::: a multiplier on effective core count in the denominator (latency-hiding capacity). When N_tasks is less than P, the speedup is capped at ::: N_tasks (fewer tasks than cores means idle cores). Amdahl's ceiling for a program with serial fraction is ::: , independent of processor count.