TL;DR
Themis is a novel hardware-software co-designed prefetch throttling mechanism that uses profile-guided optimization (PGO) to eliminate inaccurate prefetches in datacenter applications. By utilizing existing page-table entry attributes to disable hardware prefetching on a per-page basis, Themis reduces useless prefetches by roughly 40% and delivers noticeable speedups across various state-of-the-art prefetchers without requiring any ISA or binary modifications.
What Problem Does This Paper Address?
Modern datacenter applications are notorious for their massive memory footprints and complex data access patterns, which frequently stall CPUs while waiting for data from memory. While hardware data prefetchers are designed to hide this latency by fetching data into the cache ahead of time, they struggle with datacenter workloads. To achieve high coverage, they prefetch aggressively, resulting in low accuracy and a flood of useless prefetches. In multi-tenant, bandwidth-constrained datacenter environments, this wasted bandwidth actually degrades overall system performance.
Existing hardware-only throttling mechanisms (like CLIP) try to solve this by tracking instruction addresses (PCs). However, because datacenter applications have massive instruction and data footprints, these hardware buffers quickly overflow or miss critical context, making them ineffective.
Methods
The authors introduce Themis, a profile-guided solution that establishes an elegant division of labor between software and hardware:
- Software Profiling (Kernel Module): At runtime, a lightweight kernel module periodically samples a small FIFO buffer added to the hardware's Cache Performance Monitor Unit (PMU). This buffer logs the physical addresses of cache evictions that were prefetched but never used.
- Page-Table Hints: The software maps these physical addresses back to virtual pages and calculates a per-page prefetch accuracy metric. If a page's useless prefetches heavily outweigh its useful ones, the kernel flips a "prefetch-disable" bit in that page's Page Table Entry (PTE).
- Hardware Throttling: This bit is cached by the Translation Lookaside Buffer (TLB) during normal page walks. When the processor executes a load or store, the bit is passed to the hardware prefetcher as an enable/disable signal. If disabled, the prefetcher halts both its training and prediction logic for that specific page.
Crucially, Themis leverages existing architectural features like ARM’s Page-Based Hardware Attributes (PBHA), meaning it requires zero Instruction Set Architecture (ISA) changes and no binary recompilation.
Datasets
The authors evaluated Themis using three distinct workloads:
- Google Workload Traces (Version 2): Real-world, multi-threaded production datacenter traces spanning billions of instructions.
- SPEC2017: A standard benchmark suite representing conventional, single-tenant client/server applications.
- GAP Benchmark Suite: A graph-processing benchmark suite characterized by highly memory-intensive and irregular access patterns.
Key Insights and Ideas
- Pages are Great Discriminators: Prefetch accuracy varies drastically from one memory region to another. As shown in Figure 1, between 50% and 75% of virtual pages in datacenter workloads exhibit a prefetch accuracy of less than 20%.
- Less is More (The Coverage Paradox): Intuitively, turning off a prefetcher should reduce its coverage (the fraction of cache misses it prevents). However, Themis actually increases useful prefetch coverage by an average of 5.7%. By gating the prefetcher on poorly performing pages, Themis prevents the prefetcher's internal metadata tables from being thrashed by chaotic access patterns, allowing it to train more effectively on "prefetch-friendly" pages.
- Stability Over Time: Memory prefetchability is tied to the underlying data structures, which rarely change after allocation. Consequently, the authors found that a brief 100-million-instruction profile remains highly accurate across tens of billions of instructions, keeping profiling overhead incredibly low (~0.2%).
Key Results
Themis was evaluated atop seven state-of-the-art hardware prefetchers (including BOP, SPP, and Pythia).
- Useless Prefetch Reduction: Themis eliminated an average of 40.6% of useless prefetch requests (up to 52.6% for the DSPatch prefetcher), leading to an 18.0% reduction in overall DRAM bandwidth utilization.
- Performance Gains (IPC): By mitigating cache pollution and bandwidth contention, Themis achieved an average speedup of 3.5% on Google datacenter traces, including 4.1% for BOP, 3.1% for SPP+PPF, and 1.4% for Pythia.
- Graph Analytics Boost: On the memory-heavy GAP benchmarks, Themis improved performance by an average of 12.8%, significantly outperforming hardware-only throttlers like CLIP, which caused performance degradation on several datacenter traces due to footprint limitations.
Limitations and Future Work
While highly effective, Themis operates at a page-level granularity (typically 4KB). If a single page contains a highly mixed set of data structures—some that prefetch well and others that do not—Themis might make a sub-optimal sub-page decision.
Additionally, the optimal threshold for throttling ($\lambda$) depends heavily on the system's available DRAM bandwidth. While the paper demonstrates that stronger throttling is automatically desirable when bandwidth is scarce, dynamically tuning this factor online remains an open avenue for future research.
Summary updated