# BaCO: A Fast and Portable Bayesian Compiler Optimization Framework

**Authors:** Erik Hellsten, Artur Souza, Johannes Lenfers, Rubens Lacouture, Olivia Hsu, Adel Ejjeh, Fredrik Kjolstad, Michel Steuwer, Kunle Olukotun, Luigi Nardi  
**arXiv:** [2212.11142](https://arxiv.org/abs/2212.11142)  
**Date:** 2022-12-01  
**Summary page:** https://www.summarizepaper.com/en/paper/2212.11142v2/

## Key points


## Summary

The Bayesian Compiler Optimization framework (BaCO) is a versatile autotuner designed for modern compilers that target CPUs, GPUs, and FPGAs. BaCO is capable of handling the complex requirements of modern autotuning tasks by dealing with permutation, ordered, and continuous parameter types along with both known and unknown parameter constraints. To efficiently deliver high-quality code, BaCO uses Bayesian optimization algorithms specialized towards the autotuning domain. In this study, we demonstrate the effectiveness of BaCO on three real-world compiler systems: TACO, RISE & ELEVATE, and HPVM2FPGA for CPUs, GPUs, and FPGAs respectively. Our evaluation shows that BaCO outperforms current state-of-the-art autotuners by delivering on average 1.36x-1.56x faster code with a tiny search budget. Additionally, BaCO can reach expert-level performance 2.9x-3.9x faster than other methods. We validate the efficiency, effectiveness, and generalizability of BaCO through extensive empirical results on all the frameworks and benchmarks in Appendix A. We answer several research questions to evaluate the performance of BaCO: Firstly (RQ1), we investigate whether BaCO achieves high performance with a limited autotuning budget; Secondly (RQ2), we analyze whether BaCO can handle different types of parameters effectively across various benchmarks from different domains such as image processing or machine learning applications; Thirdly (RQ3), we examine whether our method is portable across different hardware platforms such as CPUs or GPUs without requiring any changes to its architecture or algorithmic design; Finally (RQ4), we investigate the findings of a qualitative user study with domain experts. Our results show that even with a small budget of 20-40 evaluations depending on benchmark complexity, BaCO achieves significantly better performance than state-of-the-art baselines; it performs well across all domains tested; it is highly portable and can deliver expert-level performance across different hardware platforms; and it is feasible and effective for real-world applications as it can deliver high quality code with minimal effort from the user. In conclusion, BaCO is a fast and portable Bayesian compiler optimization framework that outperforms state-of-the art autotuners in delivering high quality code across various domains and hardware platforms.
