arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.13184cs.SE
收藏

协同引导的嵌套LLVM Pass流水线编译器自动调优

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

Hangzhou Institute for Advanced Study at UCAS(中国科学院大学杭州高等研究院);Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学)

Haolin Pan, Jinyuan Dong, Mingjie Xing, Yanjun Wu

AI总结:

针对LLVM新Pass管理器的嵌套流水线,提出基于形式文法与森林表示的结构感知遗传算法,通过挖掘pass协同关系引导搜索,在七个基准上平均额外减少13.62%指令数。

摘要:

编译器优化依赖于一系列pass(优化遍)来提升程序性能。自动选择和排序这些pass,即编译器自动调优,由于搜索空间庞大且复杂而颇具挑战性。现有方法通常假设pass序列是线性的,这种模型与遗留编译器兼容,但与LLVM新Pass管理器的层次化设计根本不一致。这种错位使得它们无法保证生成语法上有效的优化流水线。在本工作中,我们提出一个新的自动调优框架,从零开始为新Pass管理器构建。我们引入一个形式文法来定义有效嵌套流水线的空间,以及一种基于森林的数据结构用于其原生表示。在此基础之上,我们开发了一个结构感知的遗传算法,其操作符直接操作这些森林,确保所有候选解在构造上都是有效的。该框架首先挖掘协同pass关系以引导搜索。一个可选的细化阶段进一步探索由不同有效结构安排引起的细微性能变化。我们使用LLVM 18.1.6在七个基准数据集上评估了我们的方法。与标准的opt -Oz优化级别相比,发现的流水线平均额外减少了13.62%的指令数,表明我们的框架能够导航这一复杂且受约束的搜索空间,以识别有效且高效的pass流水线。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑