Concepts / Memory Hierarchies in Computer Architecture

Memory Hierarchies in Computer Architecture

If they are, memory bandwidth is the constraint.

  • Programming

Two Questions Behind an Accelerator Spec

Imagine two accelerator chips are advertised with very large numbers, and you must choose one for a model that has to answer user requests quickly. The printed figures tell you something, but not everything. Two questions matter most. The first is how many arithmetic operations the chip can complete each second. The second is how quickly it can feed data to the processing units that perform those operations. This article takes those two questions in turn, so that you can read an accelerator specification with the right questions in mind.

The two questions are linked. A chip with enormous arithmetic capacity still delivers little if its data arrives late. Reading a spec well means asking how the compute figure and the memory figures interact inside the full system the accelerator belongs to.

Reading FLOP/s Figures

Definition

FLOP/s, also written FLOPS, stands for floating-point operations per second. It is the most common unit for expressing a chip's computational capability. A floating-point operation is an arithmetic step, such as an addition or a multiplication, performed on numbers stored in floating-point form. Because the unit is a rate, the time component is built into it.

Scale matters when reading these figures. Modern accelerators are quoted in teraFLOP/s, where one tera is a trillion. A figure in the hundreds or thousands of teraFLOP/s therefore describes hundreds of trillions up to quadrillions of operations every second. A number like that is only meaningful when you also know which precision format it was measured with, and the next section explains why.

How Precision Changes Throughput

Numerical precision is the amount of detail used to represent each number during computation. A format that stores more detail needs more bits per value, and the circuitry that handles those bits does more work for each operation. Compare adding two 32-bit numbers with adding two 16-bit numbers. The 32-bit addition has more bits to process, so a chip running at a fixed rate completes fewer 32-bit operations than 16-bit operations in the same interval.

What do you think happens?

If the same chip switches from a 32-bit format to a 16-bit format, will it complete exactly twice as many operations per second?

Reveal answer
Answer:

No. The relationship is not a clean factor of two.

Fewer bits per value generally means more operations per second, but chip designers optimize different formats differently, so the change is not a fixed multiplier.

Read a table of throughput figures as a pattern rather than a list to memorize. Formats with fewer bits per value tend to appear with larger throughput figures. Some formats can also share the same listed figure even though they lay out their bits differently. The practical lesson is that a throughput number is comparable to another only when both were measured at the same precision.

Best practice

When comparing two accelerators, first confirm that both figures use the same precision format. A FLOP/s number at one precision says nothing directly about a number at another precision.

Tracing Data to the Cores

A GPU contains many cores that operate in parallel. Each core needs operands to compute on, and those operands usually reside in memory outside the cores. Data must therefore travel from memory to the cores at a rate that keeps them busy. AI workloads make this demanding, because models contain large weight matrices and training passes through large volumes of data.

Follow one workload step by step. Operands start in memory. They move toward the processing units. The cores perform arithmetic on them. Results are produced and the next operands are requested. At each handoff, the question is whether the next item is already in place. If data arrives more slowly than the cores can consume it, the cores sit idle, and the chip's compute capacity goes unused no matter what its peak figure says.

Bandwidth or Compute: Which Runs Out First

To decide which resource limits a workload, ask a sequence of questions. The diagram below turns that reasoning into a decision path. Start with the workload. Then ask whether the cores are waiting for operands. If they are, memory bandwidth is the constraint. If the data keeps up, the processing units themselves set the limit.

AcceleratorworkloadDo cores wait foroperands?Memory bandwidthlimitsdata arrives too slowlyCompute throughputlimitsdata arrives on timeyesno
For a given accelerator workload, does the chip stall waiting for data, or is the arithmetic itself the bottleneck?
Worked example

Reasoning About a Model That Must Answer Quickly

A model must answer user requests quickly, and you are comparing two accelerators. Decide which resource is more likely to limit the workload. This example uses no measured numbers; it shows the reasoning.

  1. 1
    Locate the working data

    Identify where the model's weights and activations sit at each step, since the accelerator works across a hierarchy of memory levels with different sizes and speeds.

  2. 2
    Check the size

    If fast memory is too small to hold the weights, data is shuffled in and out repeatedly, which pushes the workload toward being limited by data movement.

  3. 3
    Check the transfer

    If the memory is large but transfers slowly, cores wait for operands even when they have capacity to spare.

  4. 4
    Decide the limit

    If the cores regularly wait for data, memory bandwidth is the likely constraint. If data keeps pace with the cores, compute throughput is the likely constraint.

Result

The workload's bottleneck is found by asking where the data sits and how fast it moves, not by reading the peak FLOP/s figure alone.

Memory Size and Bandwidth

An accelerator's memory is described by two numbers. Size is how much data the memory can hold. Bandwidth is how fast that data can be moved. Neither number is meaningful alone. A large memory with slow transfer leaves cores waiting. A fast memory that is too small to hold the model's weights forces data to be shuffled in and out repeatedly. Both figures must be read within the full system.

GPU memory must provide high bandwidth, meaning a large amount of data moved per unit time, and low latency, meaning a short delay before a requested item begins to arrive. Meeting both requirements calls for more advanced memory technology than the memory typically attached to a CPU. That engineering is one reason GPU memory costs more than CPU memory.

The accelerator also does not talk to a single memory. It works with a hierarchy of memory levels, each with its own size and speed, and data passes between those levels as the computation proceeds. When assessing a chip, ask where the working data sits at each step and how quickly it can move between those locations.

DDR SDRAM Versus HBM

DDR SDRAM is the kind of memory typically attached to a CPU. HBM is the memory technology that GPUs favor. The reason is the demand described above. Because a GPU runs many cores in parallel, its memory must supply data with high bandwidth and low latency, and that requirement drives the use of HBM over DDR SDRAM. The comparison below summarizes the points this material establishes.

AspectDDR SDRAMHBM
Typical attachmentMemory typically attached to a CPUMemory used with GPUs
Bandwidth demandSufficient for CPU-style accessHigh bandwidth, a large amount of data moved per unit time
Latency demandStandard delay before data arrivesLow latency, a short delay before a requested item begins to arrive
Technology levelTypical CPU memory technologyMore advanced memory technology
Relative costLower costHigher cost, reflecting the added engineering

What this material establishes about DDR SDRAM and HBM

Mistakes When Reading Specs

  • Common mistake

    Treating the peak FLOP/s figure as the speed a workload will reach

    What it looks like

    Assuming a chip quoted at a very large teraFLOP/s rating will run a real model at that rate.

    Why it fails

    A peak figure is the ideal ceiling. Waiting for data, uneven work splitting, and non-arithmetic overhead all keep real throughput below it.

    Do this instead

    Treat the peak as an upper bound and ask how much of it the actual workload can use.

  • Common mistake

    Comparing throughput figures measured at different precisions

    What it looks like

    Setting a figure measured at a 16-bit format beside a figure measured at a 32-bit format and concluding one chip is faster.

    Why it fails

    Fewer bits per value generally means more operations per second, so the two numbers describe different operations.

    Do this instead

    Compare throughput only when both figures use the same precision format.

  • Common mistake

    Judging memory by size alone

    What it looks like

    Choosing an accelerator because it has the largest memory, regardless of how fast that memory moves data.

    Why it fails

    A large memory with slow transfer leaves cores waiting for operands.

    Do this instead

    Read size and bandwidth together, within the full system and its memory hierarchy.

  • Common mistake

    Assuming a faster compute unit always helps when the workload is held back by data movement

Reasoning About a Workload

MEDIUM

A model's weights are too large to stay in the fastest memory level, so data must be moved in and out repeatedly during each step, and the cores frequently wait. Which resource is more likely to limit this workload, memory bandwidth or compute throughput, and what would you check first before choosing an accelerator?

Hints
  • Ask whether the cores are waiting for operands.
  • Consider whether the memory is too small or too slow to keep the cores fed.
  • Check which precision format each throughput figure was measured with.
EASY

Two accelerators are listed with different teraFLOP/s figures. One figure was measured at a 32-bit format and the other at a 16-bit format. Explain why the larger number cannot be read as the faster chip for your workload without further information.

Hints
  • Look at what each figure counts: operations at a specific precision.
  • Think about whether the workload uses the same precision as either measurement.

Key Takeaways

  • FLOP/s measures the peak number of floating-point operations per second a chip can perform, and real workloads usually achieve less than that ceiling because of waiting for data, uneven work distribution, and overhead.
  • Higher numerical precision uses more bits per value and generally yields fewer operations per second, so throughput figures are comparable only at the same precision.
  • GPUs run many cores in parallel and need high bandwidth and low latency, which is why HBM is favored over DDR SDRAM, the memory typically attached to a CPU.
  • Decide whether bandwidth or compute limits a workload by asking whether the cores wait for operands, and by reading memory size and bandwidth within the full memory hierarchy.

More concepts starting with M