Skip to content

JIT: register __fixunssfti / __fixunsdfti for toUInt128(Float)#105048

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
Algunenano:fix-jit-missing-fixunsdfti
May 15, 2026
Merged

JIT: register __fixunssfti / __fixunsdfti for toUInt128(Float)#105048
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
Algunenano:fix-jit-missing-fixunsdfti

Conversation

@Algunenano
Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix CANNOT_COMPILE_CODE Could not find symbol __fixunsdfti when JIT-compiling expressions that convert a Float to UInt128, such as toUInt128(<Float64 expression>). The unsigned 128-bit float-to-int compiler-rt builtins were missing from the JIT symbol resolver. Closes #105031.

The JIT symbol resolver was registering only the signed 128-bit
float-to-int compiler-rt builtins (__fixsfti, __fixdfti). When
LLVM lowered `fptoui` to a 128-bit integer (e.g. toUInt128 of a
Float expression), it emitted calls to __fixunssfti / __fixunsdfti,
which were never registered, so the JIT linker failed with
`CANNOT_COMPILE_CODE Could not find symbol __fixunsdfti` as soon
as the expression got hot enough to be compiled.

Add the missing unsigned variants, plus __udivti3 / __umodti3 so
every libcall in the resolver now has both signed and unsigned
entries, and document the signed/unsigned-pair rule in a comment
so the asymmetry that caused this bug is not reintroduced.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Algunenano Algunenano added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label May 15, 2026
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented May 15, 2026

Workflow [PR], commit [de4c439]

Summary:


AI Review

Summary

This PR fixes JIT symbol resolution for float-to-unsigned-128 conversions by registering missing compiler-rt builtins (__fixunssfti, __fixunsdfti) and also makes the signed/unsigned 128-bit libcall set symmetric (__udivti3, __umodti3). The added stateless regression test covers JIT and non-JIT paths for float↔big-int conversions, including the reported toUInt128(Float) failure shape, and the current diff does not show unresolved correctness or safety issues.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label May 15, 2026
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented May 15, 2026

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.10% +0.00%
Functions 90.80% 90.80% +0.00%
Branches 76.50% 76.60% +0.10%

Changed lines: 100.00% (12/12) · Uncovered code

Full report · Diff report

@alexey-milovidov alexey-milovidov self-assigned this May 15, 2026
@alexey-milovidov alexey-milovidov added this pull request to the merge queue May 15, 2026
Merged via the queue into ClickHouse:master with commit d0e74f8 May 15, 2026
167 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 16, 2026
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label May 16, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request May 16, 2026
Cherry pick #105048 to 26.2: JIT: register __fixunssfti / __fixunsdfti for toUInt128(Float)
robot-clickhouse added a commit that referenced this pull request May 16, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request May 16, 2026
Cherry pick #105048 to 26.3: JIT: register __fixunssfti / __fixunsdfti for toUInt128(Float)
robot-clickhouse added a commit that referenced this pull request May 16, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request May 16, 2026
Cherry pick #105048 to 26.4: JIT: register __fixunssfti / __fixunsdfti for toUInt128(Float)
robot-clickhouse added a commit that referenced this pull request May 16, 2026
alexey-milovidov added a commit that referenced this pull request May 16, 2026
Backport #105048 to 26.4: JIT: register __fixunssfti / __fixunsdfti for toUInt128(Float)
alexey-milovidov added a commit that referenced this pull request May 16, 2026
Backport #105048 to 26.3: JIT: register __fixunssfti / __fixunsdfti for toUInt128(Float)
fm4v added a commit that referenced this pull request May 16, 2026
Backport #105048 to 26.2: JIT: register __fixunssfti / __fixunsdfti for toUInt128(Float)
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

JIT: toUInt128(Float64 expr) fails with Could not find symbol __fixunsdfti (CANNOT_COMPILE_CODE)

5 participants