Repository navigation
Conversation
|
Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR |
d6fa609 to
3240685
Compare
2674af8 to
2a9f568
Compare
|
Moved the WITH_PCH docs out of the ccache section into their own section; the text is unchanged. |
|
Split the doc commit: the build speed-ups now share a "Speeding up local builds" section; the grouping commit is identical to the one in #72620, so the two PRs merge cleanly in either order. |
|
jenkins test windows |
1 similar comment
|
jenkins test windows |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
Rebased onto main. The WITH_PCH guard now uses MATCHES "Clang" like src/CMakeLists.txt, so AppleClang passes too (untested on macOS). |
|
jenkins test make check. |
|
Rebased onto main. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
Rebased onto main. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
Including dout.h after #undef dout_prefix restores the default prefix only if dout.h was not included before, which a precompiled header does. No other header ConfigMap.cc includes defines dout_prefix, so include dout.h with the others and drop the #undef. Assisted-by: claude-opus-5-5 Signed-off-by: Dominik Raddatz <[email protected]>
With -D_GNU_SOURCE, a precompiled header including <features.h> defines it first, and the plain #define then warns about a redefinition. librbd/migration/FileStream.cc guards it the same way. Assisted-by: claude-opus-5-5 Signed-off-by: Dominik Raddatz <[email protected]>
Precompiles core std, fmt, boost and Ceph headers per target for the targets measured to benefit; rgw, osd, mon, mds, librbd, rbd-mirror and the latter two's unit tests add a few of their own. A whole Debug build takes about 30% less compile CPU with Clang, 15% with GCC. Unlike with CMake's default, warnings in the precompiled headers are reported. With GCC, -dD stops ccache and sccache from returning a stale PCH after a macro change, and deleting the old PCH before rebuilding it lets ccache hit. Assisted-by: claude-opus-5-5 Signed-off-by: Dominik Raddatz <[email protected]>
Assisted-by: claude-opus-5-5 Signed-off-by: Dominik Raddatz <[email protected]>
Adds
WITH_PCH, an opt-in precompiled header (PCH) for the targets measuredto benefit from one. A core payload of
std,fmt,boostand Cephinfrastructure headers goes to all of them;
rgw,osd,mon,mds,librbd,rbd-mirrorand the latter two's unit tests add a few of their ownentry headers, such as
mon/Monitor.h. The header lists, the per-targetfigures and the rule for adding an entry are at the end of
src/CMakeLists.txt.In a Debug build it takes about 30% off the compile CPU of a whole build with
Clang and about 15% with GCC, with or without tests; the listed targets lose a
quarter to two thirds with Clang and a tenth to over a third with GCC. With
Clang, ASAN and TSAN builds gain about the same. The PCHs add about 2GB to the
build tree with Clang and 9GB with GCC.
The option defaults to OFF, so CI and ordinary builds still compile without a
PCH and keep catching translation units that stopped including what they use.
With
WITH_PCH=OFFnothing changes.Compilers and caches
WITH_PCHsupports Clang and GCC;cmakerefuses it with any other compiler.ccache caches objects built against a PCH only with
pch_definesandtime_macrosin its sloppiness. WithWITH_CCACHE, the PCH targets compilethrough a small generated script that appends both to
CCACHE_SLOPPINESSwithout touching
ccache.conf; all other targets and external projects keepplain ccache. Clang also gets
-Xclang -fno-pch-timestampwithWITH_CCACHE,or every rebuilt PCH would make the objects built against it miss.
GCC needs two more fixes (gcc 15.2, ccache 4.12.3, sccache 0.13.0):
CMake builds it from a stub source, both caches can key on its preprocessed
text, and that has no
#defines. ccache guards against this for Clang only.-dDon the PCH targets puts the#defines into that text; it doesn'tchange objects.
.gchas an input of the compile replacing it, andGCC's PCH differs on every build, so every PCH rebuild in an existing tree
made all objects of the target miss. The script deletes the old
.gchfirst.sccache needs neither the script nor
-fno-pch-timestamp.CMake marks its PCH header as a system header, which hides the warnings of
every header in the payload.
WITH_PCHemptiesCMAKE_PCH_PROLOGUE, so theyare reported as without a PCH.
A PCH is built with its target's compile settings, and the compiler can use it
for a source file whose own settings differ, without a warning. Such files are
therefore compiled without the PCH:
rgw/rgw_iam_policy.cc(an includedirectory),
common/version.cc(a definition) and, with GCC,common/config.ccandcommon/options.cc(-fno-var-tracking-assignments).The first two commits fix what a PCH exposes:
mon/ConfigMap.ccrelied onincluding
common/dout.hafter#undef dout_prefixto restore the default,but the PCH has already included it;
MergeDiff.ccredefined_LARGEFILE64_SOURCEafter the PCH's<features.h>had set it, which warns.Testing
Debug and Release, compared with the build without it: no difference changes
behaviour. Unit tests give the same results with and without PCH, also in
ASAN and TSAN builds. With ccache, a rebuild is served entirely from the
cache, and a changed macro in a payload rebuilds the PCH and its users.
static_assert, macro-only changes, switching back,touchand realchanges all build correctly with ccache and with sccache; without
-dD,both return the stale PCH. A fresh tree is served entirely from ccache,
byte-identical to the cold build.
No CI job exercises this code, deliberately: some build has to compile without
a PCH.
Measured on one machine (AMD Ryzen AI 9 HX 370, 24 threads, 64GB) in October
2026; read the figures as ordinal, not exact.
Documentation
The developer guide documents the option under a new "Speeding up local
builds" section, next to ccache. The grouping commit is identical to the one in
#72620, so the two PRs merge cleanly in either order.
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.