Skip to content

Make LLT::ExtendedLLT atomic - #154

Merged
thevar1able merged 1 commit into
ClickHouse/release-23.xfrom
fix-extended-llt-race
Nov 14, 2026
Merged

thevar1able merged 1 commit into
ClickHouse/release-23.xfrom
fix-extended-llt-race

Conversation

@thevar1able

Copy link
Copy Markdown
Member

The AArch64TargetMachine, AMDGPUTargetMachine and WebAssemblyTargetMachine constructors unconditionally write the process-global LLT::ExtendedLLT flag, which races with other threads constructing target machines or running code generation. ClickHouse creates a TargetMachine per CHJIT instance, and the ARM TSan stress test reports the race in LLT::setUseExtended.

Make the flag a relaxed std::atomic<bool>, the ad-hoc fix suggested upstream.

Related: llvm#219517
Related: ClickHouse/ClickHouse#117346

🤖 Generated with Claude Code

`AArch64TargetMachine`, `AMDGPUTargetMachine` and `WebAssemblyTargetMachine`
constructors unconditionally write the process-global `LLT::ExtendedLLT`
flag. When a program creates `TargetMachine`s on several threads while other
threads run code generation (as the ClickHouse JIT does), this is a data race
reported by ThreadSanitizer.

Make the flag a `std::atomic<bool>` with relaxed ordering, the ad-hoc fix
suggested in llvm#219517.

Related: llvm#219517
Related: ClickHouse/ClickHouse#117346

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thevar1able
thevar1able merged commit b8abb40 into ClickHouse/release-23.x Nov 14, 2026
8 checks passed
lazerg pushed a commit to lazerg/ClickHouse that referenced this pull request Nov 17, 2026
`AArch64TargetMachine` constructor writes the process-global `LLT::ExtendedLLT`
flag, which raced with `CHJIT` instances created concurrently on other threads
(ThreadSanitizer report in `Stress test (arm_tsan)`). The fork now makes the
flag a relaxed `std::atomic<bool>`.

The update also brings the Clang CFI fixes from the fork
(ClickHouse/llvm-project#152).

Related: ClickHouse/llvm-project#154
Related: ClickHouse#117346
Related: llvm/llvm-project#219517

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant