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.
翻译:在过去25年中,我们目睹了对编纂者空间广泛应用机器学习;选择和分阶段排序问题;然而,有限的工程被上游到最先进的编译者,即LLLVM, 以便将前者顺利地纳入编译者的最佳编译管道,供用户方便地部署。 MLGO是这类项目中的第一批项目之一,它只是努力利用强化学习来减少一个基于 ML 的内线以 ML 为基础的二进制的二进制的代码尺寸。本文展示了MLGOPerf;第一个能够利用LLLLVM ML-Inliner 的MLLLLMM-Inliner优化业绩的端到端框架。它使用二级MLLLMMM(LLLMM)将前者无缝地纳入编译器的最佳编程。它通过预测一项正在分析的功能的内置后速度,它只能使初级模型的快速培训框架变得不切实际。实验结果显示MLGOPerf能够达到1.8%和2.2%的顶端框架, 当培训后,SLLLLLVMSUM(CS)将提高业绩标准的机会达到2.2%。