GPU vs CPU design philosophy
Overview
The fundamental difference between GPU (Graphics Processing Unit) and CPU (Central Processing Unit) design philosophy reflects two radically different approaches to computation: latency optimization versus throughput optimization. Understanding this distinction is critical to modern computing architecture.

CPU Design Philosophy: Minimize Latency
Why CPUs Are Built This Way
Derivation of CPU design priorities from first principles:
-
Starting assumption: General-purpose code has data dependencies
- Instruction often depends on result from
- Can't parallelize what must be sequential
-
Implication: Need to execute sequential code FAST
- If task time (n instructions, each taking )
- Only way to reduce is reduce
-
How to reduce ?
- Memory latency dominates: DRAM access ≈ 100ns vs compute ≈ 1ns
- Solution: Add large L1/L2/L3 caches (up to 64MB on modern CPUs)
- Cache hit reduces memory access from 100ns to 1-4ns
-
Control flow unpredictability
- Branches occur every 5-7 instructions on average
- Wrong branch = pipeline flush = wasted cycles
- Solution: Branch predictor (>95% accuracy) + speculative execution
-
Instruction-level parallelism (ILP)
- Even in sequential code, independent instructions exist
- Solution: Out-of-order execution finds and runs independent instructions simultaneously
CPU Die Area Budget
Let's derive how a modern CPU uses its transistor budget:
Total transistors≈ 10-20 billion (e.g., Intel Core i9)
- Compute cores: 8-16 cores × 0.5B transistors = 4-8B (compute + local logic)
- Each core: ALUs, FPUs, registers
- Cache hierarchy (SRAM, ~6 transistors/bit):
- L1: 32KB × 16 cores = 512KB
- L2: 256KB × 16 cores = 4MB
- L3: 32MB (shared)
- Total SRAM ≈ 36.5MB →
- Control logic: 3-4B transistors
- Branch predictors, instruction schedulers, memory controllers
Key observation: A large share of the die area is spent on caches and control logic to serve a single thread quickly — only a modest fraction does actual arithmetic. (Note: transistor count and die area differ, because SRAM cells are dense but numerous; the design intent is clear — CPUs "pay" heavily for latency reduction.)
GPU Design Philosophy: Maximize Throughput
Why GPUs Are Built This Way
Derivation from graphics workload:
-
Starting assumption: Graphics requires operating on millions of pixels/vertices independently
- Pixel color calculation doesn't depend on pixel
- Embarrassingly parallel workload
-
Implication: Can run thousands of tasks simultaneously
- If we have independent tasks, total time:
- Where = number of parallel processors
- To minimize , maximize (even if increases!)
-
Design constraint: Fixed transistor budget
- Simple core: transistors
- Complex core: (due to cache, control logic) Number of cores:
-
Handling memory latency without caches
- Cache per core too expensive at 1000s of cores
- Solution: Hardware threading (warp scheduling)
- When a warp waits for memory, instantly switch to another ready warp
- Need many resident warps — often dozens of warps (hundreds to ~2048 threads) per SM — to fully hide hundreds of cycles of DRAM latency
-
Branch divergence problem
- No branch predictor → wrong branches are expensive
- Solution: SIMT (Single Instruction Multiple Threads)
- All threads in a warp (32 threads) execute same instruction
- If branches diverge, serialize execution (performance loss)
GPU Die Area Budget
Total transistors ≈ 50-80 billion (e.g., NVIDIA A100)
- Compute cores: thousands of CUDA cores → the majority of the compute-oriented transistor budget
- Vastly more transistors doing actual math than a CPU
- Cache (SRAM, ~6 transistors/bit): ~40MB total across entire chip
- — small relative to the whole chip, and tiny per-core
- Control logic: warp schedulers, memory controllers
- NO branch predictors, NO out-of-order logic
Key observation: Compared to a CPU, a far larger share of the GPU is dedicated to arithmetic units rather than to caches and speculative control logic.
The Fundamental Tradeoffs
| Characteristic | CPU | GPU | Why? |
|---|---|---|---|
| Core count | 8-64 | 1000s-10000s | Transistor budget trade-off |
| Core complexity | Very high | Very low | Latency vs. throughput |
| Cache per core | MB-scale | KB-scale | Area constraint |
| Clock speed | 3-5 GHz | 1-2 GHz | Power/thermal limits at scale |
| Threading | 1-2 per core | dozens of warps per SM | Latency hiding mechanism |
| Branch handling | Prediction + speculation | Divergence serialization | Control complexity cost |
| Best workload | Sequential, unpredictable | Parallel, regular | Design optimization target |
When to Choose What
CPU-optimal tasks:
- Operating system kernels (unpredictable, I/O-heavy)
- Database query planning (sequential decision tree)
- Compilation (complex, data-dependent)
- Web serving (latency-sensitive, irregular)
GPU-optimal tasks:
- Graphics rendering (millions of independent pixels)
- Deep learning training (matrix multiplications, highly parallel)
- Scientific simulations (PDEs on regular grids)
- Cryptography (hash millions of candidates independently)
Hybrid approach (modern reality):
- Use CPU for control logic, task scheduling, preprocessing
- Offload parallel kernels to GPU
- Example: Video encoding uses CPU for scene analysis, GOP structure; GPU for motion estimation, DCT transforms
Recall Explain to a 12-year-old
Imagine you need to solve 1000 math problems for homework. You have two choices:
Choice 1 (CPU): Your super-smart tutor who knows every trick. They can solve each problem in 6 seconds by using shortcuts, remembering similar problems, and guessing what's coming next. Total time: 1000 × 6s = 100 minutes.
Choice 2 (GPU): A classroom with 500 first-graders. Each one is slower—takes 10 seconds per problem because they don't know shortcuts. But working together, they solve 500 problems at once! Total time: (1000 ÷ 500) × 10s = 20 seconds!
The catch? The problems must be similar and independent. If each problem depends on the previous answer, only the tutor can help—the first-graders would just sit around waiting!
Connections
- 6.1.01-von-Neumann-architecture — CPUs extend this; GPUs break from it (Harvard-style separate instruction/data paths)
- 6.2.02-CUDA-programming-model — How software exposes GPU's parallel philosophy
- 6.2.03-memory-hierarchy-GPU — How GPU caching strategy differs from CPU
- 6.3.01-SIMD-vs-SIMT — The instruction-level parallel execution model
- 9.1.02-Amdahls-law — Mathematical limit on parallel speedup
- 9.2.01-parallel-programming-models — Software patterns matching CPU vs GPU strengths
#flashcards/hardware
What is the fundamental design difference between CPU and GPU? :: CPU optimizes for latency (minimize time for single task) using complex control logic, large caches, branch prediction. GPU optimizes for throughput (maximize tasks per second) using thousands of simple cores and hardware threading.
Derive why GPUs have 10× more cores than CPUs from transistor budget :: If simple core costs transistors and complex core (with cache, branch prediction) costs , then with fixed budget : GPU has cores while CPU has cores.
What is arithmetic intensity and why does it matter? :: . GPU has high compute-to-bandwidth ratio (~10-100 ops/byte). If workload's is lower, it's memory-bound and GPU advantage disappears. Example: vector addition has (1 op, 12 bytes) = memory-bound.
State Amdahl's Law and its implication :: where
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Chalo ek simple si baat samajhte hain. CPU aur GPU dono computation karte hain, lekin dono ka soch bilkul alag hai. CPU ek master chef jaisa hai jo har dish perfectly bana sakta hai, par ek time pe ek hi customer ko serve karta hai. Uska pura design isliye bana hai ki ek single task jaldi se jaldi khatam ho jaye. Isko hum bolte hain latency optimization — matlab ek kaam ka time kam karna. Isiliye CPU mein bade-bade caches, branch prediction, aur out-of-order execution hota hai, taaki jab tumhara code ek line ke baad doosri line pe depend karta hai (data dependency), tab bhi speed maintain rahe.
GPU ka approach ekdum ulta hai. Ye ek cafeteria jaisa hai jisme 100 chote-chote stations hain, har station ek simple cheez banata hai. Ek order thoda slow ho sakta hai, par ek saath hazaron log serve ho jaate hain. Yahi hai throughput optimization — matlab per second kitne kaam complete ho sakte hain. GPU mein hazaron simple cores hote hain, minimal caching, no branch prediction, in-order execution. Ye tab kaam aata hai jab tumhare paas bahut saare independent tasks ho jo saath-saath chal sakein, jaise image processing ya deep learning matrices.
Ab ye samajhna kyun zaroori hai? Kyunki modern computing — jaise AI, gaming, aur scientific simulations — mein tumhe dono cheezon ka combination chahiye. Agar tum jaan lo ki tumhara problem sequential hai (ek step doosre pe depend karta hai), toh CPU better hai. Aur agar problem parallel hai (bahut saare same-type kaam ek saath), toh GPU jeet jaata hai. Yeh design philosophy samajhne se tum sahi hardware choose kar paoge aur apne code ko sahi tarike se optimize kar paoge. Isi liye die area budget bhi dono mein alag hota hai — CPU apna zyada area cache aur control logic pe kharch karta hai, jabki GPU seedha arithmetic power pe.