Home » Posts

Cache Modeling: Prefetching

2025-09-20 · Arsh Sharma
  1. Introduction
  2. Prefetching Strategies
  3. Prefetcher Knobs
  4. Metrics of Prefetcher Effectiveness
  5. Implementation

Introduction

Prefetching is a technique used to improve cache performance by predicting future memory accesses and loading data into the cache before it is actually requested by the CPU. This can help reduce cache misses and improve overall system performance.

Hardware data prefetching works by predicting the memory access pattern of the program and speculatively issuing prefetch requests to the predicted memory addresses before the program accesses those addresses.[1] We say that prefetching can effectively hide the latency of memory accesses and improve performance if:

I like to quote an example of ordering food while leaving for home from work.

If you order food just as you reach home, you will have to wait for the food to arrive. But if you order food while leaving work, by the time you reach home, the food will be there waiting for you.

But prefetching can negatively impact the performance:

Prefetching Strategies

There are several prefetching strategies, including:

Prefetcher Knobs

The aggressiveness of a prefetcher can be controlled by:

Based on the above knobs,

Metrics of Prefetcher Effectiveness

Prefetch Accuracy=Number of Useful PrefetchesNumber of Prefetches Sent to Memory \text{Prefetch Accuracy} = \frac{\text{Number of Useful Prefetches}} {\text{Number of Prefetches Sent to Memory}}

where Number of Useful Prefetches is the number of prefetched cache blocks that are used by demand requests

Prefetch Lateness=Number of Late PrefetchesNumber of Useful Prefetches \text{Prefetch Lateness} = \frac{\text{Number of Late Prefetches}}{\text{Number of Useful Prefetches}} Prefetcher Generated Cache Pollution=Number of Demand Misses Caused By the PrefetcherNumber of Demand Misses \text{Prefetcher Generated Cache Pollution} = \frac{\text{Number of Demand Misses Caused By the Prefetcher}}{\text{Number of Demand Misses}}

Implementation

[1] https://hps.ece.utexas.edu/pub/srinath_hpca07.pdf