便携式模型在编译器优化中替代工业启发式方法
Portable models as a replacement for industrial heuristics in compiler optimizations
AI总结:
研究在特定编译器场景预测函数内联决策,提出便携式内联预测框架,利用生产编译器诊断监督,提取器准备训练数据。构建数据集评估,CatBoost表现良好,特征分析揭示信号集中区域,为轻量级系统提供内联决策预测方案。
AI中文摘要:
本文研究了在紧凑型编译器、源到源工具和解释器中预测函数内联决策的可能性,这些场景中重用GCC或LLVM优化基础设施不切实际。现有生产编译器虽有强大内联器,但决策依赖难以在轻量级系统重现的因素。为此提出便携式内联预测框架,利用生产编译器诊断作监督,提取器重构调用点、准备源片段并导出特征用于训练。构建含336,938个调用点的数据集评估,结果显示CatBoost在特定验证下有良好表现,特征分析表明多数信号集中在源局部性等方面。
英文摘要:
The paper investigates the possibility of predicting function-inlining decisions in compact compilers, source-to-source tools, and interpreters where the reuse of GCC or LLVM optimization infrastructure is impractical. The relevance of this work is determined by the need to transfer mature inlining heuristics to systems with limited compiler infrastructure, restricted runtime dependencies, and reduced access to target-specific analysis. Existing production compilers already contain strong inliners, but their decisions depend on internal intermediate representations (IRs), pass ordering, target models, and analysis stacks that are difficult to reproduce in lightweight systems. To overcome these constraints, we propose a portable inlining-prediction framework. Production compiler diagnostics serve as supervision; a separate extractor reconstructs caller-callee callsites, prepares sterile source snippets, normalizes them into a universal AST, optionally lowers them to a lightweight structural IR, and exports scalar features for model training. Thus, a trained predictor can be emitted as ordinary C code without a compiler-runtime dependency. To evaluate the proposed framework, we constructed a dataset comprising 336,938 callsites from fifteen open-source C projects, including 79,287 compiler-reported inline events. A comparison of several tabular models is performed using project-aware validation. Under leave-one-project-out validation, CatBoost reaches ROC-AUC 0.928 and PR-AUC 0.713; after threshold tuning, F1 improves from 0.670 to 0.729 and the false-positive rate drops from 0.192 to 0.084. Feature analysis shows that most signal is concentrated in source locality, explicit inline intent, callee size, side effects, branch and call structure, signature shape, and callsite argument shape.