Concepts and theorems · Intermediate

IPC and instruction throughput: count useful work per cycle

Separate instruction count, cycle count and frequency when explaining application performance.

Ask Logeia about this articleTry the three questionsReview your answers

Updated

On this page
  1. Define what is being counted
  2. Calculate two implementations
  3. Dependencies limit overlap
  4. Report the workload outcome too
  5. Ask Logeia about this articleCheck your understanding

Define what is being counted

IPC commonly measures completed instructions divided by CPU cycles over an interval. Check the event definitions, including whether you are counting retired instructions rather than work later discarded by speculation. A higher IPC says that more counted instructions completed per cycle; it does not say how much application work each instruction performed. Total instruction count remains important. Comparing processor generations or vectorized code solely by IPC can therefore be misleading. The metric describes a relationship between two counters, while application performance concerns the completion time of the required computation.

Calculate two implementations

Implementation A completes 100 million instructions in 50 million cycles, giving IPC 2. Implementation B completes the same application work using 60 million instructions and 40 million cycles, giving IPC 1.5. At the same effective frequency and under comparable counting conditions, B uses fewer cycles despite its lower IPC. The reduction in instruction count matters more than the ratio alone. Converting cycles to elapsed time also requires care about frequency and what the counted interval includes. These invented numbers demonstrate arithmetic; they are not benchmark results for any named processor or compiler.

Dependencies limit overlap

A processor can overlap independent work, but a long dependency chain limits the available parallelism because each operation needs an earlier result. Decode capacity, execution resources, cache misses and branch recovery also influence throughput. An instruction’s latency concerns when a dependent operation can use its result. Throughput concerns how frequently suitable operations can proceed when resources and dependencies permit. A dependency-chain experiment and an independent-operation experiment therefore answer different questions. They should not be combined into one supposed universal cost for an instruction or used without naming the relevant microarchitecture.

Report the workload outcome too

When using perf stat or another counter tool, record the input, scope, repetitions, instruction count, cycle count and elapsed outcome together. Very short intervals, counter multiplexing, scheduling and virtualization can complicate interpretation. A lower IPC alone does not prove a memory bottleneck; seek evidence concerning cache behaviour, branches or dependencies. The result of an optimization should be assessed on equivalent work with correct output. A ratio can improve while the program takes longer, or worsen while fewer instructions finish the job sooner. Report enough quantities for those possibilities to be distinguished.

Reading and practice are recorded separately in this browser, for each language.

Learn this in order

Build your CS foundations · STEP 7

Prepare for AI systems · STEP 4

Choose a learning path