Instruction combiner (IC) is a critical compiler optimization pass, which replaces a sequence of instructions with an equivalent and optimized instruction sequence at basic block level. There can be thousands of instruction-combining patterns which need to be frequently updated as new coding idioms/applications and novel hardware evolve over time. This results in frequent updates to the IC optimization pass thereby incurring considerable human effort and high software maintenance costs. To mitigate these challenges associated with the traditional IC, we design and implement a Neural Instruction Combiner (NIC) and demonstrate its feasibility by integrating it into the standard LLVM compiler optimization pipeline. NIC leverages neural sequence-to-sequence (Seq2Seq) models for generating optimized encoded IR sequence from the unoptimized encoded IR sequence. To the best of our knowledge, ours is the first work demonstrating the feasibility of a neural instruction combiner built into a full-fledged compiler pipeline. Given the novelty of this task, we built a new dataset for training our NIC neural model. We show that NIC achieves exact match results percentage of 72% for optimized sequences as compared to traditional IC and neural machine translation metric Bleu precision score of 0.94, demonstrating its feasibility in a production compiler pipeline.
MLGOPerf: An ML Guided Inliner to Optimize Performance
Huawei Technologies(华为技术有限公司)
在过去的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%的加速值。
Compiler-R1: Towards Agentic Compiler Auto-tuning with Reinforcement Learning
University of Chinese Academy of Sciences(中国科学院大学);Institute of Software Chinese Academy of Sciences(中国科学院软件研究所);Beijing University of Posts and Telecommunications(北京邮电大学);Hangzhou Institute for Advanced Study at UCAS(UCAS杭州高等研究院)
ECCO: Evidence-Driven Causal Reasoning for Compiler Optimization
Institute of Software at Chinese Academy of Sciences(中国科学院软件研究所);Hangzhou Institute for Advanced Study at University of Chinese Academy of Sciences(中国科学院大学杭州高等研究 institute);University of Chinese Academy of Sciences(中国科学院大学)
Static Neural Compiler Optimization via Deep Reinforcement Learning
Technische Universität Darmstadt Graduate School of Excellence Computational Engineering(达姆施塔特工业大学卓越计算工程研究生院);Iowa State University Department of Computer Science(爱荷华州立大学计算机科学系);Technische Universität Darmstadt Department of Computer Science(达姆施塔特工业大学计算机科学系)