google/ml-compiler-opt

Infrastructure for Machine Learning Guided Optimization (MLGO) in LLVM.

What it solves

It replaces human-crafted optimization heuristics in the LLVM compiler with machine learning models to improve how the compiler optimizes code for size and performance.

How it works

MLGO integrates ML techniques into LLVM to replace traditional heuristics. It uses algorithms like Policy Gradient to train policies for specific compiler tasks. The framework currently focuses on two main optimizations: inlining-for-size and register-allocation-for-performance.

Who it’s for

Compiler engineers and developers who want to optimize LLVM's compilation process using machine learning models rather than manual heuristics.

Highlights

  • Supports inlining-for-size and register-allocation-for-performance optimizations.
  • Uses Policy Gradient training for policies.
  • Provides training infrastructure and tools to create custom models.
  • Offers pretrained models that can be integrated directly into LLVM via CMake flags.

Related

  • Project
  • Project
  • Project
  • Project
  • Project