Profile-guided optimizations rely on profile data for directing compilers to generate optimized code. To achieve the maximum performance boost, profile data needs to be collected on the same version of the binary that is being optimized. In practice however, there is typically a gap between the profile collection and the release, which makes a portion of the profile invalid for optimizations. This phenomenon is known as profile staleness, and it is a serious practical problem for data-center workloads both for compilers and binary optimizers. In this paper we thoroughly study the staleness problem and propose the first practical solution for utilizing profiles collected on binaries built from several revisions behind the release. Our algorithm is developed and implemented in a mainstream open-source post-link optimizer, BOLT. An extensive evaluation on a variety of standalone benchmarks and production services indicates that the new method recovers up to $0.8$ of the maximum BOLT benefit, even when most of the input profile data is stale and would have been discarded by the optimizer otherwise.
翻译:配置文件引导优化依赖配置文件数据来指导编译器生成优化后的代码。为获得最大性能提升,配置文件数据需在待优化二进制文件的同一版本上采集。然而在实际应用中,从配置文件采集到发布版本之间通常存在时间差,导致部分配置文件数据对优化无效。这种现象被称为配置文件过时问题,对于数据中心工作负载下的编译器和二进制优化器而言,这是一个严峻的实际问题。本文对配置文件过时问题进行了深入研究,并提出了首个基于先前多个版本构建的二进制文件所采集配置文件的实用解决方案。该算法已在主流开源链接后优化器BOLT中开发实现。针对各类独立基准测试和线上服务的广泛评估表明,即使输入配置文件中大部分数据已过时且通常会被优化器丢弃,新方法仍能恢复BOLT最大优化收益的0.8。