What is CPU cache, and why is it so important for gaming?

With products like the Ryzen 7 5800X3D taking the crown as the best gaming CPU, you’re probably wondering what CPU cache is and why it’s so important in the first place. We already know that AMD’s upcoming Ryzen 7000 processors and Intel’s 13th generation Raptor Lake processors will focus on more cache, signaling that this will be a critical specification going forward.

But should you worry about CPU cache? We’ll explain what CPU cache is, why it’s so important, and how it can make a big difference if you’re gaming.

What is CPU cache?

AMD Ryzen 7 5800X3D chip.Image used with permission of the copyright holder

Cache memory is the amount of memory located inside the processor itself, integrated into individual cores or shared between some or all cores. It’s a small piece of dedicated memory that lives directly on the processor so your CPU doesn’t need to fetch information from your system’s RAM every time you want to do something on the computer. Each processor has a small amount of cache, with smaller CPUs getting perhaps only a few kilobytes, while large CPUs can have many megabytes of cache.

But you might be wondering why cache is even needed when we have RAM, especially when a single stick of RAM can hold several gigabytes of memory. It’s all about performance. In the 1990s, the pace of performance improvement between CPUs and RAM began to become apparent. After all, CPU designers were focused on increasing speed, while RAM designers wanted to increase capacity and ignored speed. This was a problem for CPU designers because RAM speed is a key factor in CPU performance for many applications, and the larger the CPU-RAM gap, the more difficult it was to improve performance.

Cache was the solution. Although the cache has a small capacity compared to RAM, the high speed makes up for it in most cases. However, the cache is not perfect. Its main weakness is its size; the cache is physically large for what little it can store. The cache is also resilient to node shrinking, so while the cores and other components in a CPU can shrink quite easily from one generation to the next, the cache shrinks much less. This makes the cache a very expensive component of the CPU, which is one of the main reasons why the cache usually has such a small amount of storage space.

How does the cache work?

The mainstream adoption of cache resulted in more nuanced implementations of cache and RAM until we ended up with a memory hierarchy, with cache at the top, RAM in the middle, and storage at the bottom. This layered approach allows CPU-critical data to be physically closer to the processor, reducing latency and helping your computer run fast.

The modern hierarchy of memory.Carlos Carvalho

The cache has its own hierarchy or cache levels which are divided into L1, L2 and L3 cache. These are all types of cache, but perform slightly different functions.

L1 cache is the first level of cache and also the smallest, usually divided into L1 instructions or L1i and L1 data or L1d. Each core within the CPU has its own exclusive section of L1 cache, which is usually only a few kilobytes in size. The type of data stored in the L1 cache is what the CPU has just used or expects to use soon. If the CPU needs data that is not in the L1 cache, it goes to the next level: L2.

Like the L1 cache, the L2 cache is often exclusive to a single CPU core, but in some CPUs it is shared between multiple cores. It is also much, much bigger; for example, each P-core in the Core i9-12900K has 80 kilobytes of L1 cache, as well as 1.25 megabytes of L2 cache, almost 16 times more. However, larger caches have higher latency, meaning it takes more time for the CPU core to communicate with the cache. When processors want to accomplish something within a few microseconds or even nanoseconds, a little more latency of the L2 cache is important. If the CPU cannot find the requested data within the L2 cache, it queries the next level: L3.

L3 cache is a big deal: it’s shared by some or all cores within a CPU, and it’s big. The 12900K has 30 MB of L3 cache, for example, 24 times more than L2 cache. L3 cache latency is even worse than L2, but having a large L3 cache is really important to prevent the CPU from asking RAM for the necessary data. Except for storage, RAM has the worst speed and latency in the memory hierarchy, and whenever the CPU needs to access RAM for needed data, things grind to a halt. Ideally, everything important will be stored at least within the L3 cache to prevent major slowdowns.

Some CPUs even have L4 cache, but it usually functions as RAM that resides on the CPU package. Some of Intel’s first 14nm processors based on the Broadwell architecture included 128MB of on-board DRAM, and the company’s upcoming Sapphire Rapids server processors may come with HBM2, which is somehow used as an additional level of cache.

Is CPU cache important for gaming?

AMD CEO holds 3D V-Cache CPU.Image used with permission of the copyright holder

CPU cache makes a huge difference to gaming. While single thread performance, instructions per clock (IPC) and clock speed are traditionally considered the most important factors in gaming performance, it has become very clear that cache is probably the most important factor of all in the rivalry between AMD and Intel.

Cache is so important to gaming because of today’s game design. Modern games have a lot of randomness, which means that the CPU has to constantly execute simple instructions. Without enough cache, your graphics card is forced to wait on your CPU as instructions pile up and cause a bottleneck. You can see an example of how much of a difference AMD’s 3D V-Cache technology makes in Far Cry 6 under.

Ryzen 7 5800X3D performance in Far Cry 6.Image used with permission of the copyright holder

In recent years, we’ve seen a trend towards more cache for gaming. AMD’s Ryzen 3000 processors had twice as much L3 cache as the previous generation and were much faster for gaming, nearly catching up with Intel. When the Ryzen 5000 launched, AMD didn’t add more cache, but consolidated two blocks of L3 cache inside the CPU, which greatly reduced latency and put AMD in the lead in gaming performance. AMD has doubled down on its 3D V-Cache technology on the Ryzen 7 5800X3D, which stacks a 64MB chip of L3 cache on top of the CPU for a total of 96MB, more than even the flagship Ryzen 9 5950X.

Intel is trying to catch up with AMD, and its current generation Alder Lake CPUs have up to 30MB of L3 cache, which is significantly less than most Ryzen CPUs, but they also have a lot more L1 and L2 cache. However, Intel’s disadvantage in L3 capacity does not mean that the Ryzen 5000 processors are much faster for gaming. In our Core i9-12900K review, we found the 12900K to be on par with the Ryzen 9 5950X in terms of gaming performance.

The cache race will almost certainly continue with the upcoming Ryzen 7000 and Raptor Lake processors. The Ryzen 7000 is confirmed to have twice the L2 cache of the Ryzen 5000, and we’re likely to see more CPUs using V-Cache. Meanwhile, Intel doesn’t have its own version of V-Cache, but Raptor Lake is rumored to have much more L3 cache than Alder Lake, just in the CPU itself.

Editor’s recommendations

Categories: GAMING
Source: newstars.edu.vn

Leave a Comment