Next-Line's Cache Pollution for Irregular Access
Next-Line prefetchers are highly ineffective for non-sequential data access patterns, such as pointer chasing or graph traversals, often causing cache pollution and increased memory traffic by bringing in unused data, thus degrading performance.
The top 3
- Worst-Case Patterns for Next-Line Pollution: Accessing data with large, random strides can cause next-line prefetchers to fetch entirely irrelevant cache lines, potentially evicting useful data and increasing cache miss rates by up to 50% or more in some benchmarks.
- Adaptive Prefetchers Outperform Next-Line: Modern CPUs often employ adaptive prefetching algorithms like stream prefetchers or stride prefetchers that dynamically detect access patterns, reducing cache pollution for irregular access by focusing on relevant data streams or consistent strides, unlike the simpler next-line approach.
- Software Hints to Combat Next-Line Pollution: Developers can use software prefetching instructions (e.g., `_mm_prefetch` in x86) to explicitly fetch data they know will be needed, overriding or complementing hardware prefetchers and preventing next-line pollution when access patterns are predictable but not sequential.
Open the full topic