MODULE 10  ยท  GPU & Hardware

GPU Architecture Basics: Why GPUs Are AI's Engine

Your CPU has 8 cores. Maybe 16. A single NVIDIA H100 has 16,896 CUDA cores and 528 Tensor Cores. Here's why that matters.

๐Ÿ“… Mar 2026
โฑ 10 min read
๐ŸŽฏ Episode 64 of 98
GPU ArchitectureCUDATensor CoresHardware
In this episode

Your CPU has 8 cores. Maybe 16 if you're fancy. A single NVIDIA H100 GPU has 16,896 CUDA cores and 528 Tensor Cores.

But it's not just about the number of cores. CPUs and GPUs are fundamentally different machines, designed for fundamentally different problems. A CPU is a Swiss Army knife โ€” versatile, precise, handles anything. A GPU is a combine harvester โ€” does one thing (parallel math) and does it at a scale that makes CPUs look like hand tools.

Understanding GPU architecture isn't just academic. It explains why quantization works, why batching matters, why tensor parallelism exists, and why an H100 costs $30,000. Every optimization we've covered in this series traces back to the hardware.

CPU vs GPU: The Fundamental Difference

CPU: Few Cores, Very Smart

A CPU core is a general-purpose computing marvel. It handles:

Branch prediction (guessing which if statement path to take)

Out-of-order execution (reordering instructions for speed)

Complex cache hierarchies (L1, L2, L3)

Virtual memory management

Interrupt handling

Each core is like a PhD mathematician โ€” can solve any problem, handles complex logic, works independently.

GPU: Thousands of Cores, Simple Each

A GPU core (CUDA core) does one thing: multiply and add numbers. That's it. No branch prediction. Minimal cache. Limited control flow. But there are thousands of them, all working simultaneously.

Each core is like a factory worker doing one repetitive task โ€” simple but incredibly fast when thousands work in parallel.

Task: Multiply two 4096ร—4096 matrices

CPU (16 cores):

Each core handles a section of the matrix

Serial inner loops, complex scheduling

Time: ~500ms

GPU (16,896 CUDA cores):

Each core handles a tiny piece

Massively parallel, simple math

Time: ~2ms

GPU is 250x faster at this specific task.

Why AI Needs GPUs

AI is almost entirely matrix multiplication:

Forward pass: output = input ร— weights + bias (matrix multiply)

Attention: scores = Q ร— K^T (matrix multiply)

example
code
output = scores ร— V                 (matrix multiply)

Backward pass: gradients = error ร— weights^T (matrix multiply)

A single transformer forward pass for a 70B model involves thousands of matrix multiplications. This is the most parallelizable workload in computing โ€” perfect for GPUs.

โšก

NVIDIA GPU Architecture: Inside the Chip

Let's break down what's inside an H100:

The Hierarchy

GPU Chip (H100)

โ””โ”€โ”€ 132 Streaming Multiprocessors (SMs)

example
code
โ””โ”€โ”€ Each SM contains:
            โ”œโ”€โ”€ 128 CUDA Cores (FP32)
            โ”œโ”€โ”€ 4 Tensor Cores (4th gen)
            โ”œโ”€โ”€ 64 INT32 cores
            โ”œโ”€โ”€ 256 KB Register File
            โ”œโ”€โ”€ 256 KB L1 Cache / Shared Memory
            โ””โ”€โ”€ Warp schedulers (4 per SM)

Streaming Multiprocessor (SM)

The SM is the fundamental compute unit. Think of it as a mini-processor. The H100 has 132 SMs, each operating semi-independently.

Key concept: warps. The GPU groups 32 threads into a warp. All 32 threads in a warp execute the same instruction at the same time (SIMT โ€” Single Instruction, Multiple Threads). This is why GPUs love uniform computation and hate branching.

snippet
code
Warp (32 threads):

Thread 0: multiply a[0] ร— b[0]

Thread 1: multiply a[1] ร— b[1]

Thread 2: multiply a[2] ร— b[2]

...

Thread 31: multiply a[31] ร— b[31]

All 32 multiplications happen SIMULTANEOUSLY in one clock cycle.

CUDA Cores vs Tensor Cores

This is the most important distinction for AI:

CUDA Cores โ€” General-purpose floating point units. Each performs one multiply-add per clock cycle:

CUDA Core: a ร— b + c = result (1 operation per clock)

Tensor Cores โ€” Specialized matrix multiply units. Each performs a 4ร—4 matrix multiply-accumulate per clock cycle:

Tensor Core: A[4ร—4] ร— B[4ร—4] + C[4ร—4] = D[4ร—4] (64 operations per clock!)

That's 64x more operations per clock for matrix math. This is why Tensor Cores dominate AI workloads:

Core Type FP16 Performance (H100) Use Case

CUDA Cores ~130 TFLOPS General compute, non-matrix ops

Tensor Cores ~990 TFLOPS Matrix multiply (attention, FFN)

Tensor Cores are why NVIDIA owns the AI market. They're purpose-built for the exact operation AI needs most.

๐Ÿ”ง

Memory Architecture: Where the Real Bottleneck Lives

GPU compute is fast. Getting data to the compute units is the bottleneck. This is the memory wall โ€” and it's the most important concept in AI hardware.

The Memory Hierarchy

Register File: Fastest 256 KB per SM ~20 TB/s bandwidth

โ†“

L1 Cache/SMEM: Fast 256 KB per SM ~20 TB/s bandwidth

โ†“

L2 Cache: Medium 50 MB (shared) ~12 TB/s bandwidth

โ†“

snippet
code
HBM3 (VRAM):       Slow       80 GB             3.35 TB/s bandwidth

โ†“

PCIe/NVLink: Slowest Host โ†” GPU 64-900 GB/s

HBM: High Bandwidth Memory

GPU VRAM isn't regular RAM. It's HBM (High Bandwidth Memory) โ€” stacked memory chips physically mounted on top of the GPU die:

Regular DDR5 RAM: ~50 GB/s bandwidth

HBM3 (H100): 3,350 GB/s bandwidth (3.35 TB/s)

HBM3e (H200): 4,800 GB/s bandwidth (4.8 TB/s)

67x more bandwidth than regular RAM. This is what makes GPUs fast for AI โ€” not just compute, but the ability to feed data to the compute units fast enough.

Why Memory Bandwidth Matters

During inference, the model weights must be read from VRAM for every forward pass:

snippet
code
Model: Llama 3 70B in FP16 = 140 GB of weights

Each token generation:

At 3.35 TB/s bandwidth (H100):

snippet
code
Time to read weights = 140 GB / 3,350 GB/s = 0.042 seconds

โ‰ˆ 24 tokens/second (memory-bound!)

The Tensor Cores could compute MUCH faster,

but they're waiting for data from memory.

This is why inference for large models is memory bandwidth-bound, not compute-bound. The Tensor Cores sit idle most of the time, waiting for weights to arrive from HBM.

๐Ÿ“Š

The GPU Generations That Matter

GPU Year VRAM Bandwidth FP16 Tensor Key Feature

V100201732 GB HBM2900 GB/s125 TFLOPSFirst Tensor Core GPU
A100202080 GB HBM2e2,039 GB/s312 TFLOPSTF32, MIG
H100202280 GB HBM33,350 GB/s990 TFLOPSFP8, Transformer Engine
H2002024141 GB HBM3e4,800 GB/s990 TFLOPSMore memory + bandwidth
B2002024192 GB HBM3e8,000 GB/s2,250 TFLOPS2x everything
GB200 NVL72202413.5 TB totalโ€”720 PFLOPS FP4Full rack system

The generational jumps are massive โ€” each generation roughly doubles both memory bandwidth and compute. This is why a 2-year-old GPU feels ancient in AI.

Precision Formats: Why FP8 and FP4 Exist

GPUs support multiple number formats, and newer GPUs add lower-precision formats specifically for AI:

Format Bits Range Tensor Core Support Use Case

FP32 32 ยฑ3.4ร—10ยณโธ All GPUs Training (master weights)

TF32 19* ยฑ3.4ร—10ยณโธ A100+ Training (Tensor Core default)

FP16 16 ยฑ65,504 V100+ Mixed precision training

BF16 16 ยฑ3.4ร—10ยณโธ A100+ Training (preferred)

FP8 8 ยฑ448 (E4M3) H100+ Inference, some training

INT8 8 -128 to 127 All Quantized inference

INT4 4 -8 to 7 H100+ Quantized inference

FP4 4 โ€” B200 Heavily quantized inference

*TF32 uses 19 bits total but has FP32 range with FP16 mantissa precision.

snippet
code
Now you understand why quantization (Episode 12) works โ€” the hardware literally supports running models at lower precision. FP16 on Tensor Cores gives you 2x the throughput of FP32. FP8 doubles again. INT4 doubles again. Each lower precision means more operations per second and less memory for weights.

70B model memory:

FP32: 280 GB (doesn't fit on any single GPU)

FP16: 140 GB (fits on H200)

FP8: 70 GB (fits on A100/H100 80GB)

INT4: 35 GB (fits on consumer RTX 4090 24GB โ€” close)

๐Ÿ’ก

NVLink and GPU Interconnects

When one GPU isn't enough, you need to connect multiple GPUs. The interconnect speed determines how well multi-GPU setups work:

Interconnect Bandwidth Use Case

PCIe Gen564 GB/s (per direction)CPU โ†” GPU, budget multi-GPU
NVLink 4 (H100)900 GB/s (total)Multi-GPU within a node
NVLink 5 (B200)1,800 GB/sNext-gen multi-GPU
NVSwitchFull mesh connectivity8 GPUs all-to-all
InfiniBand NDR400 Gb/s per portMulti-node (across servers)

NVLink is 14x faster than PCIe. This is why NVIDIA's DGX systems (with NVLink) vastly outperform DIY multi-GPU setups (with PCIe).

Tensor Parallelism (splitting model across GPUs):

snippet
code
With NVLink: 900 GB/s โ†’ minimal overhead โ†’ scales well
With PCIe:    64 GB/s โ†’ massive overhead โ†’ doesn't scale

This is why you can't just buy 8 consumer GPUs and get the same performance as a DGX โ€” the interconnect bottleneck kills performance.

๐Ÿ”ฌ

The CUDA Software Stack

NVIDIA's dominance isn't just hardware โ€” it's the software ecosystem:

Your AI code (PyTorch)

example
code
โ†“
snippet
code
cuDNN (deep learning primitives)
โ†“
cuBLAS (matrix operations)
โ†“

CUDA Runtime

example
code
โ†“

CUDA Driver

example
code
โ†“

GPU Hardware

cuBLAS โ€” Optimized matrix multiply library. Years of hand-tuned kernels for every GPU generation.

cuDNN โ€” Deep learning primitives (convolution, attention, normalization). Used by PyTorch and TensorFlow internally.

CUDA โ€” The programming model. Write code that runs on thousands of GPU threads.

This software stack represents 15+ years of investment. AMD (ROCm) and Intel (OneAPI) are catching up, but NVIDIA's software moat is deep.

๐Ÿ›ก๏ธ

Practical Takeaways

GPUs beat CPUs at AI because of massive parallelism โ€” thousands of cores doing matrix math simultaneously

Tensor Cores are the key innovation โ€” 64 operations per clock for matrix multiply, 8x faster than CUDA cores for AI

Memory bandwidth is usually the bottleneck โ€” inference is limited by how fast you can read weights from VRAM, not compute

snippet
code
Lower precision = more speed โ€” FP16 doubles throughput over FP32, FP8 doubles again โ€” hardware natively supports it

Interconnects matter for multi-GPU โ€” NVLink (900 GB/s) vs PCIe (64 GB/s) is a 14x difference

NVIDIA's moat is software + hardware โ€” CUDA, cuBLAS, cuDNN represent 15 years of optimization

๐Ÿ“ฆ

What's Next?

Episode 65: VRAM Math โ€” How do you calculate if a model fits in your GPU? Bytes per parameter, KV cache memory, batch size impact. A practical formula you'll use every day as an AI engineer.

โ† Previous

Ep 63: What's Next in AI

Next โ†’

Ep 65: VRAM Math

Next: Episode 65 โ€” VRAM Math

Every AI engineer asks: will this model fit on my GPU? Here's how to calculate it yourself โ€” in your head, in 30 seconds.

This is part of a 98-episode series covering AI engineering from tokens to production deployment.

โ† Previous Ep 63: What's Next in AI: Where This Is All Heading