计算机科学 ›› 2025, Vol. 52 ›› Issue (7): 248-254.doi: 10.11896/jsjkx.241000181
刘梦真1, 周清雷1, 韩林2, 聂凯2, 李浩然2, 陈梦尧1, 刘浩浩2
LIU Mengzhen1, ZHOU Qinglei1, HAN Lin2, NIE Kai2, LI Haoran2, CHEN Mengyao1, LIU Haohao2
摘要: 自动向量化技术利用SIMD部件加速程序的执行,减轻了程序员的负担,是GCC编译器中的重要优化过程之一。但GCC编译器中自动向量化的收益评估模型并不准确,会影响GCC编译器是否应该进行向量化转换的判定。为了提升申威平台上的自动向量化效率,基于申威平台上的GCC编译器,构建了一套新的自动向量化收益评估模型。针对申威处理器的后端指令集设计不同种类的代价,通过粒子群算法训练相对应的代价值,以提高申威平台上自动向量化收益评估模型的准确性。在SPEC2006和SPEC2017上进行了实验测试,与GCC编译器默认的收益评估模型相比,所提模型在SPEC2006课题上加速比最高提升7.6%,在SPEC2017课题上加速比最高提升5.75%,验证了模型的有效性。实验结果表明,所提出的模型可进一步完善基础自动向量化功能,提升申威平台编译系统的易用性。
中图分类号:
[1]AMIRIH,SHAHBAHRAMI A,POHL A,et al.Performance Evaluation of Implicit and Explicit SIMDization[J].Microprocessors and Microsystems,2018,63:158-168. [2]FENG J G,HE Y P,TAO Q M.Automatic Vectorization:Recent Advances and Future Perspectives[J].Journal of Communications,2022,43(3):180-195. [3]GAO W,ZHAO R C,HAN L,et al.Overview of SIMD Automatic Vectorization Compiler Optimization[J].Journal of Software,2015,26(6):1265-1284. [4]LI W.Research on Automatic Vectorization Optimization Method Based on Improved VEGEN[D].Harbin:Harbin Engineering University,2022. [5]CHEN M Y.Research on Loop Distribution Techniques for the Sunway GCC Compilation System[D].Zhengzhou:Zhengzhou University,2021. [6]ASHOURIA H,KILLIAN W,CAVAZOS J,et al.A survey on compiler autotuning using machine learning[J].ACM Computing Surveys,2018,51(5):1-42. [7]TANGY,WANG C.Performance modeling on DaVinci AI core[J].Journal of Parallel and Distributed Computing,2023,175:134-149. [8]LEATHERH,CUMMINS C.Machine learning in compilers:Past,present and future[C]//2020 Forum for Specification and Design Languages(FDL).New York:IEEE,2020:1-8. [9]STOCKK,POUCHET L N,SADAYAPPAN P.Using machine learning to improve automatic vectorization[J].ACM Transactions on Architecture and Code Optimization,2012,8(4):1-23. [10]POHLA,COSENZA B,JUURLINK B.Vectorization cost mo-deling for NEON,AVX and SVE[J].Performance Evaluation,2020,140:102106. [11]WANG Z,NIE K,HAN L.An Automatic Vectorization CostModel Based on Instruction MKS[J].Computer Science,2024,51(4):78-85. [12]TRIFUNOVIC K,NUZMAN D,COHEN A,et al.Polyhedral-model guided loop-nest auto-vectorization[C]//Proceedings of 2009 18th International Conference on Parallel Architectures and Compilation Techniques.IEEE,2009:327-337. [13]ZHANG Y Y,ZHAO R C,HAN L.A Vectorization Benefit Evaluation Method Based on Polyhedral Representation[J].Computer Engineering,2012,38(7):266-268,272. [14]LI C J,XU Y,DONG Y S.Research on Automatic Vectorization Cost Model for Multi-core Multi-SIMD Architectures[C]//Proceedings of the 18th Annual Conference on Computer Engineering and Technology and the 4th Microprocessor Technology Forum.2014:111-116. [15]LI J N.LLVM Automatic Vectorization Porting and Optimization for the Sunway Platform[D].Zhengzhou:Zhengzhou University,2021. [16]HAN Y,YU M.A Review of the Application of Particle Swarm Optimization in Robot Path Planning[J].Manufacturing Technology & Machine Tools,2024(7):85-90. [17]DORIT N,IRA R,AYAL Z.Auto-vectorization of interleaved data for SIMD[J].Association for Computing Machinery,2006,6:132-143. [18]TAN H,CHEN H,SHENG L,et al.Modeling and evaluation for gather/scatter operations in VectorSIMD architectures[C]//2017 IEEE 28th International Conference on Application-specific Systems,Architectures and Processors(ASAP).New York:IEEE,2017. [19]LI J N,HAN L,CHAI Y D.LLVM Automatic VectorizationPorting and Optimization for Domestic Platforms[J].Computer Engineering,2022,48(1):142-148. [20]HUANG J J,LI C J,XU Y.Analysis of the Automatic Vectori-zation Cost Model in GCC[C]//Proceedings of the 17th AnnualConference on Computer Engineering and Technology and the 3rd Microprocessor Technology Forum.2013:271-280. [21]GHASEMIM,AKBARI E,RAHIMNEJAD A,et al.Phasor particle swarm optimization:A simple and efficient variant of PSO[J].Soft Computing,2019,23(19):9701-9718. [22]JAKUBIK J,BINDING A,FEUERRIEGUL S.Directed particle swarm optimization with Gaussian-process-based function forecasting[J].European Journal of Operational Research,2021,295(1):157-169. [23]MALEKIS,GAO Y,GARZARÁN M J,et al.An Evaluation of Vectorizing Compilers[C]//International Conference on Parallel Architectures & Compilation Techniques.IEEE,2011:372-382. |
|