[Paper Review] BOLT: A Practical Binary Optimizer for Data Centers and Beyond
BOLT is a post-link binary optimizer built on LLVM that improves performance of large-scale data-center applications by leveraging accurate sample-based profiling for code layout optimizations. It achieves up to 8.0% speedup on production workloads and up to 20.4% on compilers like GCC and Clang, even when combined with feedback-driven and link-time optimizations, demonstrating that post-link optimization complements rather than replaces earlier-stage optimizations.
Performance optimization for large-scale applications has recently become more important as computation continues to move towards data centers. Data-center applications are generally very large and complex, which makes code layout an important optimization to improve their performance. This has motivated recent investigation of practical techniques to improve code layout at both compile time and link time. Although post-link optimizers had some success in the past, no recent work has explored their benefits in the context of modern data-center applications. In this paper, we present BOLT, a post-link optimizer built on top of the LLVM framework. Utilizing sample-based profiling, BOLT boosts the performance of real-world applications even for highly optimized binaries built with both feedback-driven optimizations (FDO) and link-time optimizations (LTO). We demonstrate that post-link performance improvements are complementary to conventional compiler optimizations, even when the latter are done at a whole-program level and in the presence of profile information. We evaluated BOLT on both Facebook data-center workloads and open-source compilers. For data-center applications, BOLT achieves up to 8.0% performance speedups on top of profile-guided function reordering and LTO. For the GCC and Clang compilers, our evaluation shows that BOLT speeds up their binaries by up to 20.4% on top of FDO and LTO, and up to 52.1% if the binaries are built without FDO and LTO.
Motivation & Objective
- To address performance bottlenecks in large, complex data-center applications caused by poor code locality and pressure on hardware structures like caches and branch predictors.
- To explore whether post-link binary optimization can outperform or complement traditional compile-time and link-time feedback-driven optimizations (FDO) in real-world workloads.
- To demonstrate that sample-based profiling at the binary level enables more accurate code layout than compiler-based approaches that must map profile data back to intermediate representations.
- To build a practical, open-source, retargetable binary optimizer that integrates with the LLVM infrastructure and scales to production workloads.
- To evaluate the performance gains of BOLT in isolation and in combination with existing optimizations like FDO and LTO.
Proposed method
- BOLT operates as a post-link optimizer on fully linked binaries, using sample-based profiling data collected from production workloads to guide code layout optimizations.
- It leverages low-level profiling information from hardware performance counters, including LBR (Last Branch Record) data, to obtain fine-grained, accurate execution profiles at the binary level.
- The tool reorders functions and basic blocks based on profile-driven heuristics, such as call frequency and execution hotness, to improve instruction cache and branch predictor efficiency.
- BOLT is implemented on top of the LLVM infrastructure, enabling retargetability across multiple instruction set architectures and integration with existing compilation pipelines.
- It performs static binary analysis to reconstruct control flow and data flow information from machine code, enabling accurate layout decisions without source code or intermediate representations.
- The system supports incremental deployment and operates on unmodified binaries, minimizing operational overhead and enabling production use.
Experimental results
Research questions
- RQ1Can a post-link binary optimizer achieve better code layout accuracy than compiler-based FDO by avoiding the need to map profile data back to intermediate representations?
- RQ2To what extent do post-link optimizations complement rather than overlap with existing feedback-driven and link-time optimizations in large-scale applications?
- RQ3How significant are performance improvements from post-link code layout when applied to highly optimized binaries already using FDO and LTO?
- RQ4What is the impact of fine-grained profiling, such as LBR-based data, on the effectiveness of basic block and function reordering in production binaries?
- RQ5Can a practical, production-ready binary optimizer built on LLVM deliver measurable performance gains across diverse, real-world data-center workloads?
Key findings
- BOLT achieves up to 8.0% performance speedup on Facebook’s production data-center workloads when applied after FDO and LTO, demonstrating significant gains even on already-optimized binaries.
- For the GCC and Clang compilers, BOLT delivers up to 20.4% performance improvement on top of FDO and LTO, and up to 52.1% when binaries are built without FDO and LTO.
- The performance gains are primarily due to improved code layout, with basic block reordering contributing more significantly than function reordering, especially when using LBR-based profiling.
- Profile accuracy at the binary level enables better layout decisions than compiler-based approaches, which must map profile data back to intermediate representations, often introducing inaccuracies.
- Post-link optimization is not inferior to earlier-stage FDO; instead, it is complementary, with combined use of FDO and BOLT yielding higher performance than either alone.
- The use of LBRs contributes approximately 2% of the total performance improvement in HHVM, highlighting the value of fine-grained profiling for low-level layout optimizations.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.