PyTorch's LLVM BOLT integration speeds up CUDA builds by 30%
PyTorch now ships BOLT-optimized CUDA binaries, boosting some workloads up to 30% out of the box.
PyTorch has merged a significant pull request that brings LLVM BOLT, a post-link optimizer, directly into its CUDA build process. BOLT works by collecting execution profiles with perf and then rearranging the application's code layout to improve instruction-cache locality. The PR, authored by lakshayg and assisted by Claude Opus 4.8, ships pre-collected profiles from a curated set of workloads, meaning CUDA builds are now optimized by default without users needing to generate their own profiles. The build-time step moves the unoptimized library into a prebolt/ subdirectory, then runs llvm-bolt to write the optimized version back to the canonical path.
BOLT is enabled by default only on Linux + aarch64 + CUDA when llvm-bolt (version 21 or newer) is detected and USE_PRIORITIZED_TEXT_FOR_LD is turned on, since the shipped profiles were collected from builds using that linker script optimization. The result is up to 30% performance improvement on some internal workloads, with a worst-case regression of only 3% on others. Caveats include the use of stale profiles as the codebase evolves, a significant libtorch.so size increase in RelWithDebInfo mode (from ~60K to ~6M due to hot/cold section padding), and best-effort debug info reconstruction that may affect stacktraces. ARM has also recommended this approach, and NVIDIA already uses BOLT in its PyTorch containers since release 26.04.
- LLVM BOLT post-link optimizer integrated directly into PyTorch CUDA builds via PR #186245
- Delivers up to 30% speedup on internal workloads, with max 3% regression; default ON for Linux+aarch64+CUDA with llvm-bolt >=21
- Prepacks perf-based profiles, so most users get optimized binaries automatically without extra setup
Why It Matters
ARM-based PyTorch CUDA users gain up to 30% faster performance for free, just by building from source.