MLGOPerf:一个用于优化性能的ML引导内联程序
MLGOPerf: An ML Guided Inliner to Optimize Performance
摘要:
在过去的25年里,我们见证了机器学习在选择和相位排序问题中的广泛应用。然而,有限的作品已被上传到最先进的编译器,即,LLVM,将前者无缝集成到编译器的优化管道中,以便用户轻松部署。MLGO是第一个这样的项目之一,它只致力于使用强化学习来减少基于ML的Inliner的二进制代码的大小。本文介绍了MLGOPerf;第一个能够使用LLVM的ML-Inliner优化性能的端到端框架。它采用二级ML模型来生成用于训练重定向强化学习代理的奖励,该代理先前被MLGO用作主要模型。它通过预测被分析函数的内联后加速来实现这一点,并且它为主要模型提供了一个快速训练框架,否则这将是不实用的。实验结果表明,MLGOPerf是能够获得高达1.8%和2.2%,相对于LLVM的优化在O3时,训练的性能在SPEC CPU 2006和Cbench基准,分别。此外,所提出的方法为我们的基准测试提供了高达26%的自动调优代码区域的机会,这可以转化为额外的3.7%的加速值。
英文摘要:
For the past 25 years, we have witnessed an extensive application of Machine Learning to the Compiler space; the selection and the phase-ordering problem. However, limited works have been upstreamed into the state-of-the-art compilers, i.e., LLVM, to seamlessly integrate the former into the optimization pipeline of a compiler to be readily deployed by the user. MLGO was among the first of such projects and it only strives to reduce the code size of a binary with an ML-based Inliner using Reinforcement Learning. This paper presents MLGOPerf; the first end-to-end framework capable of optimizing performance using LLVM's ML-Inliner. It employs a secondary ML model to generate rewards used for training a retargeted Reinforcement learning agent, previously used as the primary model by MLGO. It does so by predicting the post-inlining speedup of a function under analysis and it enables a fast training framework for the primary model which otherwise wouldn't be practical. The experimental results show MLGOPerf is able to gain up to 1.8% and 2.2% with respect to LLVM's optimization at O3 when trained for performance on SPEC CPU2006 and Cbench benchmarks, respectively. Furthermore, the proposed approach provides up to 26% increased opportunities to autotune code regions for our benchmarks which can be translated into an additional 3.7% speedup value.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。