What is Cycles per instruction (CPI)?
The average number of clock cycles per instruction, one factor in execution time = instruction count × CPI × cycle time, and the reciprocal of IPC.
Japanese name: CPI
The average number of clock cycles per instruction, one factor in execution time = instruction count × CPI × cycle time, and the reciprocal of IPC.
Japanese name: CPI
CPU execution time equals instruction count × cycles per instruction (CPI) × cycle time, or instruction count × CPI ÷ clock frequency. Each factor has a different owner: instruction count depends mostly on the algorithm, compiler and instruction set architecture (ISA); CPI on the microarchitecture and memory system; and cycle time on circuit design and process technology. CPI is the reciprocal of instructions per clock (IPC). A program of 1 billion instructions at CPI 2 on a 2 GHz processor takes 2 billion cycles, or 1 second.
Different instruction classes take different numbers of cycles, so average CPI is a weighted sum. With 50% ALU instructions at CPI 1, 30% loads and stores at CPI 2 and 20% branches at CPI 5, the average is 0.5 + 0.6 + 1.0 = 2.1. Breaking CPI down this way shows where time goes: branches are only a fifth of the instructions yet contribute nearly half the cycles. The same idea underlies CPI stacks in performance analysis, which attribute cycles to base execution, cache misses, branch mispredictions and other stalls.
Stall cycles add directly to the ideal CPI. If a core with a perfect cache achieves CPI 1.0 but each instruction makes 1.3 memory accesses with a 2% miss rate and a 100-cycle miss penalty, memory stalls add 1.3 × 0.02 × 100 = 2.6 cycles, giving CPI 3.6. Branch mispredictions add frequency × miss rate × penalty in the same way. Superscalar, out-of-order cores push base CPI below 1: a 2 GHz processor averaging CPI 0.5 completes about 4 billion instructions per second.
Optimizing one factor often worsens another, so only the product counts. Raising frequency 1.5× while CPI rises 1.2× gives a 1.25× speedup, not 1.5×, and deeper pipelines typically show exactly this pattern through larger misprediction penalties. A compiler change that removes 20% of instructions but raises CPI 10% still wins, at 0.88 of the original time. CPI is also not comparable across different ISAs, because the instructions do different amounts of work; for the same reason, raw instructions-per-second ratings can mislead.
Answer: B. 4 billion instructions
There are 2×10⁹ clocks per second and each instruction averages 0.5 clocks, so—4 billion instructions. CPI below 1 reflects superscalar execution of multiple instructions per clock. Performance is execution time = instruction count × CPI ÷ frequency, so no single one of the three factors suffices for comparison.
Answer: B. 3.6
Memory stall cycles per instruction are 1.3 accesses × 0.02 × 100 cycles = 2.6 cycles. Adding them to the ideal CPI gives 1.0 + 2.6 = 3.6, so performance falls to 1/3.6 of ideal. 3.0 wrongly assumes one access per instruction (1.0 + 1 × 0.02 × 100). 1.3 is the number of accesses per instruction, not the CPI. Even a small miss rate badly hurts performance when the miss penalty is large.
Divide total clock cycles by the number of instructions executed, or compute a weighted average of each instruction class's cycle count by its share of the instruction mix.
They are reciprocals: IPC is instructions completed per clock cycle and CPI is cycles per instruction, so a CPI of 0.5 means an IPC of 2.
Yes. In packaging, CPI usually means chip-package interaction, the cracking or delamination of fragile low-k interconnect layers caused by packaging stresses, which is unrelated to cycles per instruction.
Cycles per instruction (CPI) appears in 9 practice questions across 4 topics, including Performance Analysis, CPUs and architecture, Memory Hierarchy.
As an Amazon Associate I earn from qualifying purchases.
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.