Repository navigation
Perf CI: compare PR builds with a master build compiled with the PR flags - #124676
Algunenano merged 8 commits into
Conversation
In `master_head` mode the PR performance comparison used master's official release build as the reference. That build keeps debug info and sets `-DCLICKHOUSE_OFFICIAL_BUILD=1`, while a PR release build has `-DDISABLE_ALL_DEBUG_SYMBOLS=1` and no official flag. Both change the generated code (XRay instruments ~11k more functions when debug info is present, and the official flag adds code), so the same sources give two binaries with different code layout. The CI-only ClickHouse#123849 has 0x65500 bytes less code than the official build of its own base e95690a and was 21.6% slower on `window_functions_distinct ClickHouse#2`. On some master bases a hot loop lands on a slow placement only in the PR flavour, and every PR on that base then reds (seen on ClickHouse#100391). MasterCI's `Build (amd|arm_release_pr_cache_warmup)` jobs already compile master with exactly the PR cmake flags. They now also link `clickhouse-self-extracting` and upload it, and take the PGO/BOLT decision of the release build they mirror, as a PR build does. For PR runs of the public repository, `find_prev_build` prefers that binary. When the base has none it walks back only over commits where MasterCI skipped the warmup job (a skipped job means its inputs did not change, so the older build has the same sources); anything else falls back to the official build. Replayed over 14 days of PR references, 332 of 356 get a build with identical compiled sources and none gets different sources. Master runs (official vs official) and local runs are unchanged. The report parsing of `classify_missing_prev_master_run` moves into `master_job_status`, shared by both walks. The arm warmup's build-profile upload stays what it was (compiled objects): the server link trace is deleted before extraction and the symbol table of the linked binary is not uploaded, so the shared build-profile cluster gets no new load. Cost: ~24 min (amd) and ~39 min (arm) of ThinLTO link per warmup run and ~540 MB of S3 per run with default retention. MasterCI wall clock is unchanged and no PR job is added. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The warmup builds now take the PGO decision of the release build they mirror, so a warmup with a profile enters the "build with PGO failed" retry. That retry ran only `ninja <targets>`, which for a warmup is the server link alone: a PGO failure in an object outside the server target would give a green warmup that skipped the all-object cache warmup. Rerun the command of the first attempt instead; for every other PGO-eligible build it is the same `ninja <targets>` as before. Also map an explicit `"status": null` in the master report like a missing status in `master_job_status`, as the code before the refactor did, and say in the build profile hook comments that only the server binary's link trace and symbols are kept out of the warmup upload. 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; 3 findings over 3 runs, the last one clean) plus my own cold reviews (4 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261008-151800 |
|
Workflow [PR], commit [1087a07] Summary: ✅
AI ReviewSummaryThe PR builds master performance references with the public PR release flags, selects them for PR performance comparisons, and preserves official references for master and private PRs. Review of commit Final Verdict✅ Approve. No unresolved findings or new inline comments. Verification used mocked build commands; no full ClickHouse build was performed. |
…ence-built-with-pr-flags Co-Authored-By: Claude Opus 5.5 <[email protected]>
The warmup build now links and records its binaries in binary_sizes, so a warmup upload without object rows would be taken as a complete baseline and the object-size section would report every PR object as added. Co-Authored-By: Claude Opus 5.5 <[email protected]>
find_warmup_baseline picks the warmup commit by an object-file row, but resolve_run then took the newest binary_sizes run of that commit. A rerun that recorded only the linked binaries would become the warmup side, and compare_objects would report every PR object file as added. resolve_run gets an optional filter, and the warmup side passes OBJECT_FILTER, the same predicate as the marker. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
CI finish ledger - c29da3bEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261011-013008 |
…ence-built-with-pr-flags
Build profile diff (arm_release)Commit See the job log for details. |
CI finish ledger - 9d26d5cEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261011-053007 |
|
@groeneai i think the goal is correct, but i am not sure the tradeoff is right what are other options you have considered with smaller blast radius? |
|
Thanks. Options I considered, with their cost:
I would pick 4. Before sending it, I would build one commit with |
|
@groeneai I think the best option is to make an extra master build with the same flags as the PRs, for 2 reasons:
So please, add a new build (reusing the profile build as you did is fine), but make sure the binary is built exactly with the same flags (let's put flags and cmake options like no debug in a common place) and that we name this binary something understandable like |
…ence-built-with-pr-flags # Conflicts: # ci/defs/defs.py
…e_reference` Review on ClickHouse#124676: keep reusing the MasterCI build that compiles master with the PR flags, but make it explicit that its binary is the performance reference, and keep the cmake options that tell an official build from a PR build in one place so the reference cannot drift from a PR build. - Rename `Build (amd|arm_release_pr_cache_warmup)` to `Build (amd|arm_release_performance_reference)`, with the artifacts `CH_AMD|ARM_RELEASE_PERFORMANCE_REFERENCE`. The job still compiles every object with the shared sccache read-write, and the arm one still uploads the build profile baseline, now under the new check name. - `flavor_cmake_options` in build_clickhouse.py is the only place that adds `-DCLICKHOUSE_OFFICIAL_BUILD=1` (official) or `-DDISABLE_ALL_DEBUG_SYMBOLS=1` (PR, public, ThinLTO). A reference build takes the PR options, the cmake line of its release build type and that build's PGO/BOLT decision. Behavior is unchanged: for every build type, master/PR, public/private and with/without PGO+BOLT profiles, main() produces the same cmake and build commands as before the refactor (280 combinations), and the reference cmake equals the PR release cmake for amd and arm. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Done in 1087a07, plus a master merge for the conflict in
The arm build's Build profile diff baseline is now stored under the new name, so it restarts from the first master run after the merge. |
|
@groeneai How does the transition to use these images work? What happens when we merge and there isn't any build yet? |
|
Nothing has to be done by hand at merge. The PR perf job looks the reference up on S3 in every run (no job
|
Related: #100391
Related: #122350
Related: #124592
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Performance Comparison (amd_release, master_head, 6/6)failed on #100391:window_functions_distinct #211.0 -> 13.9 ms, a query reading onlynumbers.In
master_headmode the reference is master's official build, which keeps debug info and sets-DCLICKHOUSE_OFFICIAL_BUILD=1. A PR build has neither, so the same sources give different binaries: the CI-only #123849 has 0x65500 bytes less code than the official build of its base and was 21.6% slower on that query. On some bases a hot loop lands on a placement slow only in the PR flavour: on bases1899759dcd6,e95690ab45b,516006f49ad18 of 25 PR runs were >15% slower, elsewhere 4 of 169, master against master 0 of 90.Change:
Build (amd|arm_release_pr_cache_warmup), which compile master with the PR flags, becomeBuild (amd|arm_release_performance_reference)and now link and upload the server binary, with the release build's PGO/BOLT. The options that tell an official build from a PR build (-DCLICKHOUSE_OFFICIAL_BUILD=1,-DDISABLE_ALL_DEBUG_SYMBOLS=1) are set in one place,flavor_cmake_options.performance_tests.pyuse that binary as the reference. Past the first official build, the lookup crosses only commits where MasterCI skipped the job (same sources), else keeps the official build. Over 14 days, 332 of 356 references get one, none with different sources. Master runs still compare official builds.Tested: every build type's cmake command is unchanged and the reference's equals a PR build's; stubbed walk; read-only S3 probes.
Cost: the link adds ~24 min (amd) and ~39 min (arm) per reference run, ~40-70 ARM runner-hours/day, ~540 MB S3 per run. MasterCI wall clock is unchanged; no PR job is added. The Build profile diff baseline restarts under the new name.
Not fixed: placement shifts from a PR's own code, and per-process (PIE) noise. #124592 calls a reference found over skipped commits stale, though its sources match.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124676]
Version info
26.11.1.277-master(included in26.11and later)