Lightweight ML-based Runtime Prefetcher Selection on Many-core Platforms

Erika S Alcorta, Neeraja J. Yadwadkar, Andreas Gerstlauer

TL;DR

This paper introduces a lightweight, phase-based machine learning approach to dynamically select the best prefetcher configurations on modern many-core processors. By training a simple decision tree model offline, they achieve significant performance improvements (up to 25%) on unseen workloads, overcoming the limitations of complex and resource-intensive prior methods.

What Problem Does This Paper Address?

Modern processors often employ multiple prefetcher components, each designed to optimize for different memory access patterns. While this composite approach can boost performance, having too many prefetchers active simultaneously can lead to resource contention (e.g., cache pollution, bandwidth hogging), especially on resource-constrained many-core systems. This contention can actually hurt performance. The challenge lies in intelligently enabling or disabling these prefetcher components at runtime to maximize performance without incurring significant overhead. Traditional heuristic-based methods struggle to scale with the increasing number of cores and prefetcher options, while more advanced techniques like deep reinforcement learning are too computationally expensive for practical deployment on real hardware.

Methods

The authors propose a novel phase-based methodology for training a lightweight supervised learning model. The core idea is to:

  1. Collect Hardware Counter Data: Gather traces of hardware performance counters (like instructions, memory accesses, cache misses) from various workloads under different prefetcher configurations.
  2. Clustering for Phase Identification: Use k-means clustering on data from a baseline prefetcher configuration (OFF) to identify distinct "workload phases" – periods with similar memory access behaviors.
  3. Phase Classification: Classify all collected data samples into these identified phases.
  4. Ground Truth Generation: For each phase, determine the prefetcher configuration that yields the highest average IPC (Instructions Per Cycle), defining this as the "best" configuration for that phase. This creates a supervised training dataset.
  5. Model Training: Train a lightweight decision tree model using this dataset. The model maps hardware counter features to the optimal prefetcher selection for a given workload phase.

For runtime implementation, a small thread periodically collects hardware counter data, transforms it into features, and uses the trained decision tree to predict the best prefetcher configuration, which is then applied via a hardware register.

Datasets

  • Training and Validation: SPEC CPU Int Rate 2017 benchmarks.
  • Testing (Unseen Workloads):
    • DaCapo benchmark suite (multi-threaded Java).
  • Renaissance benchmark suite (multi-threaded Java).

The paper notes that these testing suites are "completely new workloads" and differ from the training set by being multi-threaded, written in Java, and spending more time in OS code and network stacks.

Key Insights and Ideas

  • Workload Phases Matter: Different prefetcher configurations perform best during different phases of a workload's execution. A static selection is suboptimal.
  • Lightweight ML is Sufficient: A simple decision tree model, trained offline, can achieve significant performance gains without the complexity and overhead of deep reinforcement learning.
  • Generalization is Key: The proposed model demonstrates the ability to generalize and improve performance on workloads it has never seen during training, including multi-threaded Java applications.
  • Many-core Challenges: The paper highlights that on many-core systems, disabling prefetchers can sometimes be beneficial, a nuance not always observed in smaller core count systems.

Key Results

  • Performance Improvement: The lightweight ML-based prefetcher selection improves performance by up to 25% on individual workloads and 2.7% on average across diverse, unseen multi-threaded workloads (DaCapo and Renaissance suites).
  • SPEC CPU Improvement: For SPEC CPU benchmarks, the average performance improvement over the default prefetcher is 1.9%, with a best-case scenario of 5.5%.
  • Model Size: The trained decision tree model is extremely lightweight, requiring only 42 bytes of storage, making it highly practical for hardware deployment.
  • Compiler Robustness: The model's performance improvements were consistent even when tested on SPEC CPU benchmarks recompiled with a different compiler (gcc-12 vs. gcc-10), indicating robustness to minor code variations.

Limitations and Future Work

  • Performance Drop in Some Cases: While generally beneficial, the approach sometimes led to performance degradation on specific benchmarks within the DaCapo and Renaissance suites. The authors acknowledge the need to investigate why this occurs.
  • Root Cause Analysis: Future work will focus on understanding the reasons behind poor performance in certain benchmarks, determining if it's due to training data coverage issues or if the problem is inherently workload-specific.
  • Per-Core Decisions: The current approach makes system-wide decisions. Future work aims to investigate lightweight runtime prefetcher selection that is more practical for per-core decisions.

Summary updated

BibTeX
@inproceedings{alcorta2023lightweight,
  author = {Erika S Alcorta and Neeraja J. Yadwadkar and Andreas Gerstlauer},
  title = {{Lightweight ML-based Runtime Prefetcher Selection on Many-core Platforms}},
  booktitle = {ASSYST @ ISCA},
  year = {2023},
  url = {https://openreview.net/forum?id=5NGsSpPGVn},
}

Loading related content...

Figure