计算机科学 ›› 2026, Vol. 53 ›› Issue (6A): 260300057-9.doi: 10.11896/jsjkx.260300057
黄亮明, 张佳慧, 蔡淳豪
HUANG Liangming, ZHANG Jiahui, CAI Chunhao
摘要: 传统编译器优化面临规则固化、场景局限和人工设计效率天花板的问题,难以满足不同程序的高效编译需求。对此,研究者提出了自动调优、贝叶斯优化等算法进行优化选项和参数的寻优。然而,现有方法面临两方面的问题:一是需迭代运行目标码,成本高,面对大规模程序不可行;二是将程序作为黑盒,导致存在依赖初始配置、陷入局部最优、面对新程序需重新调优等问题。对此,提出基于程序特征的智能化编译优化技术,通过编译器采集程序特征信息,利用包含程序特征及较优选项组合的数据集训练深度学习模型,使其根据输入程序特征预测适配的选项组合;此外,针对循环展开等优化过程,以细粒度的参数寻优为目标,结合机器学习模型和程序特征实现关键参数的智能化选择。采用标准规模的SPEC CPU2017整数课题进行测试,相较O3优化级别,使用所提模型预测得到的优化选项和参数具有7.2%的性能提升,且模型平均推理时间仅为7.11 s,产生的编译时特征提取时间开销仅为1.02%。实验结果表明,该技术能有效预测不同程序的匹配编译优化选项和参数,且与现有技术相比有显著的成本优势。
中图分类号:
| [1] AHO A V,LAM M S,SETHI R,et al.Compilers:principles,techniques,and tools[M].Beijing:China Machine Press,2011. [2] HALL M,PADUA D,PINGALI K.Compiler research:the next 50 years[J].Communications of the ACM,2009,52(2):60-67. [3] GNU PROJECT.GNU Compiler Collection[EB/OL].[2026-04-09] .https://gcc.gnu.org/. [4] LLVM PROJECT.LLVM:low level virtual machine[EB/OL].[2026-04-09] .https://llvm.org/. [5] LATTNER C.LLVM and clang:next generation compiler technology[C]//The BSD Conference.2008:1-20. [6] CHI H Y,CHEN C B.Survey on Automatic Tuning of Compi-lers by Machine Learning[J].Computer Science,2022,49(1):241-251. [7] GAO G J,REN Z L,ZHANG J X,et al.Selection of com-piler-optimization sequences[J].SCIENTIA SINICA Informationis,2019,49(10):1267-1282. [8] GARCIARENA U,SANTANA R.Evolutionaryoptimization ofcompiler flag selection by learning and exploiting flags interactions[C]//Proceedings of the 2016 on Genetic and Evolutionary Computation Conference Companion.2016:1159-1166. [9] ASHOURI A H,KILLIAN W,CAVAZOS J,et al.A survey on compiler autotuning using machine learning[J].ACM computing surveys,2018,51(5):96:1-96:42. [10] ASHOURI A H,HUA Y,WANG X,et al.MLGOPerf:an ML guided inliner to optimize performance[J].arXiv:2207.08389,2022. [11] WANG Z,BOYLE M O.Machine learning in compiler optimization[C]//Proceedings of the IEEE.2018:1879-1901. [12] ANSEL J,KAMIL S,VEERAMACHANENI K,et al.Open-Tuner:An extensible framework for program autotuning[C]//Proceedings of the 23rd International Conference on Parallel Architectures and Compilation.2014:303-315. [13] KALYAN M,WANG X,ELTANTAWY A.Code region based auto-tuning enabled compilers[C]//Workshop on the Intersection of High Performance Computing and Machine Learning(HPCaML).ACM,2019. [14] PARK S,LATIFI S,PARK Y,et al.SRTuner:effective compiler optimization customization by exposing synergistic relations[C]//2022 IEEE/ACM International Symposium on Code Generation and Optimization(CGO).2022:118-130. [15] CHEN J J,XU N X,CHEN P Q,et al.Efficient compiler autotuning via bayesian optimization[C]//2021 IEEE/ACM 43rd International Conference on Software Engineering(ICSE).IEEE,2021:1198-1209. [16] SEEKER V,CUMMINS C,COLE M,et al.Revealing compiler heuristics through automated discovery and optimization[C]//2024 IEEE/ACM International Symposium on Code Generation and Optimization(CGO).2024:55-66. [17] ZHENG Z C,WU Y,ZHANG X W.mLOOP:optimize loop unrolling in compilation with a ML-based approach[C]//2024 International Conference on Networking,Architecture and Storage(NAS).2024. [18] TROFIN M,QIAN Y,BREVDO E,et al.MLGO:a machinelearning guided compiler optimizations framework[J].arXiv:2101.04808,2021. [19] HUANG L M,JIANG J,GAO X W.Structure Peeling Based on Link Time Optimization in the GCC compiler[C]//2022 3rd International Conference on Information Science,Parallel and Distributed Systems(ISPDS).2022:317-322. [20] HENNING J.Spec cpu2006 benchmark descriptions[J].ACM SIGARCH Computer ArchitectureNews,2006,34(4):1-17. [21] FURSIN G,TEMAM O.Collective optimization:a practical collaborative approach[J].ACM Transactions on Architecture and Code Optimization(TACO),2010,7(4):20:1-20:20. [22] GEWERS F L,FERREIRA G R,DE ARRUDA H F,et al.Principal component analysis:a natural approach to data exploration[J].ACM Computing Surveys,2011,50(4):70:1-70:34. [23] CHEN T Q,GUESTRIN C.XGBoost:a scalable tree boosting system[C]//Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining(KDD'16).2016:785-794. [24] STANDARD PERFORMANCE EVALUATION CORPORA-TION(SPEC).SPEC CPU2017 Benchmark Suite[EB/OL].[2026-03-11] .https://www.spec.org/cpu2017/. [25] LIMAYE A,ADEGBIJA T.A workload characterization of the SPEC CPU2017 benchmark suite[C]//2018 IEEE International Symposium on Performance Analysis of Systems and Software(ISPASS).2018:149-158. [26] JIANG J,GU X Y,XU K K,et al.Design and Research ofSIMD Programming Interface for Sunway [J].Computer Science,2025,52(6):66-73. [27] WEICKER R P.Dhrystone:a synthetic systems programmingbenchmark[J].Communications of the ACM,1984,27(10):1013-1030. |
|
||