Abstract
In modern computer architecture, the "memory wall"—the performance gap between fast CPUs and slow RAM—remains a critical bottleneck. Traditional hardware prefetchers, which attempt to predict future data requests to hide this latency, rely on simple heuristics or fixed-size lookup tables that struggle with the massive, irregular working sets of modern datacenter workloads. This paper reimagines prefetching as a sequence prediction task. By treating memory access patterns as a language and utilizing Long Short-Term Memory (LSTM) networks to predict address "deltas," we demonstrate that neural models can significantly outperform traditional hardware heuristics in both precision and recall.
Introduction: The Memory Wall and the Limits of Heuristics
Processors use prefetchers to guess which data the CPU will need next, pulling it into the fast cache before it is explicitly requested. Historically, these units have relied on simple "stride" prefetchers (looking for constant offsets) or table-based "correlation" prefetchers. However, modern applications often have working sets that are orders of magnitude larger than what traditional hardware tables can track. When these tables overflow, accuracy plummets, leading to wasted bandwidth and increased latency.
The core challenge lies in the irregularity of these patterns. As shown in the figure above, memory accesses often exhibit complex, non-linear behaviors that are difficult to model with fixed-size lookup tables but may be learnable by deep sequence models.
Methodology
The authors propose two primary LSTM-based architectures to address the prefetching problem:
1. Prefetching as Classification (Embedding LSTM)
Rather than treating memory addresses as continuous values, the model treats them as a discrete vocabulary. To manage the vast 64-bit address space, the model predicts deltas—the difference between subsequent addresses. As illustrated in the diagram below, an embedding layer maps these deltas and Program Counters (PCs) into a continuous space. A two-layer LSTM then processes this sequence to output the top-K most likely next deltas.
2. Clustering + LSTM
To handle extreme sparsity, the authors use k-means clustering to partition the address space into regions. A multi-task LSTM then shares weights across these clusters while being conditioned on a "Cluster ID." This allows the model to specialize in local patterns, such as traversing a specific data structure, while maintaining a global understanding of the program's execution.
Evaluation and Key Insights
The models were evaluated using industry-standard benchmarks (SPEC CPU2006) and real-world traces from Google Web Search. Traces were captured using the Pin dynamic instrumentation tool and passed through a cache simulator to isolate cache misses.
A key insight is the NLP analogy: memory access sequences are essentially a language. Just as a language model predicts the next word based on context, the prefetcher predicts the next delta based on the history of instructions and previous deltas. t-SNE visualizations revealed that the LSTM naturally clusters instructions performing similar high-level tasks, such as linked-list traversals, without explicit supervision.
Results
The neural approach demonstrated superior accuracy and generalization:
- Precision: On the
omnetppbenchmark, the LSTM achieved ~63% precision, compared to just ~8% for a standard stream prefetcher. - Recall: The "Clustering + LSTM" model achieved a geometric mean recall of 75%, nearly doubling the performance of the traditional Global History Buffer (GHB) correlation prefetcher (39%).
- Scalability: On complex Google Web Search workloads, neural models maintained high performance where traditional table-based methods failed due to the sheer scale of the address space.
Conclusion and Future Work
While LSTMs offer significant accuracy gains, the primary hurdle for hardware implementation is latency. A prefetcher must make decisions in nanoseconds, whereas running a multi-layer neural network currently requires more time than a standard CPU allows without dedicated accelerators. Future work includes exploring reinforcement learning to optimize prefetch timing and developing specialized hardware to support low-latency neural inference at the cache level.
Summary updated