TL;DR
This paper introduces new instructions, "unallocating loads" and "pushing stores" (ULPS), that allow software to provide hints to hardware cache management policies. This enables more efficient cache utilization, particularly for streaming data and producer-consumer communication patterns, leading to significant performance and energy improvements on modern many-core processors with deep cache hierarchies.
What Problem Does This Paper Address?
Modern processors are increasingly featuring many cores and deep cache hierarchies (multiple levels of caches). This complexity makes it challenging for traditional, hardware-only cache management policies (like LRU replacement) to optimally utilize memory resources. Two key inefficiencies arise:
- Streaming Data: When data streams through the cache hierarchy without sufficient temporal locality to be reused within a cache level, it can "pollute" the cache, evicting useful data and wasting energy on unnecessary allocations.
- Producer-Consumer Communication: In multi-threaded applications, when one thread produces data that another thread consumes, current cache coherence protocols often involve inefficient "ping-ponging" of cache lines between cores, leading to high latency and energy consumption due to multiple coherence messages.
These issues become more pronounced with deeper cache hierarchies, where the penalty for suboptimal placement and coherence management increases.
Methods
The core contribution of this paper is the introduction of two new instructions:
- Unallocating Load: This instruction allows software to hint that a loaded piece of data should not be allocated in caches smaller than a specified "reuse distance." This is more granular than existing "non-temporal" loads, which typically hint to bypass all caches. The hardware uses the reuse distance hint to decide which cache levels are appropriate for allocation.
- Pushing Store: This instruction allows software to hint that a written piece of data should be "pushed" to a specific cache level or even a specific core.
- Local Pushing Store: Similar to unallocating loads, it hints at cache allocation levels.
- Remote Pushing Store: This is the key for producer-consumer communication. It allows a producer core to directly push a cache line to a consumer core's cache, bypassing the typical invalidation and fetch cycle. This can be targeted to a specific core or to all current sharers.
These instructions are implemented as extensions to existing load/store units and cache controllers, requiring minimal hardware cost and preserving program correctness. The paper also proposes "eager" and "lazy" versions of remote pushing stores to balance latency-critical synchronization needs with opportunities for buffering and combining writes for data transfers.
Datasets
The paper evaluates its approach using a combination of microbenchmarks and existing application benchmarks:
- Microbenchmarks: Overflow, Barrier, Wr/Rd. These are designed to isolate specific behaviors like streaming, synchronization, and producer-consumer patterns.
- Applications: Radix, CG, BT (from NAS Parallel Benchmarks), Backprojection, Hashjoin, RTM, 2D-FFT, BigDFT, StreamCluster. These represent a range of real-world computational workloads.
The authors do not introduce new benchmark suites but rather select and categorize existing ones based on their access patterns (e.g., Working Set Overflow (WO), Cache Pollution (CP), Synchronization (SN), Block Xfer (XF)).
Key Insights and Ideas
- Software-Hardware Co-design for Caches: The paper demonstrates that giving software more explicit control over cache placement, through simple hints, can unlock significant performance and energy gains that hardware alone struggles to achieve, especially in complex hierarchies.
- Reuse Distance as a Granular Hint: Using "reuse distance" as a hint for cache allocation is more flexible than existing "non-temporal" hints, allowing data to be placed in appropriate cache levels rather than being entirely bypassed.
- Direct Push for Producer-Consumer: The "pushing store" instruction fundamentally changes producer-consumer communication from an "invalidate-and-fetch" model to a direct "push" model, drastically reducing coherence traffic and latency.
- Performance Portability: By using reuse distance hints (which can be determined at runtime or through profiling) rather than explicit cache level numbers, the ULPS instructions offer performance portability across different cache hierarchy configurations.
- Energy Savings Outpace Performance Gains: For many workloads, the energy efficiency improvements from ULPS are more substantial than the performance speedups, highlighting the critical role of cache management in power consumption.
Key Results
The proposed ULPS instructions achieved significant improvements on a simulated 64-core system:
- Average Performance Speedup: 1.07x (excluding eDRAM configurations).
- Average Memory System Energy Reduction: 1.24x.
- With a deep cache hierarchy (including eDRAM):
- Performance improvements increased to 1.11x over coarse-grained streaming loads/stores.
- Energy reduction reached 1.33x over streaming loads/stores.
- Specific Workloads:
- Overflow: 2x speedup and 3x energy reduction in L1/L2.
- Wr/Rd: 4.2x faster average memory access time.
- RTM: 1.16x largest application speedup and 1.24x average memory system energy reduction.
Limitations and Future Work
- Hardware Cost: While minimal, the proposed instructions do require modifications to the load/store units, cache controllers, and directory controllers.
- Portability of Core IDs: Obtaining target core IDs for remote pushing stores might require ISA or OS support, though the
all_sharershint offers a fallback. - Relaxed Consistency: The optimization for lazy remote pushing stores can lead to a departure from TSO (Total Store Order) consistency, requiring careful use of memory fences for synchronization-critical code. The paper notes that performance and energy benefits are reduced when strict TSO is preserved.
- Future Work: The paper suggests exploring compiler support for automatically generating ULPS instructions and investigating how ULPS can be integrated with other techniques like prefetching and adaptive cache partitioning for even greater efficiency. The performance portability aspect also suggests further research into how compilers and auto-tuners can effectively leverage reuse distance hints.
Summary updated