Repolode
google

google/autofdo

Toolchain for AutoFDO, a profile-guided optimization workflow that uses sampled hardware profiles from Linux perf to improve compiled binaries.

Stars
623
Forks
128
Open issues
100
Last commit
last month

What is it?

AutoFDO is a set of tools for automatic feedback-directed optimization. Instead of instrumenting a program, it collects sampled execution profiles from hardware performance counters using Linux perf, converts them into a compiler-readable profile, and feeds that profile back into the compiler to guide optimization decisions.

The repository contains the profile conversion and processing tools built on LLVM and GCOV-related components. The build is driven by CMake, with an option to choose between LLVM-based tools and GCOV-based tools, and supports Ubuntu 20.04, 22.04 and CentOS 9. It can be built with either clang or g++.

The project notes that its Propeller code has moved to a separate repository, google/llvm-propeller.

Key features

  • 01Collects sampled profiles from Linux perf without program instrumentation.
  • 02Converts sampled profiles into a format the compiler can use for optimization.
  • 03Provides separate LLVM and GCOV tool builds selected through CMake.
  • 04Builds with clang or g++ on Ubuntu 20.04, 22.04 and CentOS 9.

Use cases

  • Improving the runtime performance of production C++ binaries using real workload profiles.
  • Building AutoFDO tooling for LLVM-based compiler pipelines on Linux servers.
  • Experimenting with profile-guided optimization without changing source code.

Quick start

  1. 1

    Install prerequisites on Ubuntu 20.04 or 22.04

    sudo apt install libunwind-dev libgflags-dev libssl-dev libelf-dev protobuf-compiler cmake libzstd-dev clang g++
  2. 2

    Clone the repository with submodules

    git clone --recursive --depth 1 https://github.com/google/autofdo.git
  3. 3

    Create a build directory and build the LLVM tools

    cd autofdo && mkdir build && cd build && cmake -DENABLE_TOOL=LLVM -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=On ../
  4. 4

    Build the autofdo tools

    cmake -DENABLE_TOOL=GCOV -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=On ../ && make -j 4

Things to know

  • Build instructions target Ubuntu 20.04, Ubuntu 22.04 and CentOS 9 only.
  • Ubuntu 20.04 needs a newer cmake than the one it ships, because the bundled LLVM build fails with the default version.
  • The Propeller codebase has moved to google/llvm-propeller.

In collections

Topics

#compiler#performance#profile-guided-optimization#llvm#linux-perf#cpp

FAQ

What is autofdo?
Toolchain for AutoFDO, a profile-guided optimization workflow that uses sampled hardware profiles from Linux perf to improve compiled binaries. AutoFDO is a set of tools for automatic feedback-directed optimization. Instead of instrumenting a program, it collects sampled execution profiles from hardware performance counters using Linux perf, converts them into a compiler-readable profile, and feeds that profile back into the compiler to guide optimization decisions.
Is autofdo free to use? What license does it have?
autofdo is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is autofdo still maintained?
Updated within 6 months. The last commit to autofdo was on Sep 30, 2026.
What can I use autofdo for?
Improving the runtime performance of production C++ binaries using real workload profiles. Building AutoFDO tooling for LLVM-based compiler pipelines on Linux servers. Experimenting with profile-guided optimization without changing source code.
How do I install autofdo?
Install prerequisites on Ubuntu 20.04 or 22.04: sudo apt install libunwind-dev libgflags-dev libssl-dev libelf-dev protobuf-compiler cmake libzstd-dev clang g++ Clone the repository with submodules: git clone --recursive --depth 1 https://github.com/google/autofdo.git Create a build directory and build the LLVM tools: cd autofdo && mkdir build && cd build && cmake -DENABLE_TOOL=LLVM -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=On ../ Build the autofdo tools: cmake -DENABLE_TOOL=GCOV -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=On ../ && make -j 4
Where can I get autofdo?
The source code and installation instructions are on GitHub: https://github.com/google/autofdo

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects