Table of Contents
Fetching ...

A Hybrid, Knowledge-Guided Evolutionary Framework for Personalized Compiler Auto-Tuning

Haolin Pan, Hongbin Zhang, Mingjie Xing, Yanjun Wu

TL;DR

The paper tackles the NP-hard phase-ordering problem in compiler optimization by proposing a Hybrid, Knowledge-Guided Evolutionary Framework that separates a costly offline knowledge discovery phase from a lightweight online search. The offline phase builds a structured Pass Knowledge Base consisting of Pass Behavioral Vectors, Pass Groups, a Synergy Pass Graph, and Prototype Pass Sequences, which semantically inform online search. The online phase employs a bespoke genetic algorithm with knowledge-guided crossover and targeted restorative mutation to rapidly personalize optimization sequences for new programs, achieving an average 11.0% reduction in LLVM IR instructions over the opt -Oz baseline across seven public datasets. Empirical results demonstrate robust improvements, strong performance on diverse benchmarks, and competitive efficiency, highlighting the practicality of using offline domain knowledge to steer online auto-tuning. The work suggests future extensions to multi-objective optimization and potential integration with large language models for richer program representations.

Abstract

Compiler pass auto-tuning is critical for enhancing software performance, yet finding the optimal pass sequence for a specific program is an NP-hard problem. Traditional, general-purpose optimization flags like -O3 and -Oz adopt a one-size-fits-all approach, often failing to unlock a program's full performance potential. To address this challenge, we propose a novel Hybrid, Knowledge-Guided Evolutionary Framework. This framework intelligently guides online, personalized optimization using knowledge extracted from a large-scale offline analysis phase. During the offline stage, we construct a comprehensive compilation knowledge base composed of four key components: (1) Pass Behavioral Vectors to quantitatively capture the effectiveness of each optimization; (2) Pass Groups derived from clustering these vectors based on behavior similarity; (3) a Synergy Pass Graph to model beneficial sequential interactions; and (4) a library of Prototype Pass Sequences evolved for distinct program types. In the online stage, a bespoke genetic algorithm leverages this rich knowledge base through specially designed, knowledge-infused genetic operators. These operators transform the search by performing semantically-aware recombination and targeted, restorative mutations. On a suite of seven public datasets, our framework achieves an average of 11.0% additional LLVM IR instruction reduction over the highly-optimized opt -Oz baseline, demonstrating its state-of-the-art capability in discovering personalized, high-performance optimization sequences.

A Hybrid, Knowledge-Guided Evolutionary Framework for Personalized Compiler Auto-Tuning

TL;DR

The paper tackles the NP-hard phase-ordering problem in compiler optimization by proposing a Hybrid, Knowledge-Guided Evolutionary Framework that separates a costly offline knowledge discovery phase from a lightweight online search. The offline phase builds a structured Pass Knowledge Base consisting of Pass Behavioral Vectors, Pass Groups, a Synergy Pass Graph, and Prototype Pass Sequences, which semantically inform online search. The online phase employs a bespoke genetic algorithm with knowledge-guided crossover and targeted restorative mutation to rapidly personalize optimization sequences for new programs, achieving an average 11.0% reduction in LLVM IR instructions over the opt -Oz baseline across seven public datasets. Empirical results demonstrate robust improvements, strong performance on diverse benchmarks, and competitive efficiency, highlighting the practicality of using offline domain knowledge to steer online auto-tuning. The work suggests future extensions to multi-objective optimization and potential integration with large language models for richer program representations.

Abstract

Compiler pass auto-tuning is critical for enhancing software performance, yet finding the optimal pass sequence for a specific program is an NP-hard problem. Traditional, general-purpose optimization flags like -O3 and -Oz adopt a one-size-fits-all approach, often failing to unlock a program's full performance potential. To address this challenge, we propose a novel Hybrid, Knowledge-Guided Evolutionary Framework. This framework intelligently guides online, personalized optimization using knowledge extracted from a large-scale offline analysis phase. During the offline stage, we construct a comprehensive compilation knowledge base composed of four key components: (1) Pass Behavioral Vectors to quantitatively capture the effectiveness of each optimization; (2) Pass Groups derived from clustering these vectors based on behavior similarity; (3) a Synergy Pass Graph to model beneficial sequential interactions; and (4) a library of Prototype Pass Sequences evolved for distinct program types. In the online stage, a bespoke genetic algorithm leverages this rich knowledge base through specially designed, knowledge-infused genetic operators. These operators transform the search by performing semantically-aware recombination and targeted, restorative mutations. On a suite of seven public datasets, our framework achieves an average of 11.0% additional LLVM IR instruction reduction over the highly-optimized opt -Oz baseline, demonstrating its state-of-the-art capability in discovering personalized, high-performance optimization sequences.
Paper Structure (30 sections, 8 equations, 7 figures, 3 tables)

This paper contains 30 sections, 8 equations, 7 figures, 3 tables.

Figures (7)

  • Figure 1: An illustration of the compiler phase-ordering problem. Starting from the initial program state (Root), the application of different optimization passes (e.g., PassA, PassD) creates a vast, branching search space of possible optimization sequences. The red path highlights optimal pass sequence among countless alternatives.
  • Figure 2: An overview of the proposed Hybrid, Knowledge-Guided Evolutionary Framework, which is divided into Offline and Online phases.
  • Figure 3: The offline knowledge extraction pipeline. Starting from a training dataset, we cluster programs to form prototypes. These prototypes are then used to generate a behavioral vector for each compiler pass. The behavioral vectors, in turn, are used to discover functional Pass Groups. In parallel, a Synergy Pass Graph is constructed from empirical data, and Prototype Pass Sequences are evolved for each program prototype. All four of these knowledge components are then integrated into a final, comprehensive Pass Knowledge Base.
  • Figure 4: Distribution of behavioral vector values for a selection of compiler passes. Each boxplot illustrates the performance variation of a single pass across all $N$ program prototypes, highlighting the high context-dependency of pass effectiveness and their diverse behavioral profiles.
  • Figure 5: Conceptual diagram of the Knowledge-Guided Crossover operator. Parent sequences are first segmented into functional blocks. The operator then probabilistically selects and recombines entire blocks, with the selection probability biased by the block's pre-computed effectiveness score (Eq. \ref{['eq:block_score']}) for the target program's prototype.
  • ...and 2 more figures