Repository navigation
Report and gate the relocation headroom of Build (amd_msan) - #126736
Conversation
The amd_msan binaries are x86-64 small-code-model images close to the 2 GiB reach of 32-bit PC-relative references, and lld adds no range thunks on x86-64, so today the first sign of a size regression is a failed link (`relocation R_X86_64_PC32 out of range`), which drops every MSan test. Add a `Relocation headroom` sub-result to `Build (amd_msan)`, computed after the link from the section header table of `programs/clickhouse` and `src/unit_tests_dbms` (pure Python, no tool needed in the image): the bytes left of 2 GiB for `.rodata` to the end of code, code to the end of data, `.eh_frame_hdr` to code, and the code span itself, plus the change vs the nearest master commit of the run's master chain that reported them (read from its public job result JSON). The row fails below 64 MiB, about two weeks of master growth at the measured 5.24 MiB/day; when it is the only failing row the job completes as non-blocking, so artifacts are uploaded and the MSan tests still run. A decrease of 10 MiB or more adds a workflow warning. The numbers are in the row's `info` (CI DB history) and `ext`. Related: ClickHouse#126314 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code references the ELF header (`__ehdr_start`, address 0, from `StackTrace::tryResolveAddress`). In `unit_tests_dbms` that reference already spans 1794.76 MiB, only 37.66 MiB less than the span from `.rodata` to the end of code, and where it lands depends on link order, so the first span now starts at the image start instead of `.rodata`. The code span and the `.eh_frame_hdr` span are covered by it and can never be the smallest, so they are removed. The unwind tables' pointers to the personality and type-info slots in `.data` get their own span. Values on master 74d99c6 (MiB left of 2 GiB, `programs/clickhouse` / `src/unit_tests_dbms`): start of image to end of code 181.93 / 187.33, start of code to end of data 281.69 / 273.78, unwind tables to end of `.data` 309.70 / 301.48. Related: ClickHouse#126314 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; 1 full pass).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261019-152000 |
|
cc @maxknv, could you review this and add the |
|
Workflow [PR], commit [d914869] Summary: ✅
AI ReviewSummaryThe PR reports relocation headroom for both Findings
Final VerdictStatus: |
Algunenano
left a comment
There was a problem hiding this comment.
@groeneai I feel this is correct but the direction of the 2 checks are wrong:
- We should fail a PR check (unless manually overwritten) when the headroom was reduced by over 5MB.
- We should warn visibly in PRs when we are under 64MB.
As asked in review: a pull request now fails the `Relocation headroom` row when any span decreased by more than 5 MiB vs the master baseline, unless it has the `ci-relocation-headroom-ok` label; the labels are read by `Config Workflow`, so a push or "Re-run all jobs" applies it. Master runs only report the decrease. Below 64 MiB every run adds a workflow warning, shown in the `CI Infrastructure Messages` status and on the report page, instead of failing. The baseline line says how many commits it is older than the run's master parent, since master changes in between count as the pull request's. A PR build and the master build of its parent have identical spans (measured on bdca15a: 0 bytes difference in all six), so an unchanged binary has a delta of 0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Done in b9a8012:
The delta of an unchanged binary is exactly 0: on this PR, |
…r reuse a label-allowed success Two ways a pull request could pass the 5 MiB decrease gate without a real verdict: - Every master lookup error was taken as "no report", so an S3 5xx, a timeout or an undecodable result JSON left the run without a baseline and the row passed. Only a missing report (403 from the report bucket, which is not listable, or 404) now means "no baseline"; when no candidate has a report and a lookup failed, a PR run reports ERROR and asks for a re-run. The job still completes with do_not_block_pipeline_on_failure, so artifacts are uploaded and the MSan tests run. Master runs only report, as before. - A success that the `ci-relocation-headroom-ok` label allowed was cached under the build digest, which does not include labels: after removing the label, a later commit with the same digest reused the success. Such a row now sets do_not_cache, the flag praktika already offers for verdicts that depend on state the digest does not capture. A success without a master baseline stays cacheable: for a PR into a release branch the baseline is never available, so not caching it would only rebuild the binary. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Done in d914869: a failed master lookup now makes a pull request's row an error instead of a pass, and a success allowed by the label is not cached. |
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, 4 s compile time in total, 6 of them have a recent master baseline. |
Related: #126314
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Build (amd_msan)links x86-64 small-code-model binaries close to the 2 GiB reach of 32-bit PC-relative references, and lld adds no range thunks on x86-64, so a size regression shows up only when the link fails withrelocation R_X86_64_PC32 out of rangeand all MSan tests are lost (#126314). As asked in #126314 (comment), this adds aRelocation headroomrow toBuild (amd_msan).After the link, it reads the section headers of
programs/clickhouseandsrc/unit_tests_dbmsand reports the MiB left of 2 GiB for three spans, with the change vs the nearest master commit that reported them:__ehdr_start, so this span starts at address 0, not at.rodata);.data(personality and type-info slots).On master 74d99c6: 181.93 / 281.69 / 309.70 MiB for
clickhouse, 187.33 / 273.78 / 301.48 forunit_tests_dbms.A pull request fails the row when a span decreased by more than 5 MiB, unless it has the
ci-relocation-headroom-oklabel (read when the workflow starts: push or "Re-run all jobs"), and errors on a failed master lookup. The job is then red but non-blocking, so the MSan tests still run. Below 64 MiB (about 12 days of master growth; it would have fired on 10-16) every run adds a workflow warning, shown in theCI Infrastructure Messagesstatus. The numbers are in the row'sinfo, so CIDB keeps the history. Other x86-64 sanitizer builds have 2-4x the headroom and are not checked.Validated locally on master artifacts: the parser matches
llvm-readelf -SW; this PR's build on bdca15a reports exactly the bytes of that master build (delta 0); the gate, the label, the warning and the baseline round trip behave as described.Workflow [PR]
Sync PR [sync-upstream/pr/126736]
Version info
26.11.1.306-master(included in26.11and later)