Repository navigation
Add utils/download-ci-toolchain.sh to compile ClickHouse with CI's PGO+BOLT Clang - #130239
Conversation
The script reads the toolchain pin from `ci/docker/binary-builder/Dockerfile`, downloads the archive that the CI build image installs, keeps only the compiler and its resource directory, and prints the `CC` and `CXX` export line. It prints the names that `ToolSet` in `ci/defs/defs.py` gives and CI compiles with (`clang-22`, `clang++-22`). CMake's binutils detection takes the version suffix from the compiler's file name: with the unversioned `clang` it finds GNU `objcopy`, the Rust strip step run with it keeps the COMDAT group of the localized `DW.ref.rust_eh_personality`, and the Debug build fails to link. It never deletes or replaces anything it did not create: it downloads only when nothing exists at `<cache>/<commit>-<arch>`, into a `mktemp` directory that an `EXIT` trap removes, and publishes it with `mv -T`. It refuses when the archive has no `bin/<ToolSet.COMPILER_C>` or `bin/<ToolSet.COMPILER_CPP>`, so it never hands out a compiler that CI no longer compiles with. Add a Tip about it to the build docs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261109-021400 |
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
|
cc @thevar1able, could you review this and add the |
|
Workflow [PR], commit [34940a5] Summary: ✅ AI ReviewSummaryReviewed #130239 at Missing context / blind spots
Final Verdict✅ Approve. No new inline comments or changes to existing threads are needed. |
f229367
Related: #130064
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add
utils/download-ci-toolchain.sh, which downloads the Clang that CI compiles with (the same release as apt.llvm.org, optimized with PGO and BOLT) for local builds; it compiles ClickHouse about 20% faster on x86_64.Description
CI compiles ClickHouse with Clang 22.1.8 built with PGO and BOLT (#97031), from the same LLVM commit as the apt.llvm.org
clang-22that the build docs install, but only the CI build image has it.utils/download-ci-toolchain.shreads the pin (TOOLCHAIN_COMMIT) fromci/docker/binary-builder/Dockerfile, downloads the archive that image installs, keeps only the compiler and its resource directory (about 350 MB of the 1.8 GB archive), and printsexport CC=... CXX=...foreval. As in CI, only the compiler comes from the archive: the build keeps using the installedld.lld-22andllvm-*-22tools (CI log:Using linker: /usr/bin/ld.lld-22). It prints the versioned names thatToolSetinci/defs/defs.pygives (clang-22,clang++-22), because CMake takes the binutils version suffix from the compiler's file name; with plainclangit picks GNUobjcopyand the Rust symbol-stripping step breaks the link. It refuses when the pinned archive has noToolSetcompiler (for example after aToolSetbump before the pin moves), and it never deletes or replaces a directory it did not create. A<Tip>in the build docs points to it. The compiler needs glibc 2.38 or newer.Measured on x86_64 (356 sampled translation units, apt vs CI clang, ABBA passes): 22.8% less compile CPU in Debug and 21.9% in RelWithDebInfo; the objects are identical except debug info and
.comment. The issue comment that proposed this measured a 22.6% shorter clean build on a 16-vCPU ARM host: #130064 (comment)Validated locally, as CI does not run developer tooling that downloads 1.8 GB: fresh, cached and foreign cache directories, interrupted downloads, both pin formats, compiler-name skew; a Debug build configured with the printed line links, CMake picks the same
llvm-*-22tools as with aptclang-22, andclickhouse localruns.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/130239]
Version info
26.11.1.1767-master(included in26.11and later)