北京师范大学人工智能学院,北京 100875
刘秉鑫 男,1996年6月出生于河北省石家庄市。现为北京师范大学人工智能学院博士研究生。主要研究方向为编译优化。E-mail: liubingxin@mail.bnu.edu.cn
黄颖晖 女,2002年7月出生于广东省深圳市。现为北京师范大学人工智能学院硕士研究生。主要研究方向为自动调优。E-mail: huangyinghui@mail.bnu.edu.cn
高建花 女,1995年8月出生于山西省吕梁市。现为北京师范大学人工智能学院讲师。主要研究方向为并行与高性能计算、大模型推理优化。E-mail: gaojh@bnu.edu.cn
石剑君 女,1991年2月出生于河南省邓州市。现为北京师范大学人工智能学院博士后。主要研究方向为程序分析与优化、系统软件安全。E-mail: shijianjun@bnu.edu.cn
计卫星 男,1980年2月出生于陕西省咸阳市。现为北京师范大学人工智能学院教授、博士生导师。主要研究方向为并行与高性能计算、代码分析与优化、大模型推理优化。E-mail: jwx@bnu.edu.cn
收稿:2026-04-28,
录用:2026-06-23,
网络首发:2026-07-16,
移动端阅览
刘秉鑫, 黄颖晖, 高建花, 等. 自动调优与反馈导向优化融合方法研究[J/OL]. 电子学报, 2026,1-14.
LIU Bingxin, HUANG Yinghui, GAO Jianhua, et al. An Integration Method for Autotuning and Feedback-Directed Optimization[J/OL]. ACTA ELECTRONICA SINICA, 2026, 1-14.
刘秉鑫, 黄颖晖, 高建花, 等. 自动调优与反馈导向优化融合方法研究[J/OL]. 电子学报, 2026,1-14. DOI: 10.12263/DZXB.20260384.
LIU Bingxin, HUANG Yinghui, GAO Jianhua, et al. An Integration Method for Autotuning and Feedback-Directed Optimization[J/OL]. ACTA ELECTRONICA SINICA, 2026, 1-14. DOI: 10.12263/DZXB.20260384.
编译器自动调优与反馈导向优化(Feedback-Directed Optimization, FDO)是提升应用程序性能的两大关键技术。自动调优技术通过在高维离散编译选项空间中迭代搜索,获得较优配置,但其反馈信号通常仅依赖程序运行时间等指标,缺乏对程序动态运行时信息的利用能力;而反馈导向优化通过插桩或采样方式收集程序运行时剖面信息,并用以指导内联、代码布局与循环优化等关键优化决策。然而FDO高度依赖运行时剖面信息的质量,且受限于静态优化信息,在优化选项变化时使得剖面信息失效从而导致负优化。本文在统一搜索预算约束下,将自动调优与FDO深度融合,提出一种基于运行时剖面更新策略的联合优化框架。该框架将编译选项搜索、程序编译执行、运行时剖面采集以及反馈导向优化过程统一建构为一个完整的优化系统,并引入剖面来源配置等中间状态变量,以刻画剖面信息与当前候选编译配置之间的一致性关系。在此基础上,本文设计了三种融合模式:两阶段分离搜索、固定间隔采样搜索以及条件触发采样搜索。其中,两阶段方法将搜索空间分解为非FDO选项与FDO选项分别优化;固定间隔采样通过周期性更新剖面以保持剖面信息的有效性;条件采样则基于编译选项变化程度与风险划分动态决定是否触发剖面更新,从而在开销与信息有效性之间取得平衡。进一步地,本文提出基于结构破坏风险的选项分类方法,将FDO相关优化选项划分为高风险、低风险与无风险三类,并通过Hamming距离刻画候选配置与剖面信息来源配置之间的偏离程度,以实现自适应剖面更新机制。该方法能够有效减少不必要的剖面采集开销,同时避免剖面信息失效导致的优化误导。实验基于GCC 12.2与OpenTuner框架,在PolyBench测试集上进行评估。结果表明,相较于-O3优化基线,条件采样方法可达到1.184
<math id="M1"><mo>×</mo></math>
https://html.publish.founderss.cn/rc-pub/api/common/picture?pictureId=113080216&type=
https://html.publish.founderss.cn/rc-pub/api/common/picture?pictureId=113080160&type=
1.43933344
2.28600001
的几何平均加速比,相较于标准OpenTuner提升约8.46%,同时在收敛速度与鲁棒性方面表现更优。
Compiler autotuning and feedback-directed optimization (FDO) are two key techniques for improving application performance. Autotuning obtains superior configurations through iterative search in a high-dimensional discrete compiler option space. However
its feedback signals usually rely only on metrics such as program execution time
and thus lack the capability to exploit dynamic runtime information. In contrast
FDO collects runtime profile information through instrumentation or sampling and uses it to guide key optimization decisions
such as inlining
code layout
and loop optimization. Nevertheless
FDO heavily depends on the quality of runtime profile information and is constrained by static optimization information. When optimization options change
profile information may become invalid
which may in turn lead to performance degradation. Under a unified search budget constraint
this paper deeply integrates autotuning with FDO and proposes a joint optimization framework based on a runtime profile update strategy. The framework formulates compiler option search
program compilation and execution
runtime profile collection
and feedback-directed optimization as an integrated optimization system. It further introduces intermediate state variables
such as the profile source configuration
to characterize the consistency relationship between profile information and the current candidate compilation configuration. On this basis
three integration modes are designed: two-stage decoupled search
fixed-interval sampling search
and condition-triggered sampling search. The two-stage method decomposes the search space into non-FDO options and FDO-related options and optimizes them separately. Fixed-interval sampling periodically updates the profile to maintain the validity of profile information. Conditional sampling dynamically determines whether to trigger profile updates based on the degree of compiler-option changes and risk classification
thereby str
iking a balance between overhead and information validity. Furthermore
this paper proposes an option classification method based on structural-disruption risk
which divides FDO-related optimization options into high-risk
low-risk
and no-risk categories. The Hamming distance is used to quantify the deviation between a candidate configuration and the profile source configuration
enabling an adaptive profile update mechanism. The proposed method can effectively reduce unnecessary profile collection overhead while avoiding optimization misguidance caused by invalid profile information. Experiments are conducted on the PolyBench benchmark suite using GCC 12.2 and the OpenTuner framework. The results show that
compared with the -O3 optimization baseline
the conditional sampling method achieves a geometric mean speedup of 1.184
<math id="M2"><mo>×</mo></math>
https://html.publish.founderss.cn/rc-pub/api/common/picture?pictureId=113080202&type=
https://html.publish.founderss.cn/rc-pub/api/common/picture?pictureId=113080173&type=
1.43933344
2.28600001
and improves performance by approximately 8.46% over standard OpenTuner
while also exhibiting better convergence speed and robustness.
Bodin F , Kisuki T , Knijnenburg P , et al . Iterative compilation in a non-linear optimisation space [C ] // Workshop on Profile and Feedback-Directed Compilation . Paris, France , 1998 .
Triantafyllis S , Vachharajani M , Vachharajani N , et al . Compiler optimization-space exploration [C ] // International Symposium on Code Generation and Optimization, 2003. CGO 2003 . Piscataway : IEEE , 2003 : 204 - 215 . DOI: 10.1109/cgo.2003.1191528 http://dx.doi.org/10.1109/cgo.2003.1191528
Kulkarni P , Hines S , Hiser J , et al . Fast searches for effective optimization phase sequences [J ] . ACM SIGPLAN Notices , 2004 , 39 ( 6 ): 171 - 182 . DOI: 10.1145/996893.996863 http://dx.doi.org/10.1145/996893.996863
Pettis K , Hansen R C . Profile guided code positioning [C ] // ACM SIGPLAN Notices . New York : ACM , 1990 : 16 - 27 . DOI: 10.1145/93548.93550 http://dx.doi.org/10.1145/93548.93550
Agakov F , Bonilla E , Cavazos J , et al . Using machine learning to focus iterative optimization [C ] // International Symposium on Code Generation and Optimization . Piscataway : IEEE , 2006 : 11pp.- 11305 .
Ansel J , Kamil S , Veeramachaneni K , et al . OpenTuner: An extensible framework for program autotuning [C ] // Proceedings of the 23rd International Conference on Parallel Architectures and Compilation . New York : ACM , 2014 : 303 - 316 . DOI: 10.1145/2628071.2628092 http://dx.doi.org/10.1145/2628071.2628092
Fursin G , Kashnikov Y , Memon A W , et al . Milepost GCC: Machine learning enabled self-tuning compiler [J ] . International Journal of Parallel Programming , 2011 , 39 ( 3 ): 296 - 327 . DOI: 10.1007/s10766-010-0161-2 http://dx.doi.org/10.1007/s10766-010-0161-2
Smith M D . Overcoming the challenges to feedback-directed optimization (Keynote Talk) [J ] . ACM SIGPLAN Notices , 2000 , 35 ( 7 ): 1 - 11 . DOI: 10.1145/351403.351408 http://dx.doi.org/10.1145/351403.351408
Ramasamy V , Yuan P , Chen D , et al . Feedback-directed optimizations in GCC with estimated edge profiles from hardware event sampling [C ] // Proceedings of GCC summit 2008 . 2008 : 87 - 102 .
Kim H , Suleman M A , Mutlu O , et al . 2D-profiling: Detecting input-dependent branches with a single input data set [C ] // International Symposium on Code Generation and Optimization . Piscataway : IEEE , 2006 : 11pp.- 11172 .
Berube P , Amaral J N . Benchmark Design for Robust Profile-Directed Optimization [C ] // Proceedings of the 2007 SPEC Benchmark Workshop . Austin, TX, USA , 2007 .
Chen D H , Li D X , Moseley T . AutoFDO: Automatic feedback-directed optimization for warehouse-scale applications [C ] // Proceedings of the 2016 International Symposium on Code Generation and Optimization . New York : ACM , 2016 : 12 - 23 . DOI: 10.1145/2854038.2854044 http://dx.doi.org/10.1145/2854038.2854044
Hoste K , Eeckhout L . Cole: Compiler optimization level exploration [C ] // Proceedings of the 6th Annual IEEE/ACM International Symposium on Code Generation and Optimization . New York : ACM , 2008 : 165 - 174 . DOI: 10.1145/1356058.1356080 http://dx.doi.org/10.1145/1356058.1356080
Chen Y , Huang Y J , Eeckhout L , et al . Evaluating iterative optimization across 1000 datasets [C ] // Proceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation . New York : ACM , 2010 : 448 - 459 . DOI: 10.1145/1806596.1806647 http://dx.doi.org/10.1145/1806596.1806647
Fursin G . Collective Mind: cleaning up the research and experimentation mess in computer engineering using crowdsourcing, big data and machine learning [M ] . arXiv , 2013 .
Fursin G , Temam O . Collective optimization: A practical collaborative approach [J ] . ACM Transactions on Architecture and Code Optimization , 2010 , 7 ( 4 ): 1 - 29 .
Hellsten E O , Souza A , Lenfers J , et al . BaCO: A fast and portable Bayesian compiler optimization framework [C ] // Proceedings of the 28th ACM International Conference on Architectural Support for Programming Languages and Operating Systems , Volume 4 . New York : ACM , 2024: 19 - 42 . DOI: 10.1145/3623278.3624770 http://dx.doi.org/10.1145/3623278.3624770
Zhu M X , Hao D . Compiler auto-tuning via critical flag selection [C ] // 2023 38th IEEE/ACM International Conference on Automated Software Engineering . Piscataway : IEEE , 2023 : 1000 - 1011 . DOI: 10.1109/ase56229.2023.00209 http://dx.doi.org/10.1109/ase56229.2023.00209
Zhu M X , Hao D , Chen J J . Compiler autotuning through multiple-phase learning [J ] . ACM Transactions on Software Engineering and Methodology , 2024 , 33 ( 4 ): 1 - 38 . DOI: 10.1145/3640330 http://dx.doi.org/10.1145/3640330
Gao B Y , Yao M Y , Wang Z M , et al . Grouptuner: Efficient group-aware compiler auto-tuning [C ] // Proceedings of the 26th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems . New York : ACM , 2025 : 122 - 133 . DOI: 10.1145/3735452.3735530 http://dx.doi.org/10.1145/3735452.3735530
Ashouri A H , Elhoushi M , Hua Y Z , et al . Work-in-progress: MLGOPerf: An ML guided inliner to optimize performance [C ] // 2022 International Conference on Compilers, Architecture, and Synthesis for Embedded Systems . Piscataway : IEEE , 2022 : 3 - 4 . DOI: 10.1109/cases55004.2022.00008 http://dx.doi.org/10.1109/cases55004.2022.00008
Ashouri A H , Manzoor M A , Vu M , et al . Work-in-progress: ACPO: An AI-enabled compiler framework [C ] // 2024 International Conference on Compilers, Architecture, and Synthesis for Embedded Systems . Piscataway : IEEE , 2024 : 21 . DOI: 10.1109/cases60062.2024.00011 http://dx.doi.org/10.1109/cases60062.2024.00011
Pan H , Lin H , Luo H , et al . Compiler-R1: Towards agentic compiler auto-tuning with reinforcement learning [C ] // The thirty-ninth annual conference on neural information processing systems . 2026 .
Cummins C , Seeker V , Grubisic D , et al . LLM compiler: Foundation language models for compiler optimization [C ] // Proceedings of the 34th ACM SIGPLAN International Conference on Compiler Construction . New York : ACM , 2025 : 141 - 153 . DOI: 10.1145/3708493.3712691 http://dx.doi.org/10.1145/3708493.3712691
Tapus C , Chung I H , Hollingsworth J K . Active harmony: Towards automated performance tuning [C ] // SC '02: Proceedings of the 2002 ACM/IEEE Conference on Supercomputing . Piscataway : IEEE , 2002 : 44 . DOI: 10.1109/sc.2002.10062 http://dx.doi.org/10.1109/sc.2002.10062
Tiwari A , Chen C , Chame J , et al . A scalable auto-tuning framework for compiler optimization [C ] // 2009 IEEE International Symposium on Parallel Distributed Processing . Piscataway : IEEE , 2009 : 1 - 12 . DOI: 10.1109/ipdps.2009.5161054 http://dx.doi.org/10.1109/ipdps.2009.5161054
Graham S L , Kessler P B , McKusick M K . Gprof: A call graph execution profiler [C ] // Proceedings of the 1982 SIGPLAN Symposium on Compiler Construction . New York : ACM , 1982 : 120 - 126 . DOI: 10.1145/872726.806987 http://dx.doi.org/10.1145/872726.806987
Ball T , Larus J R . Efficient path profiling [C ] // Proceedings of the 29th Annual IEEE/ACM International Symposium on Microarchitecture. MICRO 29 . Piscataway : IEEE , 1996 : 46 - 57 . DOI: 10.1109/micro.1996.566444 http://dx.doi.org/10.1109/micro.1996.566444
Ammons G , Ball T , Larus J R . Exploiting hardware performance counters with flow and context sensitive profiling [C ] // Proceedings of the ACM SIGPLAN 1997 Conference on Programming Language Design and Implementation . New York : ACM , 1997 : 85 - 96 . DOI: 10.1145/258915.258924 http://dx.doi.org/10.1145/258915.258924
Novillo D . SamplePGO - the power of profile guided optimizations without the usability burden [C ] // 2014 LLVM Compiler Infrastructure in HPC . Piscataway : IEEE , 2014 : 22 - 28 . DOI: 10.1109/llvm-hpc.2014.8 http://dx.doi.org/10.1109/llvm-hpc.2014.8
Wicht B , Vitillo R A , Chen D , et al . Hardware counted profile-guided optimization [PP/OL ] . arXiv ( 2014-11-24 ) [ 2026-04-01 ] . http://arxiv.org/abs/1411.6361 http://arxiv.org/abs/1411.6361 .
Panchenko M , Auler R , Nell B , et al . BOLT: A practical binary optimizer for data centers and beyond [C ] // 2019 IEEE/ACM International Symposium on Code Generation and Optimization . Piscataway : IEEE , 2019 : 2 - 14 . DOI: 10.1109/cgo.2019.8661201 http://dx.doi.org/10.1109/cgo.2019.8661201
Panchenko M , Auler R , Sakka L , et al . Lightning BOLT: Powerful, fast, and scalable binary optimization [C ] // Proceedings of the 30th ACM SIGPLAN International Conference on Compiler Construction . New York : ACM , 2021 : 119 - 130 . DOI: 10.1145/3446804.3446843 http://dx.doi.org/10.1145/3446804.3446843
Chen D H , Vachharajani N , Hundt R , et al . Taming hardware event samples for precise and versatile feedback directed optimizations [J ] . IEEE Transactions on Computers , 2013 , 62 ( 2 ): 376 - 389 . DOI: 10.1109/tc.2011.233 http://dx.doi.org/10.1109/tc.2011.233
Ayupov A , Panchenko M , Pupyrev S . Stale profile matching [C ] // Proceedings of the 33rd ACM SIGPLAN International Conference on Compiler Construction . New York : ACM , 2024 : 162 - 173 . DOI: 10.1145/3640537.3641573 http://dx.doi.org/10.1145/3640537.3641573
0
浏览量
0
下载量
0
CSCD
关联资源
相关文章
相关作者
相关机构
京公网安备11010802024621