paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Understanding and exploiting optimal function inlining

理解并利用最优函数内联
ASPLOS Proceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems2022匹配度 2/10 · 该论文研究编译器内联优化与自动调优,属于传统编译优化方向,虽涉及LLVM、SPEC2017等工程与基准分析,但未涉及LLM/Agent、静态分析在ML系统中的应用、浮点程序分析或贝叶斯程序分析等用户核心交叉方向。引用 38 inbox
Theodoros Theodoridis, Tobias Grosser, Zhendong Su
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:通过大幅缩减搜索空间的最优内联穷举分析,揭示LLVM与最优内联的差距,并提出平均提升7%的自动调优内联策略。

函数内联是优化编译器的核心变换,但判断哪些内联决策有利十分困难,已有工作主要设计启发式,未系统研究最优内联。本文在 SPEC2017 上对最优内联进行实证分析:提出一种新形式化,将内联搜索空间从 2349 大幅缩减至 225,从而能对 1,135 个文件穷举评估所有内联选择。分析显示,以二进制大小为优化目标时,LLVM 最先进策略与最优内联存在显著差距。受此启发,作者提出一种简单有效的内联自动调优策略,在 SPEC2017 上平均优于最先进方法 7%(最高 28%),在 LLVM 自身源码上提升 15%,在 SQLite 源码上提升 10%。

问题
编译器内联决策依赖整个优化流水线,难以预测收益;已有启发式未系统研究穷举最优内联,因而无法识别错失机会或评估现有方法。
方法
提出一种新形式化,将 SPEC2017 中内联搜索空间从 2349 缩减到 225,并在此基础上对 1,135 个文件穷举评估所有内联选择;进而设计简单的自动调优内联策略。
评估
在 SPEC2017、LLVM 自身源码和 SQLite 上评估,以二进制大小为确定性指标,比较 LLVM 最先进策略与最优内联的差距,并验证自动调优策略平均提升 7%、15%、10%。
原文摘要(Abstract)

Inlining is a core transformation in optimizing compilers. It replaces a function call (call site) with the body of the called function (callee). It helps reduce function call overhead and binary size, and more importantly, enables other optimizations. The problem of inlining has been extensively studied, but it is far from being solved; predicting which inlining decisions are beneficial is nontrivial due to interactions with the rest of the compiler pipeline. Previous work has mainly focused on designing heuristics for better inlining decisions and has not investigated optimal inlining, i.e., exhaustively finding the optimal inlining decisions. Optimal inlining is necessary for identifying and exploiting missed opportunities and evaluating the state of the art. This paper fills this gap through an extensive empirical analysis of optimal inlining using the SPEC2017 benchmark suite. Our novel formulation drastically reduces the inlining search space size (from 2349 down to 225) and allows us to exhaustively evaluate all inlining choices on 1,135 SPEC2017 files. We show a significant gap between the state-of-the-art strategy in LLVM and optimal inlining when optimizing for binary size, an important, deterministic metric independent of workload (in contrast to performance, another important metric). Inspired by our analysis, we introduce a simple, effective autotuning strategy for inlining that outperforms the state of the art by 7% on average (and up to 28%) on SPEC2017, 15% on the source code of LLVM itself, and 10% on the source code of SQLite. This work highlights the importance of exploring optimal inlining by providing new, actionable insight and an effective autotuning strategy that is of practical utility.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{TheodoridisG022,
  title = {Understanding and exploiting optimal function inlining},
  author = {Theodoros Theodoridis and Tobias Grosser and Zhendong Su},
  booktitle = {ASPLOS},
  year = {2022},
  doi = {10.1145/3503222.3507744}
}