Protean Compiler: 一种驱动细粒度阶段排序的敏捷框架
Protean Compiler: An Agile Framework to Drive Fine-grain Phase Ordering
AI总结:
提出Protean Compiler框架,在LLVM中内置细粒度阶段排序能力,通过140多种静态特征收集方法和机器学习优化,平均加速4.1%,最高15.7%。
摘要:
阶段排序问题自20世纪70年代末以来一直是一个长期挑战,但由于其优化空间巨大且具有无界性,至今仍是一个开放问题,没有有限解。传统上,这种局部优化决策由手工编码的算法针对少量基准测试进行调整,当基准测试套件变化时,通常需要大量精力重新调整。过去20年中,机器学习被用于构建性能模型以改进编译器优化的选择和排序,但这些方法并未无缝集成到编译器中,也从未在细粒度的代码段范围内实现。本文提出Protean Compiler:一种敏捷框架,使LLVM在细粒度范围内具备内置的阶段排序能力。该框架还包含一个完整的库,包含140多种在不同范围内手工设计的静态特征收集方法,实验结果表明,相对于LLVM的O3,在Cbench应用程序上仅需增加几秒构建时间,平均加速可达4.1%,最高可达15.7%。此外,Protean编译器易于与第三方ML框架和其他大型语言模型集成,两步优化的两个应用在CBench的Susan和Jpeg应用程序上相对于-O3分别获得10.1%和8.5%的加速。Protean编译器无缝集成到LLVM中,可作为新的、增强的、全功能的编译器使用。我们计划在不久的将来将该项目发布到开源社区。
英文摘要:
The phase ordering problem has been a long-standing challenge since the late 1970s, yet it remains an open problem due to having a vast optimization space and an unbounded nature, making it an open-ended problem without a finite solution, one can limit the scope by reducing the number and the length of optimizations. Traditionally, such locally optimized decisions are made by hand-coded algorithms tuned for a small number of benchmarks, often requiring significant effort to be retuned when the benchmark suite changes. In the past 20 years, Machine Learning has been employed to construct performance models to improve the selection and ordering of compiler optimizations, however, the approaches are not baked into the compiler seamlessly and never materialized to be leveraged at a fine-grained scope of code segments. This paper presents Protean Compiler: An agile framework to enable LLVM with built-in phase-ordering capabilities at a fine-grained scope. The framework also comprises a complete library of more than 140 handcrafted static feature collection methods at varying scopes, and the experimental results showcase speedup gains of up to 4.1% on average and up to 15.7% on select Cbench applications wrt LLVM's O3 by just incurring a few extra seconds of build time on Cbench. Additionally, Protean compiler allows for an easy integration with third-party ML frameworks and other Large Language Models, and two applications of this two-step optimization show a gain of 10.1\% and 8.5\% speedup w.r.t. -O3 on CBench's Susan and Jpeg applications. Protean compiler is seamlessly integrated into LLVM and can be used as a new, enhanced, full-fledged compiler. We plan to release the project to the open-source community in the near future.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。