Repository navigation
Build amd_release without ThinLTO in PRs that skip the AMD performance comparison - #131328
Conversation
…nce comparison The AMD performance comparison runs in a PR only with `pr-performance`, `ci-performance`, a "Performance Improvement" changelog category, or a full ARM run. Over 2026-11-06 to 2026-11-13, 2569 of 2983 PR `amd_release` builds (86%) had no AMD performance comparison, but still paid for ThinLTO: the median `Build ClickHouse` step of `amd_release` is 20 minutes, of `amd_binary` 4. Without ThinLTO, PGO and BOLT, the compile commands of `amd_release` equal those of `amd_binary` (16224 of 16227 common translation units, checked by diffing `compile_commands.json`), which master builds on every commit, so sccache serves the compilation and the build is mostly the link. Its other consumers (packages, `Install packages`, `Compatibility check`, integration tests, `ClickBench`, `Upgrade check`) do not depend on how the binary is optimized. `arm_release` keeps ThinLTO: the ARM performance comparison runs in nearly every PR. The decision is made in a pre-hook (`configure_amd_release_thinlto`), because `ci-force-all` bypasses the filter hooks and then runs every performance job. Praktika gets a generic per-job digest salt from the workflow kv data (`job_digest_salts`), so that the non-LTO build is cached separately and a later run with the same digest that does run the AMD comparison (e.g. after adding `pr-performance`) cannot reuse the non-LTO binary. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [39860b3] Summary: ✅
AI ReviewSummaryThe PR builds Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units6 translation units recompiled, 3 s compile time in total, 6 of them have a recent master baseline. |
|
LGTM so far |
The two variants of `Build (amd_release)` (with and without ThinLTO) had different cache digests but uploaded to the same `PRs/<pr>/<sha>/pr/build_amd_release` directory. A rerun at the same commit with the other variant overwrote the artifacts, and the cache record of the first variant then restored the binary of the second one, so an AMD performance comparison could measure a non-LTO binary. `Cache.artifact_dir` appends the salt of a salted job to its artifact directory, and the runner uses it for both upload and download. A cache record of a salted job has a salted digest, so a run reusing it has the same salt and resolves the same directory. Address review: #131328 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=131328&sha=b9911c0f6a8122acc72052a8bc1084928cb313bf&name_0=PR&name_1=Stress%20test%20%28amd_debug%29 ( |
|
The fix in progress is #124111 (mine, open, waiting for review). The query in Debug builds of master 6ea176f, without and with the #124111 diff (it applies cleanly):
Rows 2-4 are reduced versions of queries from the other carriers in your list. My other open PR, #121089, which I linked earlier for the |
…-thinlto Conflicts in the workflow pre-hooks: keep both `configure_amd_release_thinlto` and the new `configure_toolchain_builds`.
A local job run with `--pr`/`--sha` creates fresh kv data, so `Cache.artifact_dir` did not know that the producing run salted `Build (amd_release)` and looked for its artifacts in `build_amd_release/` instead of `build_amd_release_without_thinlto/`. `CacheRunnerHooks.configure` now publishes the run's digest salts as `job_digest_salts.json` under the run's S3 prefix (always, so that a rerun at the same commit without salts replaces them), and `Runner.generate_local_run_environment` restores them into the kv data. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=131328&sha=b459812fb7a10eb5fd8599ac1e79bc3bfa1d16cc&name_0=PR&name_1=Performance%20Comparison%20%28amd_release%2C%20master_head%2C%203%2F6%29 (also shard 6/6: |
|
I checked these. The 57
The |
|
The fix for the second group is #132767: the selected tests are now split over the shards by their measured runtimes instead of round robin by name. Replayed on today's killed run (report), the heaviest shard goes from 92 to 68 min of tests. One correction to my comment above: the 15 kills on 2026-11-12..11-14 were caused by that PR's own binary. On the same tests it took about 1.8 times the master time in total (CI DB per-test runtimes), and its ARM shards in full mode were killed too, so #132767 does not change those. |
|
🕵 Merged master (pulls in #131772). The remaining red check, |
|
📊 Cloud Performance Report
PR verdict: not_sure. 1 measured difference(s) not attributable to this PR. clickbench Q10: The measured difference cannot be attributed to this PR from the available source evidence. The tested merge 78285a20 differs from its master parent 8486bd17 only in CI Python files: ci/jobs/build_clickhouse.py, ci/jobs/scripts/workflow_hooks/filter_job.py, ci/praktika/cache.py, ci/praktika/hook_cache.py, ci/praktika/runner.py and ci/workflows/pull_request.py. No server source changed, so Q10's GROUP BY MobilePhoneModel with COUNT(DISTINCT UserID) runs the same code as on master. The only change that could affect the binary is configure_amd_release_thinlto, which drops ThinLTO/PGO/BOLT from … clickbenchFlagged queries (1 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
… without ThinLTO Since #131328 was merged, the artifacts of a salted job are stored in a directory of their own (`Cache.artifact_dir`), so a build without ThinLTO no longer overwrites the ThinLTO build of the same commit. The salt unique to the run attempt that `record_thinlto_choice` gave to the ThinLTO variant was there only because of that overwrite. After the last merge of master it also moved the ThinLTO `amd_release` binary to `build_amd_release_with_thinlto_run_<id>_<attempt>/`, where `double_check_perf.py` and the `perf-comparison` recipes do not look. So `record_thinlto_choice` is removed, and `configure_amd_release_thinlto` is the one of master again, with one difference: it records the build type in the list `builds_without_thinlto` instead of the flag `amd_release_without_thinlto`, so that the PR workflow of the private repository can list its own builds there. The ThinLTO variant is not salted, it is cached as before and stays in `build_amd_release/`. The optimization mode check in `double_check_perf.py` is removed as well: the directory that it downloads from never holds a build without ThinLTO. The `LINK_FLAGS` check in `performance_tests.py` stays, for local runs: they download the variant that the run at that commit built. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Build
amd_releasewithout ThinLTO in PRs that skip the AMD performance comparison: there it is the only consumer that cares how the binary is optimized.The AMD performance comparison runs in a PR only with
pr-performance,ci-performance, a "Performance Improvement" changelog category, or a full ARM run. Over 2026-11-06 to 2026-11-13 (CI DB), 2569 of 2983 PRamd_releasebuilds (86%) had no AMD performance comparison, but still paid for ThinLTO: about 1060 runner-hours ofarm-largein that week. The medianBuild ClickHousestep is 19.9 minutes foramd_releaseand 4.0 forarm_binary. The release build also gates theamd_releaseintegration tests, packages and Docker images, so they start earlier.Without ThinLTO, PGO and BOLT, the compile commands of
amd_releaseare the same as those ofamd_binary: 16224 of 16227 common translation units, checked by diffingcompile_commands.jsonof both cmake configurations. The current PRamd_releaseshares only 298 of them (-flto=thin -fwhole-program-vtables -g0). Master buildsamd_binaryon every commit, so sccache already holds these objects and the build is mostly the link. The standaloneclickhouse-keeperobjects (166) are the exception; #130819 removes them.The other consumers (packages,
Install packages,Compatibility check, integration tests,Upgrade check,ClickBench, which checks correctness and not timings, the oracle AST fuzzer) do not depend on LTO.arm_releasekeeps ThinLTO, because the ARM comparison runs in nearly every PR (coverage selection still picks more than 200 test files in most of them), so ThinLTO miscompilations stay covered in PRs. Master, backports, release branches and the private repository are unchanged.How:
configure_amd_release_thinlto(a pre-hook of the PR workflow) makes the decision with the same predicate as the filter that skips the AMD comparison (now the shared_amd_performance_skipped). It is a pre-hook becauseci-force-allbypasses the filter hooks and then runs every performance job, so that case keeps ThinLTO.Praktika gets a generic per-job digest salt from the workflow kv data (
job_digest_salts). The non-LTO build and its dependents are cached under their own digest. A PR run may reuse any cached record, so without the salt a later run with the same digest that does run the AMD comparison (e.g. after addingpr-performance) could reuse a non-LTO binary. Trusted workflows never reuse PR records anyway.build_clickhouse.pyreads the flag and configures with-DENABLE_THINLTO=0and without PGO/BOLT.flavor_cmake_optionsthen does not add-DDISABLE_ALL_DEBUG_SYMBOLS=1, as inamd_binary.The artifacts of a salted job go to their own S3 directory (
Cache.artifact_dir, e.g.build_amd_release_without_thinlto), so the two variants built at the same commit (e.g. whenpr-performanceis added and removed) do not overwrite each other, and a cache record of one variant never restores the binary of the other.This PR changes
ci/jobs/build_clickhouse.py, which is a build change for the performance selection, so its own run keeps the AMD comparison and ThinLTO: it does not validate the non-LTO build time. The cache-hit claim is checked by thecompile_commands.jsoncomparison above; the build time will show in the first PRs after the merge.Related: #130824
Related: #130819
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/131328]
Version info
26.12.1.26-master(included in26.12and later)