commit | 882674933ce1c7a141591dfce0f2ae6e54a9fb9c | [log] [tgz] |
---|---|---|
author | Jacob Hegna <jacobhegna@gmail.com> | Thu Jul 01 17:11:50 2021 +0000 |
committer | Jacob Hegna <jacobhegna@gmail.com> | Fri Jul 02 16:48:59 2021 +0000 |
tree | 863483dbb4ab18e465d937ca69e0e68b55a2ba26 | |
parent | b235539ce2e5c6e5fddd1ad77638f433f5ac8689 [diff] |
Add support for the "expanded cost features" model. This commit includes two separate changes: 1) the addition of extra features which contribute to the "inlining cost" estimate, and 2) extending the size and training duration of the model to account for the additional features.
MLGO is a framework for integrating ML techniques systematically in LLVM. It replaces human-crafted optimization heuristics in LLVM with machine learned models. Our pioneering project is on the inlining-for-size optimization in LLVM.
We currently 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 compiler components are available in the main LLVM repository. This repository contains the training infrastructure and related tools for MLGO.
Currently we only support training inlining-for-size policy with Policy Gradient. We are working on:
Check out this demo for an end-to-end demonstration of how to train your own inlining-for-size policy from the scratch with Policy Gradient.
For more details about MLGO, please refer to our paper MLGO: a Machine Learning Guided Compiler Optimizations Framework.
Currently, the assumption for the is:
Training assumes a clang build with ML ‘development-mode’. Please refer to:
The model training - specific prerequisites are:
pip3 install --user -r requirements.txt
Where requirements.txt
is provided in the root of the repository.
Optionally, to run tests (run_tests.sh), you also need:
sudo apt-get install virtualenv
Note that the same tensorflow package is also needed for building the ‘release’ mode for LLVM.