MLGO: a Machine Learning Guided Compiler Optimizations Framework
arXiv:2101.04808
Abstract
Leveraging machine-learning (ML) techniques for compiler optimizations has been widely studied and explored in academia. However, the adoption of ML in general-purpose, industry strength compilers has yet to happen. We propose MLGO, a framework for integrating ML techniques systematically in an industrial compiler -- LLVM. As a case study, we present the details and results of replacing the heuristics-based inlining-for-size optimization in LLVM with machine learned models. To the best of our knowledge, this work is the first full integration of ML in a complex compiler pass in a real-world setting. It is available in the main LLVM repository. We use two different ML algorithms: Policy Gradient and Evolution Strategies, to train the inlining-for-size model, and achieve up to 7\% size reduction, when compared to state of the art LLVM -Oz. The same model, trained on one corpus, generalizes well to a diversity of real-world targets, as well as to the same set of targets after months of active development. This property of the trained models is beneficial to deploy ML techniques in real-world settings.
arXiv commentFirst two authors are equal contributors
References in corpus (6)
- Playing Atari with Deep Reinforcement Learning
- Inductive Representation Learning on Large Graphs
- Evolution Strategies as a Scalable Alternative to Reinforcement Learning
- Learning to Optimize Tensor Programs
- Structured Evolution with Compact Architectures for Scalable Policy Optimization
- Learning to superoptimize programs
Cited by in corpus (8)
- Compiler Optimization for Quantum Computing Using Reinforcement Learning
- Predicting Good Quantum Circuit Compilation Options
- MQT Predictor: Automatic Device Selection with Device-Specific Circuit Compilation for Quantum Computing
- MLGOPerf: An ML Guided Inliner to Optimize Performance
- RL4ReAl: Reinforcement Learning for Register Allocation
- Facile: Fast, Accurate, and Interpretable Basic-Block Throughput Prediction
- A Reinforcement Learning Environment for Polyhedral Optimizations
- Generating GPU Compiler Heuristics using Reinforcement Learning