TL;DR
This paper introduces a sample-efficient method for optimizing how deep learning algorithms are mapped onto hardware accelerators using Bayesian optimization. Their approach significantly reduces the number of evaluations needed compared to existing methods, and the learned models can be reused for new hardware configurations, further accelerating the optimization process.
What Problem Does This Paper Address?
Designing high-performance deep learning accelerators hinges on finding the optimal "mapping" – essentially, how to best translate an algorithm's operations onto the accelerator's architecture. This involves making choices about tiling, loop ordering, and parallelization. The space of possible mappings (the "mapspace") is enormous and highly dependent on the specific hardware. Traditional methods either use simplified performance models that can be inaccurate or brute-force search, which requires an impractically large number of evaluations, especially when using accurate but slow cycle-accurate simulators. This makes hardware design-space exploration (DSE) a costly and time-consuming process. The paper aims to bridge this gap by developing a method that is both sample-efficient and can generalize to new hardware.
Methods
The core of this paper's contribution lies in applying Bayesian optimization (BO) to the problem of mapspace optimization. BO is well-suited for optimizing expensive-to-evaluate functions. The authors' key innovations include:
- Sample-Efficient Search: Instead of brute-force or less efficient search methods, they leverage BO with Gaussian processes to build surrogate models of performance. This allows them to intelligently explore the mapspace, converging to good mappings with far fewer evaluations.
- Mapspace Encoding: A crucial challenge is handling the discrete and combinatorial nature of mapspace parameters (like loop orderings). The authors propose an encoding scheme that maps points in a continuous, easily optimizable feature space to valid mappings. This includes handling hardware constraints by optimizing aspect ratios and scaling, ensuring that every point explored corresponds to a feasible configuration.
- Transfer Learning: A significant advantage of their approach is the ability to reuse the learned surrogate models. By training a multi-task model that considers both algorithm and hardware parameters, they can then "fine-tune" this model for a new hardware configuration with only a small number of additional evaluations, effectively transferring knowledge from previous optimizations.
Datasets
The paper evaluates their approach on:
- Matrix Multiplication (MatMul): Specifically, a 1:64, J:128, K:512 configuration.
- 2D Convolution (2dConv): Specifically, a C:144, M:24, N:16, P:56, Q:56, R:3, S:3 configuration.
These are standard computational kernels used for benchmarking. The authors compare their method against Timeloop, a popular tool for optimizing DNN computations, which uses an analytic performance model and a pruned random-search mapper. They note that their approach is designed for hardware models with higher per-sample costs than Timeloop's analytic model, and they use Timeloop for comparison to enable the use of its mapper.
Key Insights and Ideas
- Bayesian Optimization is a Game-Changer for Mapspace Search: The paper convincingly demonstrates that BO can achieve comparable or better results than established methods like Timeloop's mapper, but with an order of magnitude fewer evaluations. This is critical for practical hardware design where evaluations are expensive.
- Encoding is Key to Handling Discrete Mapspace Parameters: The proposed encoding scheme effectively bridges the gap between the continuous space BO operates in and the discrete, constrained nature of mapspace parameters, ensuring valid mappings are always generated.
- Transfer Learning Accelerates New Hardware Optimization: The ability to reuse learned models for new hardware configurations is a major breakthrough. It means that once a model is trained for a family of hardware, optimizing for a slightly different variant becomes significantly faster, reducing the overall DSE effort.
- Tilings are More Important than Loop Orderings (for MatMul): Sensitivity analysis revealed that tiling parameters have a much larger impact on performance for matrix multiplication than loop orderings, aligning with prior research and providing valuable insights for future optimization efforts.
Key Results
- Sample Efficiency: GPTune (their Bayesian optimization framework) converged to mappings comparable to Timeloop's mapper but required an order of magnitude fewer iterations. For matrix multiplication, it achieved a 16% better energy efficiency than Timeloop after 20 runs, while Timeloop took 4000 runs. For 2D convolutions, GPTune reached a minimum in about 50 iterations, outperforming Timeloop's average of 627 iterations.
- Transfer Learning Performance: When transferring knowledge to a new hardware configuration, GPTune converged to a good mapping in about 10 iterations, achieving performance on par with an uninitialized GPTune. This was significantly faster than Timeloop, which required an average of 1600 iterations to beat.
- Model Generalization: Their approach showed better generalization to new hardware configurations compared to previous gradient-based or reinforcement learning methods.
Limitations and Future Work
- Simulation Cost: While their method is sample-efficient, the paper acknowledges that testing on expensive cycle-accurate simulators (like FireSim) is still an ongoing effort. The current evaluation uses Timeloop's analytic model for comparison.
- Mapspace Scope: The current work focuses on tile sizes and loop orderings. The authors suggest extending their techniques to include spatio-temporal mappings in the future.
- High-Dimensional Problems: For complex, high-dimensional problems like convolutions, they believe their surrogate models could be used for automated dimension reduction, potentially even during the optimization process itself.
- Transfer Learning Across Simulation Fidelities: They propose exploring transfer learning across different hardware simulation fidelities (e.g., from cheap, coarse models to expensive, accurate ones) to further accelerate exploration.
- Analytic Models for Initial Data: The authors are investigating the use of simple analytic models (like CoSA or Brascamp-Lieb inequalities) to generate initial data points, which could further speed up the Bayesian optimization process.
Summary updated