Table of Contents
Fetching ...

Synergy-Guided Compiler Auto-Tuning of Nested LLVM Pass Pipelines

Haolin Pan, Jinyuan Dong, Mingjie Xing, Yanjun Wu

TL;DR

This work addresses auto-tuning compiler passes for the LLVM New Pass Manager, whose hierarchical and grammatically constrained pipelines require a representation that guarantees validity. It introduces a formal CFG and a forest data structure to model valid nested pipelines, and a structure-aware genetic algorithm guided by an offline Synergy Knowledge Graph to explore high-quality hierarchies. An optional refinement stage further exploits subtle performance differences arising from nesting structures. Evaluation across seven benchmarks with LLVM 18.1.6 shows an average improvement of $13.62\%$ in instruction count over the opt -Oz baseline and superior performance to existing auto-tuning methods, demonstrating the value of structural awareness and knowledge-guided search in modern compilers.

Abstract

Compiler optimization relies on sequences of passes to improve program performance. Selecting and ordering these passes automatically, known as compiler auto-tuning, is challenging due to the large and complex search space. Existing approaches generally assume a linear sequence of passes, a model compatible with legacy compilers but fundamentally misaligned with the hierarchical design of the LLVM New Pass Manager. This misalignment prevents them from guaranteeing the generation of syntactically valid optimization pipelines. In this work, we present a new auto-tuning framework built from the ground up for the New Pass Manager. We introduce a formal grammar to define the space of valid nested pipelines and a forest-based data structure for their native representation. Upon this foundation, we develop a structure-aware Genetic Algorithm whose operators manipulate these forests directly, ensuring that all candidate solutions are valid by construction. The framework first mines synergistic pass relationships to guide the search. An optional refinement stage further explores subtle performance variations arising from different valid structural arrangements. We evaluate our approach on seven benchmark datasets using LLVM 18.1.6. The discovered pipelines achieve an average of 13.62% additional instruction count reduction compared to the standard opt -Oz optimization level, showing that our framework is capable of navigating this complex, constrained search space to identify valid and effective pass pipelines.

Synergy-Guided Compiler Auto-Tuning of Nested LLVM Pass Pipelines

TL;DR

This work addresses auto-tuning compiler passes for the LLVM New Pass Manager, whose hierarchical and grammatically constrained pipelines require a representation that guarantees validity. It introduces a formal CFG and a forest data structure to model valid nested pipelines, and a structure-aware genetic algorithm guided by an offline Synergy Knowledge Graph to explore high-quality hierarchies. An optional refinement stage further exploits subtle performance differences arising from nesting structures. Evaluation across seven benchmarks with LLVM 18.1.6 shows an average improvement of in instruction count over the opt -Oz baseline and superior performance to existing auto-tuning methods, demonstrating the value of structural awareness and knowledge-guided search in modern compilers.

Abstract

Compiler optimization relies on sequences of passes to improve program performance. Selecting and ordering these passes automatically, known as compiler auto-tuning, is challenging due to the large and complex search space. Existing approaches generally assume a linear sequence of passes, a model compatible with legacy compilers but fundamentally misaligned with the hierarchical design of the LLVM New Pass Manager. This misalignment prevents them from guaranteeing the generation of syntactically valid optimization pipelines. In this work, we present a new auto-tuning framework built from the ground up for the New Pass Manager. We introduce a formal grammar to define the space of valid nested pipelines and a forest-based data structure for their native representation. Upon this foundation, we develop a structure-aware Genetic Algorithm whose operators manipulate these forests directly, ensuring that all candidate solutions are valid by construction. The framework first mines synergistic pass relationships to guide the search. An optional refinement stage further explores subtle performance variations arising from different valid structural arrangements. We evaluate our approach on seven benchmark datasets using LLVM 18.1.6. The discovered pipelines achieve an average of 13.62% additional instruction count reduction compared to the standard opt -Oz optimization level, showing that our framework is capable of navigating this complex, constrained search space to identify valid and effective pass pipelines.
Paper Structure (46 sections, 3 equations, 6 figures, 6 tables, 1 algorithm)

This paper contains 46 sections, 3 equations, 6 figures, 6 tables, 1 algorithm.

Figures (6)

  • Figure 1: Logical Forest representation of a Pass Pipeline. Each root $\langle \text{ModuleManager} \rangle$ forms a tree. Non-leaf nodes are managers, and leaf nodes are terminal passes.
  • Figure 2: Overview of the auto-tuning framework. The offline mining produces a Synergy Knowledge Graph, which guides the generation of candidate pass sequences. Heuristic refinement is then applied to improve the hierarchical arrangement.
  • Figure 4: Comparison of hierarchical pass execution strategies.
  • Figure : (a) Intra-Level Synergy Example: module(function(instcombine, gvn))
  • Figure : (a) Intra-Level Synergy Example: module(function(instcombine, gvn))
  • ...and 1 more figures