, ,

What happens inside a GPU when it runs AI?

Inside an AI GPU: streaming multiprocessors, warps, Tensor Cores and five levels of memory. Follow one AI calculation through an NVIDIA H100, and see why the cores spend most of their time waiting.

Grid of streaming multiprocessors with Tensor Core speed bars

AI Infrastructure series · Part 3 of 24

People say a GPU has “thousands of cores”, but that is only part of the picture. Inside an AI GPU are small processors grouped into units, special cores built only for matrix maths, and five levels of memory from huge and slow to tiny and instant. This post opens up an NVIDIA H100 and follows one AI calculation through it.

Try it: Inside a GPU Lab

Step through one layer of an AI model as it moves from memory to the Tensor Cores and back, then race a server CPU, CUDA cores and Tensor Cores on the same matrix multiply.

Open the demo →

What is inside a GPU?

An H100 is one large chip with about 80 billion transistors, surrounded by stacks of memory on the same package. The chip is organised in layers, like a company: one building, many departments, many workers in each.

GPU PACKAGE HBM3 80 GB total HBM3 3.35 TB/s L2 cache · 50 MB · shared by every SM links the SMs to the HBM memory each grey square is one streaming multiprocessor (SM) · 132 in total, drawn here as a sample

An H100 package, simplified. The GPU chip holds 132 streaming multiprocessors around a shared L2 cache. HBM memory stacks sit beside the chip on the same package.

Here are the main parts of an H100 SXM, from the biggest to the smallest:

PartHow manyWhat it does
HBM3 memory80 GBHolds the model’s weights and working data. Feeds the chip at 3.35 TB/s.
L2 cache50 MBA shared waiting room between HBM and the SMs, so data used twice is fetched once.
Streaming multiprocessors (SMs)132Small processors that each take a share of the work. All run at once.
CUDA cores128 per SM, 16,896 in totalGeneral-purpose maths units, one number at a time.
Tensor Cores4 per SM, 528 in totalUnits built only for multiplying blocks of numbers. They do most of the AI work.
Shared memory and registersup to 228 KB and 256 KB per SMTiny, very fast memory inside each SM, right next to the cores.

What is a streaming multiprocessor?

The SM is the GPU’s real working unit. Think of it as a small processor of its own: it has its own cores, its own fast memory and its own scheduler that decides what runs next. A big job is split into pieces and the pieces are handed out to all 132 SMs, which work on them at the same time.

Inside an SM, work runs in groups of 32 threads called warps. All 32 threads in a warp run the same instruction at the same moment, each on different numbers. That is the trick that makes GPUs efficient: one instruction, decoded once, drives 32 calculations. It is also why GPUs are bad at branchy, decision-heavy code, which part 1 covers.

What are Tensor Cores, and why do they matter for AI?

CUDA cores multiply one pair of numbers at a time. Tensor Cores multiply two small blocks of numbers and add the result, all in a single step. AI models are almost entirely made of these block multiplications, so Tensor Cores do most of the work.

The difference is large. These are the H100 SXM’s published peak speeds, in trillions of operations per second (TFLOPS):

CUDA coresFP32, 32-bit numbers67
Tensor CoresBF16, 16-bit numbers989
Tensor CoresFP8, 8-bit numbers1,979

Two things stand out. Tensor Cores are about 15 times faster than the CUDA cores on the same chip. And they get twice as fast every time the numbers get half as small, from 16-bit to 8-bit. That is one reason AI keeps moving to smaller number formats, which part 18 of this series covers.

How does an AI model turn into GPU work?

An AI model is a stack of layers. Each layer is mostly a few large multiplications: a table of learned weights times the numbers coming in. The program on the CPU turns each of these into a kernel, an instruction for the GPU, and sends it over. Here is what happens to one of them:

1

The CPU launches a kernel. It tells the GPU “multiply this layer’s weights by this input” and moves on to prepare the next one.

2

The work is cut into tiles. The GPU splits the multiplication into hundreds of small tiles and spreads them over all 132 SMs.

3

Weights stream out of HBM. For one layer of an 8B model, about 117 MB of weights flow from HBM, through the L2 cache, towards the SMs.

4

Each SM loads its tile into shared memory. Numbers placed here can be reused many times without going back to HBM.

5

Warps pull numbers into registers. The fastest memory on the chip, right beside the cores.

6

Tensor Cores multiply and add. Each one works through block after block of the tile.

7

Results are written back. The next kernel starts on the next part of the layer. An 8B model has 32 layers, each needing several kernels, for every word it writes.

Real AI software fuses several of these steps into one kernel where it can, so data stays close to the cores for longer. That kind of tuning is a big part of why one serving engine can be much faster than another on the same GPU.

Why does a GPU have so many levels of memory?

Because fast memory is small and big memory is slow. The levels form a ladder, and the art of GPU programming is to fetch each number from the slow top of the ladder once, then use it many times at the fast bottom.

left: biggest and slowestright: smallest and fastest, right next to the cores

The same idea runs through all computing: a CPU has caches for the same reason. What is different in a GPU is the scale. Thousands of cores all want data at once, so every level has to be very wide, and running out of fast memory slows everything down.

What does the CPU do while the GPU works?

The CPU is the manager. It turns your text into tokens, decides which requests to run together, launches the kernels and collects the results. It does very little of the maths.

Launching kernels takes time, and an AI model launches hundreds of them for every word. If the CPU is slow to send them, the GPU sits idle between kernels. Serving engines such as vLLM use a CUDA feature called CUDA Graphs to record a whole sequence of kernels once and replay it with one launch, which removes most of that gap.

Where does the GPU actually spend its time?

Here is the surprise. When an H100 serves one user, the Tensor Cores are idle most of the time. Work out one word of an 8B model in 16-bit:

~0.016 msto do the maths: 16 billion operations at 989 TFLOPS
~4.8 msto read the 16 GB of weights from HBM at 3.35 TB/s
~300×longer spent waiting for memory than calculating

The cores finish their part almost instantly, then wait for the next batch of weights to arrive. That is why serving many users at once is so important: the weights are read once and used for every user in the batch, so the cores have more to do for each byte that arrives. Part 2 showed that memory speed limits AI; the next part explains exactly when it does, and when the maths becomes the limit instead.

Key ideas from this part
  • A GPU is built from streaming multiprocessors (132 on an H100), each a small processor of its own.
  • Threads run in warps of 32, all doing the same instruction on different numbers.
  • Tensor Cores do the block multiplications AI is made of, about 15 times faster than ordinary CUDA cores.
  • Memory comes in levels, from 80 GB of HBM down to registers. Good software reuses each number many times near the cores.
  • For one user, the GPU spends far more time waiting for weights than calculating with them.

Figures are NVIDIA’s published H100 SXM specifications; Tensor Core speeds are dense peaks without sparsity. Timings are upper-limit estimates for a single user.

About The Author


Discover more from Journal of Intelligent Infrastructure

Subscribe to get the latest posts sent to your email.

Leave a Reply

Your email address will not be published. Required fields are marked *

Architect’s Toolkit

About the Author

Dr. Pranay Jha is a Cloud and AI Consultant with 18+ years of experience in hybrid cloud, virtualization, and enterprise infrastructure transformation. He specializes in VMware technologies, multi-cloud strategy, and Generative AI solutions. He holds a PhD in Computer Applications with research focused on Cloud and AI, has published multiple research papers, and has been a VMware vExpert since 2016 and a VMUG Community Leader.

Discover more from Journal of Intelligent Infrastructure

Subscribe now to keep reading and get access to the full archive.

Continue reading