Reading time: | 20 min |
Last updated: | 30 Nov 2023 |
Reading time: |
20 min |
Last updated: |
30 Nov 2023 |
Author: | Jonathan Davies, Arm |
Official docs: | View |
Tags: |
Author: |
Jonathan Davies, Arm |
Official docs: |
View |
Tags: |
This guide is intended to get you up and running with this tool quickly with the most common settings. For a thorough review of all options, refer to the official documentation.
BOLT is an open-source post-link binary optimization tool developed to speed up large applications. It does this by optimizing the application’s code layout based on performance profile samples collected during execution.
This article provides quick instructions to download and install BOLT. The instructions are for Debian-based Linux distributions, but can be adapted for other Linux distributions.
Install Git using the documentation for your operating system.
Many Linux distributions include Git so you may not need to install it.
sudo apt install cmake -y
Check it is installed:
cmake --version
The version is printed:
cmake version 3.22.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
For more information refer to the CMake install guide.
sudo apt install ninja-build -y
Check it is installed:
ninja --version
The version is printed:
1.10.0
sudo apt install clang -y
Check it is installed:
clang --version
The version is printed:
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
You can install BOLT in 2 different ways, by building the source code or by downloading a binary release from GitHub.
cd $HOME
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake -G Ninja ../llvm -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="bolt"
ninja bolt
Build time depends on your machine configuration, and it may take several minutes to complete.
.bashrc
file
echo 'export PATH="$PATH:$HOME/llvm-project/build/bin"' >> ~/.bashrc
source ~/.bashrc
You are now ready to verify BOLT is installed .
For Arm Linux use the file with aarch64
in the name:
cd $HOME
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.5/clang+llvm-17.0.5-aarch64-linux-gnu.tar.xz
tar xvf clang+llvm-17.0.5-aarch64-linux-gnu.tar.xz
.bashrc
file
echo 'export PATH="$PATH:$HOME/clang+llvm-17.0.5-aarch64-linux-gnu/bin"' >> ~/.bashrc
source ~/.bashrc
perf2bolt
and llvm-bolt
are installedCheck the perf2bolt
command:
perf2bolt
The expected output is:
perf2bolt: Not enough positional command line arguments specified!
Must specify at least 1 positional argument: See: perf2bolt --help
Check the llvm-bolt
command:
llvm-bolt
The expected output is:
llvm-bolt: Not enough positional command line arguments specified!
Must specify at least 1 positional argument: See: llvm-bolt --help
llvm-bolt --version
The output is similar to:
LLVM (http://llvm.org/):
LLVM version 18.0.0git
Optimized build with assertions.
BOLT revision 99c15eb49ba0b607314b3bd221f0760049130d97
Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_32 - AArch64 (little endian ILP32)
aarch64_be - AArch64 (big endian)
arm64 - ARM64 (little endian)
arm64_32 - ARM64 (little endian ILP32)
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
You will see additional Registered Targets if you downloaded a binary release.
You are ready to use BOLT on your Linux machine.
How would you rate the overall quality of this tool quick-install guide?
What is the primary reason for your feedback ?
Thank you. We're grateful for your feedback on how to improve this tool quick-install guide.