Skip to content

Build profile diff: do not report the debug-info offset as a size change - #116639

Merged
alexey-milovidov merged 5 commits into
masterfrom
build-profile-diff-hide-xray-offset
Aug 29, 2026
Merged

alexey-milovidov merged 5 commits into
masterfrom
build-profile-diff-hide-xray-offset

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Related: llvm/llvm-project#219100

The headline size row of Build profile diff (arm_release) showed a roughly -3 MB delta on essentially every pull request, no-op ones included. That delta is not the pull request.

The row compares the pull request's programs/clickhouse-stripped against the official master Build (arm_release), and the two differ in exactly two cmake flags: master gets -DCLICKHOUSE_OFFICIAL_BUILD=1, the pull request gets -DDISABLE_ALL_DEBUG_SYMBOLS=1. strip --strip-debug does not undo the second one, because debug info reaches the code itself through XRay: whether a loop-free function is instrumented is decided by counting MachineInstrs with the debug pseudo-instructions included (MICount += MBB.size() in llvm/lib/CodeGen/XRayInstrumentation.cpp), so with -g thousands of functions just under the 200-instruction threshold get entry/exit sleds that the pull request build never emits.

Measured on master 9d8eed34c114 against #116614, both binaries re-stripped locally from the CI artifacts and matching the build logs byte for byte (746,549,896 vs 743,343,016):

section Δ bytes (master − PR)
.symtab +1,059,096
.text +989,952
xray_instr_map +925,024
xray_fn_idx +176,448
.strtab +39,895
.eh_frame / .gcc_except_table / .eh_frame_hdr +16,436
.clickhouse.hash +32

All of it reconciles to 11,028 extra instrumented functions in the official build: xray_fn_idx grows by exactly that many 16-byte entries, .symtab by 2 × 11,028 .Lxray_sleds_start*/.Lxray_fn_idx* labels plus 22,063 AArch64 $d mapping symbols, and .text by 28,907 sleds of 32 bytes plus -falign-functions=64 padding. CLICKHOUSE_OFFICIAL_BUILD contributes 32 bytes.

So the number was a property of the flag pair, always in the same direction, and it invited a hunt for a size win that does not exist. A delta that lands on that offset is therefore no longer shown, only named with the reason, and rows that are still shown carry the offset as a note.

The suppressed interval is a window centred on the measurement, not everything up to it: XRAY_DEBUG_OFFSET_RATIO is the measured 0.43% and XRAY_DEBUG_OFFSET_TOLERANCE its relative half-width, so only a delta in [-4.59 MiB, -1.53 MiB] is hidden. Reaching up to zero instead would have swallowed a real pull request that grows the binary by less than the offset - it still compares smaller than master - which is a false green rather than removed noise. Significance is also decided before the window, so a flagged row is never hidden.

This does hide a genuine 3 MiB saving too, and there is no way around that while the baseline is the official build - the two are indistinguishable here. Recovering the exact number needs either a baseline compiled with the pull request's flags (the warmup build, once it links a binary of its own) or the offset gone from the compiler, which is what the linked LLVM pull request does.

ci/tests/test_build_profile_diff_xray_offset.py pins the suppression against the two real measured sizes, and pins that it does not swallow a growing binary, a pull request that grows the binary by less than the offset, a shrink beyond the window, a significant shrink, or a lost PR-side size row.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Workflow [PR]
Sync PR [sync-upstream/pr/116639]

Version info

  • Merged into: 26.9.1.340 (included in 26.9 and later)

The headline size row of `Build profile diff` compares the pull request's
`clickhouse-stripped` against the official master `Build (arm_release)`, and
showed a roughly -3 MB delta on essentially every pull request. That delta is
not the pull request.

A pull request build passes `-DDISABLE_ALL_DEBUG_SYMBOLS=1` and the official
master build does not, and `strip --strip-debug` does not undo the difference,
because debug info reaches the code itself through XRay: whether a loop-free
function is instrumented is decided by counting MachineInstrs with the debug
pseudo-instructions included (`MICount += MBB.size()` in
`llvm/lib/CodeGen/XRayInstrumentation.cpp`), so with `-g` thousands of functions
just under the 200-instruction threshold get entry/exit sleds that the pull
request build never emits.

Measured on master 9d8eed3 against #116614: 11028 extra instrumented
functions in the official build, 3,206,880 bytes of a 746,549,896-byte stripped
binary (0.43%) - `xray_instr_map` +925,024, `xray_fn_idx` +176,448, `.text`
+989,952 of sled NOPs, and `.symtab` +1,059,096 / `.strtab` +39,895 for the
`.Lxray_*` and `$d` symbols the new per-function sections add. Nothing a pull
request can influence, and always in the same direction.

A smaller-binary delta inside twice that band is therefore no longer shown, only
named with the reason. A delta in the other direction cannot be the offset, and
significance is decided before the band, so a flagged row is never hidden. Rows
that are still shown carry the offset as a note, so a rendered negative delta is
read with it in mind.

The compiler side is fixed upstream in llvm/llvm-project#219100; once that
reaches the toolchain the band can go away and the row becomes exact again.
@clickhouse-gh

clickhouse-gh Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b316b30]

Summary: ✅


AI Review

Summary

This PR updates Build profile diff so the headline clickhouse-stripped row no longer reports the known master-only XRay/debug-info size offset as if it were a pull-request change, while still surfacing deltas that move materially away from that offset. The current implementation matches that contract, the earlier review points are fixed on the current head, and the added regression coverage is focused on the right edge cases.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 27, 2026
Comment thread ci/jobs/build_profile_diff_job.py Resolved
The suppression band reached from the measured offset all the way to zero, so a
pull request that grew `clickhouse-stripped` by less than the offset still
compared smaller than the official master build and had its row dropped
entirely - a real regression turned into a silent omission.

Hide a window *centred* on the measured offset instead
(`XRAY_DEBUG_OFFSET_RATIO` is now the measurement itself, `0.43%`, and
`XRAY_DEBUG_OFFSET_TOLERANCE` its half-width), so a delta that differs from the
offset by more than half of it is shown in either direction. The reported
scenario - `+2 MiB` of real growth landing at `-1.06 MiB` against master - is
now rendered, and `test_growth_smaller_than_the_offset_is_still_reported` pins
it.
@clickhouse-gh clickhouse-gh Bot added the submodule changed At least one submodule changed in this PR. label Aug 28, 2026
Comment thread contrib/cctz Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing b316b305a with master 0cba27059 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

@clickhouse-gh

clickhouse-gh Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 40 queries analysed

This is a CI/tooling PR: it only edits the build-profile-diff reporting script, adds a test for it, and bumps the cctz timezone submodule. ClickBench Q30 and Q31 are GROUP BY aggregation queries that touch none of that (no date/timezone work), and both deltas (+23.7% and +20.3%) fall inside master's current variance band with CPU time essentially unchanged. The deterministic gates already held both at not_sure as within-baseline-envelope, which is correct — these are run-to-run variance, not a PR effect.

clickbench

⚠️ 2 inconclusive

Flagged queries (2 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
⚠️ 30 not_sure 232 287 +23.7% <0.0001 aggregation: Q30 is a GROUP BY aggregation; the +23.7% wall-clock delta sits inside master's current variance band with CPU essentially flat (2457 vs 2515 ms), and this PR only touches CI reporting and a cctz timezone bump, so it is run-to-run variance.
⚠️ 31 not_sure 305 367 +20.3% <0.0001 aggregation: Q31 is the same GROUP BY aggregation shape; the +20.3% delta is within the baseline envelope with near-flat CPU (3482 vs 3517 ms), and nothing this PR changes runs in that path, so treat it as noise.

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
  • StressHouse run: 80959e96-03a0-4ec6-a77e-47eff2034343
  • MIRAI run: 89700f89-332b-4bda-8c48-a7665403749a
  • PR check IDs:
    • clickbench_276380_1787973297
    • clickbench_276386_1787973297
    • clickbench_276392_1787973297
    • tpch_adapted_1_official_276403_1787973297
    • tpch_adapted_1_official_276437_1787973297
    • tpch_adapted_1_official_276451_1787973297

The previous commit was made with a stale submodule checkout, which pushed
`contrib/cctz` back from the tzdata 2026c bump (`8e694da`) to `c2ba12b`.
The pull request only touches `ci/`, so the gitlink is restored to the value
on `master`.
@alexey-milovidov alexey-milovidov self-assigned this Aug 29, 2026
@alexey-milovidov alexey-milovidov removed the submodule changed At least one submodule changed in this PR. label Aug 29, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 29, 2026
Merged via the queue into master with commit b6d7bd5 Aug 29, 2026
174 checks passed
@alexey-milovidov
alexey-milovidov deleted the build-profile-diff-hide-xray-offset branch August 29, 2026 14:27
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 29, 2026
alexey-milovidov added a commit that referenced this pull request Aug 29, 2026
…it added

Three `ci/tests` files this pull request deletes were modified on master
(`test_gh.py`, `test_hung_check_exit_code.py`, `test_revert_ci_regressions.py`);
the removal wins, which is the point of the change.

Master also added `ci/tests/test_build_profile_diff_xray_offset.py` (from #116639)
after this branch was cut. It is deleted here as well - otherwise the merge would
leave `ci/tests` alive with a single file and the change would not do what it
says. `ci/tests` is now empty.

`.github/workflows/pull_request.yml` was regenerated with `python3 -m ci.praktika
yaml` from the merged config rather than hand-merged, so the `ci_tests` job is
gone from the workflow and its entry from the `finish_workflow` `needs:` list.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants