Pidoku

From Pixels to Tensors

Module 2 Lesson 2.h 35 min Difficulty 2/5

Prerequisites 2.g

The idea in one minute#

GPUs were invented to draw video-game frames. Drawing a frame means running the same small calculation for millions of pixels, sixty times a second. Neural networks turned out to need exactly the same thing: the same small calculation over millions of numbers. The hardware built for games was, almost by accident, the right hardware for AI.

Knowing the history explains why GPU vocabulary (shaders, textures, kernels) and GPU design (massive parallel arithmetic, huge memory bandwidth) look the way they do.

A picture#

flowchart LR
  A["1990s<br/>Fixed-function<br/>3D cards"] --> B["2001<br/>Programmable<br/>shaders"]
  B --> C["2006<br/>CUDA: general<br/>purpose GPU"]
  C --> D["2012<br/>AlexNet trained<br/>on two GPUs"]
  D --> E["2017<br/>Tensor cores<br/>and transformers"]
  E --> F["2022<br/>Hopper: FP8,<br/>ChatGPT era"]
  F --> G["2024–25<br/>Blackwell: FP4,<br/>72-GPU racks"]
  G --> H["2026<br/>Rubin: HBM4,<br/>inference-first chips"]
  class A,B neutral
  class C,D compute
  class E,F,G,H io

How it really works#

Step 1: graphics is a parallel problem#

To draw a 3D scene, a GPU runs a pipeline:

flowchart LR
  V["Vertices<br/>3D points"] --> VS["Vertex shader<br/>move each point"]
  VS --> R["Rasterizer<br/>which pixels does<br/>each triangle cover"]
  R --> FS["Fragment shader<br/>colour each pixel"]
  FS --> FB[("Framebuffer<br/>the image")]
  class V,FB memory
  class VS,FS compute
  class R neutral

A 4K frame has 8.3 million pixels. Each pixel’s colour depends on its own inputs and on read-only data (textures, lights) — never on a neighbouring pixel’s result. So all of them can be computed at once. That property has a name: the work is data-parallel.

Step 2: shaders made GPUs programmable#

Early cards had the maths hard-wired. Around 2001 they began accepting small programs — shaders — that ran once per vertex or per pixel. A shader is a tiny function applied to millions of independent elements. That is a kernel in everything but name.

Researchers noticed, and started disguising scientific calculations as “drawing” to borrow the speed.

Step 3: CUDA removed the disguise#

In 2006 NVIDIA released CUDA: a way to write those per-element functions in ordinary C and run them on arrays of numbers, no graphics involved. This is GPGPU — general-purpose GPU computing. Open alternatives followed (OpenCL, later Vulkan compute, Metal, WebGPU), but CUDA’s libraries and tooling made it the default for scientific and AI work, and it still is.

Step 4: neural networks are matrix multiplication#

A neural network layer computes output = activation(W · input). The expensive part is the matrix multiply: every output number is a sum of products, and no output depends on another. Data-parallel again.

In 2012 a network called AlexNet, trained on two gaming GPUs, won the ImageNet image recognition contest by a wide margin. Training that would have taken months on CPUs took days. The field switched to GPUs almost overnight.

Step 5: GPUs redesigned for AI#

Since then the design has bent toward AI, and in the 2020s toward inference in particular:

  • Tensor cores (2017): circuits that do nothing but small matrix multiplies at reduced precision. They multiplied AI speed again by 4–8x (4.f).
  • Ever-smaller number formats: FP16 and BF16, then FP8 (Hopper, 2022), then FP4 with per-block scaling (Blackwell, 2024–25). Each halving roughly doubles arithmetic speed and halves the bytes per weight (10.k).
  • High-bandwidth memory (HBM): language models are limited by how fast weights can be read (2.e), so memory speed became as important as arithmetic — from 2 TB/s (A100) to about 22 TB/s per GPU with HBM4 on Rubin (4.e, 7.e).
  • Fast GPU-to-GPU links: models outgrew one GPU, then one server. NVLink now joins 72 GPUs in a rack into one domain (7.d, 9.c).
  • Chips built only for AI: Google’s TPU (since 2015), AWS Trainium, and SRAM-based decode chips such as Groq’s, which NVIDIA licensed in late 2025 (Module 7). Not all of them are GPUs, but they follow the same principle: lots of parallel matrix maths fed by lots of memory bandwidth.

A modern data-center “GPU” often has no display output at all. The name stuck; the job changed.

Vocabulary that survives from graphics#

Graphics wordMeans in general computing
ShaderKernel: a function run per element
TextureRead-only array sampled by the kernel
FramebufferOutput array
VRAM (video RAM)GPU memory

Remember this#

  • Graphics and neural networks share one property: huge numbers of independent, identical calculations.
  • CUDA (2006) made that parallel hardware usable for any computation.
  • AlexNet (2012) proved GPUs transform deep learning; hardware has specialised for AI ever since.
  • Since 2022 the specialisation has been for inference: lower-precision formats, more memory bandwidth, rack-scale links and dedicated inference chips.
  • A data-center GPU today is an AI accelerator that kept its old name.

Try it#

  1. A 4K frame at 60 frames per second: how many pixel calculations per second? Compare that to a language model with 8 billion weights producing 50 tokens per second, touching each weight once per token.
  2. Write a function shade(x, y) (in any language) that returns a colour from the pixel coordinates only, for example a gradient. Render a 1920×1080 image with one thread per row. Why is no locking needed?

Check yourself#

  1. What does “data-parallel” mean?
  2. Why did shaders make GPUs interesting to scientists?
  3. Which hardware features were added to GPUs specifically because of AI, and which of them matter most for inference?

Sources#

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in