TL;DR
This paper benchmarks 16 optimization algorithms for automatically tuning GPU kernels, a crucial but challenging task due to complex search spaces. They found that for short tuning times, dual annealing excels, while for longer budgets, iterative local search algorithms like FirstILS perform best. They also introduced a novel "fitness flow graph" metric based on PageRank to quantify tuning difficulty, showing it correlates well with observed performance.
What Problem Does This Paper Address?
Modern GPUs offer immense parallel processing power, revolutionizing fields like AI and scientific computing. However, extracting this performance from GPU kernels (the core computational units) is incredibly difficult. Even small changes in how a kernel is configured can lead to orders-of-magnitude differences in speed. This is further complicated because kernels often need re-tuning for different hardware, software versions, or input data. The search space of possible configurations is vast, discrete, and non-convex, making manual optimization infeasible and brute-force exploration impractical. The core problem this paper addresses is identifying which optimization algorithms are most effective at finding highly efficient GPU kernel configurations within varying time constraints, and understanding why some search spaces are harder to optimize than others.
Methods
The researchers conducted a comprehensive benchmarking study of 16 black-box optimization algorithms. They categorized these algorithms into discrete and continuous types, and also considered those that handle stochasticity. Key algorithms included:
- Discrete: Random Sampling, Multi-start Local Search (MLS), Iterative Local Search (ILS), Tabu Search, Simulated Annealing (SA), Genetic Local Search (GLS), Genetic Algorithm (GA).
- Continuous (with mapping to discrete): Basin Hopping, Dual Annealing.
- Stochastic-aware: Sequential Model Algorithm Configuration (SMAC), Iterated Racing (irace).
They implemented these algorithms within the Kernel Tuner framework and their own BlooPy package. A crucial aspect of their methodology was introducing a novel metric to quantify tuning difficulty. This involved constructing Fitness Flow Graphs (FFGs), which represent the search space as a directed graph where edges connect neighboring configurations with better fitness. They then applied the PageRank algorithm to these FFGs to calculate the "proportion of centrality" for local minima, which estimates how likely a local search algorithm is to find good solutions.
Datasets
The study used three real-world applicable GPU kernel programs:
- Convolution: Used in image processing and deep learning (CNNs).
- GEMM (Generalized dense matrix-matrix multiplication): A fundamental operation in many domains, including neural networks.
- PnPoly (Point-in-Polygon): Used in geospatial data management.
These kernels were tested across 9 different NVIDIA and AMD GPUs. The researchers generated and made publicly available the complete search space (all possible configurations) for these kernels, which is a significant contribution as it allows for reproducible benchmarking and analysis.
Key Insights and Ideas
- Deterministic Tuning is Preferred: For GPU kernel tuning, treating the problem as deterministic (using the mean runtime) is generally more effective than trying to account for stochasticity. This is because GPU kernel runtimes don't vary much, and stochastic-aware algorithms didn't consistently outperform others.
- Budget Matters: The best algorithm heavily depends on the available tuning time. Short budgets favor algorithms that can quickly find good solutions, while longer budgets allow for more thorough exploration.
- Fitness Flow Graphs (FFGs) and PageRank: The novel FFG and PageRank-based metric provide a powerful way to understand and predict tuning difficulty. It reveals how "reachable" good local minima are for local search algorithms, offering insights beyond simple fitness landscapes.
- GPU-Specific Difficulty: The difficulty of tuning a specific kernel can vary significantly across different GPUs, and this variation isn't directly correlated with the GPU's release date.
Key Results
- Low Budget Performance: For short tuning budgets (≤ 200 evaluations), Dual Annealing consistently outperformed other algorithms across various kernels and GPUs.
- Medium/High Budget Performance: For longer tuning budgets (> 200 evaluations), Iterative Local Search (ILS) and Simulated Annealing showed strong performance, particularly for the GEMM kernel. FirstMLS was also a top performer.
- FFG Metric Correlation: The "proportion of centrality" metric derived from FFGs showed a strong correlation with observed tuning difficulty, successfully predicting which kernels and GPUs would be harder to optimize. For instance, it correctly identified that the V100 GPU had more central local minima for convolution than the A100.
- Failure Rates Impact: Kernels with a high percentage of configurations that fail to compile (e.g., 68% for convolution, 78% for GEMM) pose a significant challenge, particularly for model-based optimizers like SMAC.
Limitations and Future Work
- Limited Kernel Set: While 26 kernels were tested, the authors acknowledge that this is a small fraction of all possible GPU kernels. Future work could expand this benchmark dataset.
- Exhaustive Search Feasibility: The current approach relies on being able to fully explore the search space to generate FFGs and establish ground truth. For larger, more complex kernels, this is infeasible. The authors suggest developing dynamic methods to estimate tuning difficulty without full exploration.
- Algorithm-Specific Correlation: The FFG-based metric's correlation with tuning difficulty might be stronger for certain types of algorithms (e.g., first-improvement local search) than others. Further research is needed to quantify this relationship across a wider range of optimizers.
- Hyperparameter Optimization: While they optimized hyperparameters for the tested algorithms, the process itself was computationally intensive. More efficient hyperparameter tuning strategies could be explored.
Summary updated