TL;DR
Gaze is a novel hardware prefetcher that identifies spatial memory patterns by analyzing the temporal order of the first few accesses within a memory region. By leveraging these internal correlations, Gaze achieves state-of-the-art performance—outperforming recent solutions by up to 11.4%—while maintaining a tiny hardware footprint of just 4.46 KB.
What Problem Does This Paper Address?
Modern CPUs are much faster than the main memory (RAM) they rely on, a gap known as the "Memory Wall." Hardware prefetchers try to bridge this gap by guessing which data the CPU will need next and loading it into the cache ahead of time.
"Spatial" prefetchers work by looking at 4KB memory regions (pages). When a program touches a new region, the prefetcher tries to predict the "footprint"—the set of blocks within that page that will eventually be accessed. Traditionally, prefetchers use "environmental context," such as the instruction address (PC) that triggered the access.
However, the authors identify a major trade-off:
- Coarse context (using just the PC) is cheap but inaccurate, leading to "over-prefetching" that wastes bandwidth.
- Fine-grained context (PC + data address) is accurate but requires massive storage (often >100 KB), making it impractical for tight hardware budgets.
- Spatial Streaming (accessing every block in a row) often confuses these prefetchers, leading to aggressive, useless fetches that pollute the cache.
Methods
The core innovation of Gaze is shifting from extrinsic features (like the PC) to intrinsic features: the internal temporal correlation of the accesses themselves.
- Temporal Characterization: Gaze observes that even if two regions are triggered by the same instruction, the order in which the first few blocks are accessed is a highly reliable "fingerprint" for the rest of the pattern. Gaze specifically uses the offsets of the first two accesses in a region to index and tag its Pattern History Table (PHT).
- Two-Stage Streaming Control: To handle high-density "streaming" patterns without choking the system, Gaze uses a dedicated module (DPCT and DC) to detect dense footprints.
- Stage 1: It initially issues a moderate number of prefetches to both the L1 and L2 caches.
- Stage 2: If subsequent accesses confirm a steady stride (e.g., accessing blocks 0, 1, 2...), it "promotes" the prefetcher to be more aggressive, moving more data directly into the L1 cache.
- Hardware Efficiency: Because it uses the second access to trigger the lookup, Gaze doesn't need to store complex metadata about the "triggering" environment. It repurposes standard structures like Filter Tables and Accumulation Tables to track these temporal sequences.
Datasets
The authors evaluated Gaze using ChampSim, a industry-standard cycle-accurate simulator, across a massive suite of 201 traces:
- SPEC CPU 2006 & 2017: Standard general-purpose computing workloads.
- Ligra & GAP: Graph processing frameworks representing irregular, data-heavy patterns.
- CloudSuite: Scale-out server workloads (databases, web searching) known for being difficult to prefetch.
- PARSEC: Parallel processing benchmarks.
- QMM: Anonymized industry traces from Qualcomm.
Key Insights and Ideas
- The "Two-Access" Sweet Spot: The authors found that requiring the first four accesses to match before predicting a pattern is extremely accurate (90%) but too slow, missing many opportunities. Using just the first two accesses provides the best balance, increasing accuracy by 35% over single-access methods with almost no loss in coverage.
- Intrinsic is Better than Extrinsic: Environmental features like the PC can be "noisy" due to out-of-order execution or code sharing. The order of data access within a page is a more fundamental property of the underlying data structure traversal.
- Wait-and-See Approach: By waiting for a second access before making a big prediction, Gaze avoids the "trigger-happy" mistakes of conventional spatial prefetchers that guess based on the very first touch.
Key Results
- Performance: Gaze provides a 5.7% speedup on single-core and 11.4% on eight-core systems compared to PMP (a recent low-cost spatial prefetcher).
- Storage Efficiency: Gaze requires only 4.46 KB of storage. For comparison, the high-performing "Bingo" prefetcher requires 138.6 KB (31x more) to achieve similar results.
- Accuracy: Gaze achieved the second-highest accuracy among all tested state-of-the-art prefetchers, significantly reducing useless memory traffic.
- Robustness: Unlike many prefetchers that fail on irregular "Cloud" workloads, Gaze maintained performance gains where others (like PMP and DSPatch) actually caused slowdowns.
Limitations and Future Work
- L2 Cache Deployment: Gaze is designed primarily for the L1 Data (L1D) cache. If placed at the L2 cache, the "true" order of initial accesses might be filtered out by the L1, potentially requiring the CPU to pass extra metadata down the cache hierarchy.
- Cross-Page Prefetching: Currently, Gaze focuses on patterns within a 4KB region. While the authors experimented with "vGaze" for larger virtual regions, they noted that most patterns align well with the 4KB page size. Extending this to seamlessly handle patterns that cross page boundaries remains an area for future optimization.
- Dynamic Granularity: The authors suggest that future versions could "smartly" switch between different region sizes based on operating system hints (like Huge Pages).
Summary updated