This project leverages the MLGO (Machine Learning Guided Compiler Optimizations) infrastructure to train custom optimization models specifically tailored for compiling Linux kernel sources.
MLGO is a framework developed by Google for integrating ML techniques systematically in LLVM. It replaces human-crafted optimization heuristics in LLVM with machine learned models.
You can train your own model by using our scripts.
example:
bash train_model.sh --arch=arm64 --model=regalloc
To know about all the supported arguments run the script with --help.
We provide pretrained regalloc models trained off of Linux kernel sources using our scripts. We provide our models in X86_64 and ARM64 flavours, the training compilation is done using the default defconfig for the respective archtitecture. Models are released as github releases, and are named as: [task]-linux-[linux kernel version used for training]-[arch]-[release candidate].
When building LLVM, there is a flag -DLLVM_RAEVICT_MODEL_PATH
which you may
set to the path to your downloaded model.
# Model is in /tmp/model, i.e. there is a file /tmp/model/saved_model.pb along
# with the rest of the tensorflow saved_model files produced from training.
-DLLVM_RAEVICT_MODEL_PATH=/tmp/model