What is a GPU? Complete Architecture, Parallel Computing, and AI Hardware Guide
A Graphics Processing Unit (GPU) is a specialized electronic processor engineered for massive data-parallel throughput. Originally created in the late 1990s to accelerate 3D polygon rendering and pixel shading for video games, modern GPUs have evolved into the primary compute engines behind deep learning, large language models (LLMs), scientific simulations, video transcoding, and cryptographic workloads.
While a Central Processing Unit (CPU) optimizes for low-latency sequential execution across a handful of complex cores, a GPU packs thousands of lightweight arithmetic cores onto a single silicon die to execute the exact same mathematical operation across millions of data elements simultaneously.
CPU vs. GPU Architectural Philosophy
Understanding why GPUs dominate AI and graphics requires comparing how CPUs and GPUs allocate silicon transistors:
| Architectural Dimension | CPU (Central Processing Unit) | GPU (Graphics Processing Unit) |
|---|---|---|
| Core Design Philosophy | Latency-oriented (finish one complex task fast) | Throughput-oriented (finish millions of parallel tasks together) |
| Core Count | 4 to 192 heavy, out-of-order cores | 2,000 to 18,000+ lightweight arithmetic cores |
| Transistor Budget | Large L1/L2/L3 caches, branch predictors, speculative execution | Arithmetic Logic Units (ALUs), Tensor Cores, massive register files |
| Execution Model | MIMD (Multiple Instruction, Multiple Data) | SIMT (Single Instruction, Multiple Threads) |
| Memory Subsystem | DDR5 (50 – 300 GB/s), optimized for low latency | GDDR6X / HBM3e (1,000 – 8,000+ GB/s), optimized for high bandwidth |
| Best Workloads | OS kernels, databases, branching business logic, single-thread I/O | Matrix multiplication (GEMM), 3D rendering, convolutions, physics sims |
CPU Silicon Layout GPU Silicon Layout
+-----------------------------------+ +-----------------------------------+
| [Control] [Branch] | L1 Cache | | [Ctrl] [ALU][ALU][ALU][ALU][ALU] |
| [ Complex ALU ] | | | [Ctrl] [ALU][ALU][ALU][ALU][ALU] |
+--------------------+--------------+ | [Ctrl] [ALU][ALU][ALU][ALU][ALU] |
| Large L2 Cache | | [Ctrl] [ALU][ALU][ALU][ALU][ALU] |
+-----------------------------------+ +-----------------------------------+
| Shared L3 Cache | | Shared L2 Cache & High-Speed |
| (Minimizes Memory Latency) | | HBM / GDDR Memory Controllers |
+-----------------------------------+ +-----------------------------------+
Core Hardware Building Blocks of a Modern GPU
Modern data-center and workstation GPUs (such as NVIDIA Hopper/Blackwell, AMD CDNA/RDNA, and Intel Xe) organize compute and memory into a strict hardware hierarchy:
1. Streaming Multiprocessors (SMs) / Compute Units (CUs)
A GPU die is partitioned into dozens of independent processing blocks called Streaming Multiprocessors (SMs) in NVIDIA terminology (or Compute Units on AMD). Each SM contains:
- CUDA / Shading Cores: Scalar floating-point (
FP32,FP64) and integer (INT32) arithmetic units that execute general-purpose shader and compute instructions. - Tensor Cores / Matrix Cores: Specialized systolic matrix-multiply-accumulate (MMA) engines that compute dense $4 \times 4$ or larger matrix operations (
D = A * B + C) in a single clock cycle acrossFP16,BF16,FP8,INT8, andFP4precisions. - Warp Schedulers & Dispatch Units: Hardware schedulers that switch between stalled and ready thread groups in zero clock cycles to hide memory access latency.
- Register File & Shared Memory (SRAM): Ultra-fast on-chip memory (
128 KB – 256 KBper SM) partitioned between thread registers and programmer-managed L1/shared memory.
2. SIMT Execution Model and Warps
GPUs execute threads using Single Instruction, Multiple Threads (SIMT):
- Threads are grouped into blocks (Thread Blocks), which are assigned to a single SM.
- The SM divides each block into hardware scheduling units of 32 threads called a Warp (or a 64-thread Wavefront on AMD).
- All 32 threads in a warp execute the exact same instruction in lockstep on different array indices.
- When a warp stalls waiting for data from global VRAM, the SM warp scheduler instantly switches execution to another ready warp—keeping arithmetic pipelines saturated at near 100% utilization.
3. GPU Memory Hierarchy (Registers to HBM)
Feeding thousands of cores requires a multi-tiered memory subsystem:
| Memory Tier | Location | Capacity | Bandwidth / Speed | Scope & Lifetime |
|---|---|---|---|---|
| Registers | Inside each SM | ~256 KB per SM | ~100+ TB/s aggregate | Private to a single thread |
| Shared Memory / L1 | Inside each SM | 128 – 256 KB per SM | ~20 – 30 TB/s aggregate | Shared across threads in one block |
| L2 Cache | On GPU silicon die | 40 – 96 MB | ~5 – 12 TB/s | Shared across all SMs on the GPU |
| Global VRAM (GDDR6 / HBM3) | External stacks/chips on package | 8 GB – 192 GB | 500 GB/s – 8 TB/s | Accessible by all SMs and host CPU (via PCIe/NVLink) |
Graphics Rendering vs. GPGPU Compute
GPUs power two primary software pipelines:
- Real-Time Graphics Pipeline (DirectX 12, Vulkan, OpenGL, Metal):
- Vertex Processing: Transforms 3D object coordinates into 2D screen space.
- Rasterization & Ray Tracing: Determines which screen pixels each triangle covers and traces light bounces using dedicated RT Cores.
- Fragment / Pixel Shading: Computes per-pixel lighting, physically based materials (PBR), textures, and anti-aliasing simultaneously across millions of pixels at 60–240+ frames per second.
- General-Purpose GPU Computing (CUDA, ROCm, SYCL, Triton):
- Exposes the GPU's parallel SMs directly to C++, Python, and Rust programs.
- Powers neural network training/inference (PyTorch, JAX, TensorRT), molecular dynamics, fluid simulation, and real-time signal processing.
Writing a Real Parallel GPU Kernel in Python (gpu_vector_matmul.py)
When running code on a GPU, the host CPU allocates device memory, copies input tensors across PCIe, launches thousands of parallel threads via a kernel, and reads back the result.
Install numba and numpy to compile and run a native CUDA kernel directly from Python:
pip install numpy numba
The example below implements a tiled parallel matrix multiplication kernel (C = A @ B) comparing CPU execution against GPU thread blocks:
import math
import time
import numpy as np
from numba import cuda, float32
TILE_SIZE = 16
@cuda.jit
def tiled_matmul_kernel(A, B, C):
"""Multiply matrices A and B into C using on-chip shared memory tiles."""
# Allocate fast on-chip SRAM shared memory per thread block
sA = cuda.shared.array(shape=(TILE_SIZE, TILE_SIZE), dtype=float32)
sB = cuda.shared.array(shape=(TILE_SIZE, TILE_SIZE), dtype=float32)
tx = cuda.threadIdx.x
ty = cuda.threadIdx.y
row = cuda.blockIdx.y * TILE_SIZE + ty
col = cuda.blockIdx.x * TILE_SIZE + tx
acc = 0.0
num_tiles = (A.shape[1] + TILE_SIZE - 1) // TILE_SIZE
for tile_idx in range(num_tiles):
a_col = tile_idx * TILE_SIZE + tx
b_row = tile_idx * TILE_SIZE + ty
# Cooperatively load one tile from slow global VRAM into fast SRAM
sA[ty, tx] = A[row, a_col] if (row < A.shape[0] and a_col < A.shape[1]) else 0.0
sB[ty, tx] = B[b_row, col] if (b_row < B.shape[0] and col < B.shape[1]) else 0.0
# Synchronize all threads in the block before computing
cuda.syncthreads()
for k in range(TILE_SIZE):
acc += sA[ty, k] * sB[k, tx]
cuda.syncthreads()
if row < C.shape[0] and col < C.shape[1]:
C[row, col] = acc
def run_benchmark(size: int = 2048) -> None:
if not cuda.is_available():
raise RuntimeError("No CUDA-capable GPU detected on this system.")
rng = np.random.default_rng(42)
h_A = rng.standard_normal((size, size), dtype=np.float32)
h_B = rng.standard_normal((size, size), dtype=np.float32)
# Transfer host arrays to GPU VRAM
d_A = cuda.to_device(h_A)
d_B = cuda.to_device(h_B)
d_C = cuda.device_array((size, size), dtype=np.float32)
threads_per_block = (TILE_SIZE, TILE_SIZE)
blocks_per_grid = (
math.ceil(size / TILE_SIZE),
math.ceil(size / TILE_SIZE),
)
# Warm-up JIT compilation
tiled_matmul_kernel[blocks_per_grid, threads_per_block](d_A, d_B, d_C)
cuda.synchronize()
# Measure GPU kernel execution
t0 = time.perf_counter()
tiled_matmul_kernel[blocks_per_grid, threads_per_block](d_A, d_B, d_C)
cuda.synchronize()
gpu_ms = (time.perf_counter() - t0) * 1000
h_C = d_C.copy_to_host()
np.testing.assert_allclose(h_C, h_A @ h_B, rtol=1e-3, atol=1e-3)
print(f"GPU Tiled MatMul ({size}x{size}) completed in {gpu_ms:.2f} ms")
if __name__ == "__main__":
run_benchmark(2048)
Integrated vs. Discrete vs. Data Center GPUs
| GPU Category | Form Factor & Power | Memory Architecture | Primary Use Cases |
|---|---|---|---|
| Integrated GPU (iGPU) | Shares silicon die with CPU (15W – 45W) | Shares system LPDDR5/DDR5 RAM | Display output, lightweight UI rendering, video decode, edge inference |
| Consumer / Workstation Discrete GPU | PCIe add-in card (150W – 600W) | Dedicated GDDR6 / GDDR6X (8 – 48 GB) | 3D gaming, CAD, video editing, local LLM inference & QLoRA fine-tuning |
| Data Center AI Accelerator | SXM / OAM module (400W – 1,200W+) | Stacked HBM3 / HBM3e (80 – 192 GB) + NVLink | Foundation model pretraining, high-concurrency LLM serving, HPC |
Key GPU Specifications Explained
When evaluating a GPU for AI, graphics, or scientific workloads, four metrics matter most:
- VRAM Capacity (GB): Determines the maximum model parameter size, batch size, KV cache context length, or 4K/8K texture pool that fits on-device without falling back to slow system RAM.
- Memory Bandwidth (GB/s or TB/s): Measures how rapidly bytes move between VRAM and SMs. LLM token generation and element-wise activations are almost always memory-bandwidth-bound.
- Peak Compute Throughput (TFLOPS / TOPS): Measures raw arithmetic operations per second at specific precisions (
FP32,BF16,FP8,INT4). Dense matrix multiplications and training loops are compute-bound. - Interconnect Bandwidth (PCIe Gen5 vs. NVLink): Controls multi-GPU scaling speed when sharding large models across multiple devices using Tensor Parallelism.
Common Misconceptions About GPUs
- Assuming a GPU automatically speeds up any Python script: Sequential loops, string parsing, file I/O, and small arrays (
< 10,000elements) run slower on a GPU because copying data over PCIe takes longer than executing the math on the CPU. - Comparing CPU clock speed (GHz) directly to GPU clock speed: A GPU running at
1.8 GHzwith 10,000 cores delivers vastly higher parallel throughput than a5.5 GHzCPU with 16 cores. - Ignoring precision formats (
FP32vs.BF16/FP8): Modern GPUs achieve 4x to 16x higher TFLOPS on Tensor Cores usingBF16orFP8compared to legacyFP32scalar cores.
Summary
A GPU achieves extraordinary computational throughput by trading single-thread latency optimizations for thousands of parallel cores, zero-overhead warp scheduling, on-chip shared memory, and ultra-wide HBM/GDDR memory buses. Whether rendering photorealistic 3D scenes or multiplying billion-parameter transformer matrices, the GPU acts as the foundational parallel processor of modern computing.