TABLE OF CONTENTS
If you’ve looked into CPU performance to buy your next processor, you would’ve encountered the term “IPC” here and there.
In fact, here’s a slide from AMD’s recent Ryzen 7000 series launch event that touts an IPC improvement:
In this article, I’ll explain what IPC (Instructions Per Clock / Cycle) is and how it affects a CPU’s performance.
Unfortunately, one of the simplest ways to explain IPC is still a bit complex: it’s the number of instructions a CPU can process within a single clock cycle.
But if this definition doesn’t mean anything to you, fret not. You’re not alone.
What is IPC?
Clock Cycles and Clock Speeds: Diving Headfirst into CPU Microarchitecture 101
So, first things first. What the heck is a clock cycle?
Well, no. Not this.
It’s actually something like this:
Well, bad jokes aside, let me explain.
Digital circuits rely on clock signals to know when and how to execute instructions.
This is why most electronics, including CPUs, will contain an internal oscillator (clock) to maintain a steady ‘clock tick.’ These clock signals are continuous and look like a simple square wave with a high and low state (as shown above).
Here, one ‘cycle’ in a CPU is the time interval between two of those pulses synchronized by that internal oscillator. So, that’s the time taken to go from 1 low state to high and back to low.
And the number of these ‘cycles’ it can handle per second is what we call a processor’s ‘clock speed.’
Since a processor clock cycle and clock speed could be different for every CPU architecture, we never compare CPUs of different brands/generations using just their clock speeds.
Defining IPC: Where Does Clock Speed Factor in?
IPC becomes much easier to define now that you know what a clock cycle is.
IPC (Instructions Per Clock) is the number of instructions a CPU can execute in a single clock cycle.
On the other hand, the clock speed of a processor (advertised in GHz) is the number of clock cycles it can complete in one second. So, a 3GHz CPU can complete a whopping 3 billion cycles in one second!
Even within the same brand, IPCs can vary wildly.
Here’s one example, thanks to Steve from Techspot:
Just take a look at the performance numbers when you run a Cinebench R20 single-core bench on all those CPUs.
With all processors locked at a steady 4GHz, the only aspect that CAN vary here is the number of instructions these CPUs can handle per clock cycle (their IPC).
You can clearly see the generational jumps in performance with each new Ryzen part.
AMD went from a single-core score of 404 (Ryzen 7 1800X) to 517 (Ryzen 7 5800X) at the exact same 4GHz frequency!
FAQ
How Does IPC Improve?
Every CPU generation improves on the previous one (with some notable exceptions).
Although explaining how you can improve IPC would take this article into CPU microarchitecture territory, I can give you a short overview of what’s happening behind the scenes.
Let’s use AMD’s Ryzen 7000 launch event slides again, shall we? Here’s the part where Mark Papermaster, from AMD, explains how Zen 4 CPUs achieved a 13% IPC uplift over the previous generation.
As you can see here, the IPC contributors listed on the right are some aspects of a modern CPU that can be improved to get an IPC improvement.
Let’s go over what they are, shall we?
- L2 Cache: A memory bank built on the CPU chip, and slower than the L1 cache. It’s also called the secondary cache.
- Execution Engine: Handles integer & memory operations and floating-point operations.
- Branch Prediction: It speeds up the processing of branch instructions using pipelines.
- Load/Store: A specialized unit that’s responsible for executing all load and store instructions. Here’s what load and store instructions look like on ARM.
- Front End: Deals with in-order operations like instruction fetches and decodes.
Does Higher GHz Mean Faster CPU?
Only when comparing CPUs from the same brand AND same generation.
Clock speeds should never be used to compare performance between 2 processors in any other scenario.
You could very well have ‘4GHz CPUs’ from a decade ago that’ll be obliterated by modern ‘3GHz’ CPUs.
Here’s an analogy that might help:
Let’s say two guys are each tasked with filling a large hole with gravel, and they can shovel at a constant speed of 1 dig/second.
Think of IPC as a shovel and the clock speed as the speed at which someone’s shoveling gravel.
If both guys use the same shovel, they’ll finish their tasks at precisely the same time.
But if you switch out one shovel for a larger one and both guys continue shoveling at identical speeds – who do you think will finish their work first? Of course, the guy with the larger shovel will finish first!
It’s the same idea with IPC and clock speeds in a CPU. It doesn’t make much sense to compare only the CPU speed if their IPCs can be wildly different.
Can You Measure the IPC of a CPU?
Short answer – Not really.
Since clock speeds offer a relatively easy way to put a solid number to that aspect of CPU performance, some understandably expect a similar metric for IPC too.
Sadly, there’s really no way to quantify IPC because every instruction isn’t equal, and these instructions would vary by workload quite drastically.
Even a relatively straightforward task gets broken down into machine code that your CPU can digest.
A simple program that prints a word on the screen and adds two numbers goes from looking like this:
To something much scarier:
Each of these lines above is ‘an instruction.’
Since there are so many workloads/applications/processes that a desktop CPU can handle, condensing how many of these instructions they can complete in one clock cycle into a meaningful number/metric is nearly impossible.
That said, the next best thing you can do is get a rough measure of relative IPC gains.
Set two CPUs to the same clock and multiplier, and run a single-core benchmark like Cinebench R20 single thread. The difference in performance you see here will be pretty close to the difference in IPC.
Over to You
Have any other questions about IPC? Feel free to ask us in the comments or our forum!
2 Comments
1 October, 2022
Is there any basic formula to allow consumers to compare possible CPU performance that take into consideration freq, IPC, cache, memory channels, memory controller?
6 October, 2022
Sadly no. Real world benchmarks in the apps you most frequently use has remained the basis for a hardware purchase and this wouldn’t change anytime soon.
You can get some idea of performance when you account for the results in a combination of scenarios like Cinebench, modern games, code compile, and simulations.
Cheers!
Jerry