Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Change default x86 build target from x86-64-v2 (SSE4.2) to x86-64-v3 (AVX2) #90043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
117 commits
Select commit
Hold shift + click to select a range
1e1dd89
Check performance with x86-64-v3
Algunenano 7bb9509
Remove unnecessary dispatch
Algunenano 5d8117b
And adjust ENABLE_MULTITARGET_CODE
Algunenano edf135f
Fix
Algunenano 4046d2e
Restore removed implementation for Int8
Algunenano e099c61
Replace multiply-based fill loops with accumulator pattern
Algunenano 13f226d
Prevent bad auto-vectorization of UInt64->Float32 conversion on x86
Algunenano 8ba3244
Use compat build for non-AVX2 systems in install script
Algunenano 9bc173a
Merge blessed/master
Algunenano bddd90b
Remove llvm-libc v2/v3 runtime dispatch on x86-64
Algunenano b0081f2
Restore early return for empty input in `mortonEncode`
Algunenano c064194
Update QEMU-based tests for x86-64-v3 default
Algunenano 0de5c24
Skip QEMU-based instruction tests for x86-64-v3 builds
Algunenano 101d417
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano a70f393
Undo bad merge conflict
Algunenano bd58bf5
Remove unnecessary llvmlibc_dispatch
Algunenano 601340d
Remove `checkRequiredInstructions` and its test
Algunenano b32d9fc
Let simdjson use AVX2 directly on x86-64-v3 builds
Algunenano 43a4590
Fix libdivide SIMD selection and ensure consistent inclusion
Algunenano 4dc97a0
Remove unnecessary dispatch
Algunenano 16fd39e
Update default_libs.cmake
Algunenano 72d4d1b
Disable auto-vectorization for integer division and modulo loops
Algunenano 1bbcb27
Prevent LTO from inlining `iota` and `iotaWithStep`
Algunenano 6bdabce
Force x86-64-v2 for musl scalar math functions on v3+ builds
Algunenano 16485cd
Disable loop unrolling for scalar math function calls
Algunenano 29da5dc
Remove FastOps runtime dispatch on x86-64-v3+ builds
Algunenano b42f8a1
Merge branch 'analyze-assembly' into x86v3
antonio2368 e886ebf
Fix x86-64-v3 performance regressions in aggregate functions and arra…
antonio2368 2187b14
Merge remote-tracking branch 'origin/master' into x86v3
antonio2368 28afd1f
Remove musl math v2 override; disable `vzeroupper` on v3+ builds
Algunenano 6df0283
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano e1cb44f
Fix indentation of `BEGIN_X86_64_V3_SPECIFIC_CODE` macro
Algunenano b035278
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano dde7b80
Fix simdjson fallback for non-x86 platforms
Algunenano 1933f2f
Limit vectorization width in `ColumnString::replicate` prefix-sum loop
Algunenano cbd6e0e
Pass `COMPILER_FLAGS` to compiler-rt sanitizer runtime build
Algunenano d14b0de
Apply `no_vectorize` to `RightConstant` division/modulo path
Algunenano 11f2925
Use vectorize(disable) instead of vectorize_width(2) in prefix-sum loop
Algunenano b7f1342
Fix preprocessor guard: `__AVX__` -> `__AVX2__` in `isAllASCII`
Algunenano ac912b4
Remove dead SSE2 include from ColumnsCommon.h
Algunenano 16b55b9
Remove redundant runtime arch check in `sliceHasImplAnyAll`
Algunenano 28d1a82
Validate host CPU flags for the requested x86 microarchitecture level
Algunenano 4ba769d
Update Docker image ISA requirement from SSE3 to x86-64-v3
Algunenano 0d4c65c
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 18cbe01
Localize C math symbols from Rust static libraries
Algunenano 895543a
Handle non-ELF members in Rust archives during symbol localization
Algunenano 925d7f6
Fix localize_rust_c_symbols exit code and PRQL race
Algunenano d7f97a3
Allow vectorization of float modulo operations
Algunenano c51546c
Disable unrolling of scalar UInt64->Float32 conversion on x86
Algunenano f0abed3
Disable vectorization of libdivide modulo-by-constant loop
Algunenano ef38741
Restrict vectorize(disable) on libdivide modulo loop to x86 only
Algunenano 68e6c80
Support fetching all log files in claude tool
Algunenano 0aa821e
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 8b58b78
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 775886c
Fix Base58 build: remove TargetSpecific multitarget dispatch
Algunenano e6d0787
Fix unused variable warning: move base58_chars into non-AVX2 guard
Algunenano 5efb7ac
Fix Rust symbol localization build ordering
Algunenano 714c3b0
Fix fastops ARM build: guard x86 dispatch with `ARCH_AMD64`
Algunenano 67ade8e
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 1c031cf
Intel is the sole responsible of the bad state of x86
Algunenano d33bf30
Switch libdivide to `BRANCHFREE` and optimize div/mod SIMD paths
Algunenano f5f855c
Clean up stale comments in modulo pow2 path
Algunenano 1635a0f
Remove ALWAYS_INLINE from `findExtremeImpl` to reduce i-cache pressure
Algunenano 0977b4d
Use BRANCHFULL libdivide for <=32-bit, BRANCHFREE+AVX2 for 64-bit
Algunenano 94abccd
Fix buffer overflow in AVX2 modulo path for narrowing result types
Algunenano 7fceedc
Add `NO_INLINE` to `hasAll` SIMD specializations to prevent LTO bloat
Algunenano 5efd4c7
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano bc89b30
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 1ebc66e
Clarify perf-report skill: emphasize mandatory master cross-reference…
Algunenano 128d85c
Fix LinfNorm regression: only suppress vectorization for sum-based norms
Algunenano f740340
Fix UInt64 modulo-by-constant regression on x86-64-v3
Algunenano ac5f7ba
Avoid 256-bit stores in LZ4 match copies to prevent store-forwarding …
Algunenano 45f5a91
Suppress unrolling in array() element interleave loop
Algunenano 1cc56d8
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 71488a0
Fix arrayDotProduct build after merge with master
Algunenano 1d2a2ef
Add batched addBatchSinglePlace for AggregateFunctionDistinct
Algunenano 98bf633
Fix style: Allman-style brace for requires clause
Algunenano 3ef2871
Fix SIGABRT in intDiv with zero divisor on x86-64-v3
Algunenano f2ffe76
Fix base58 fast decoder, intDiv crash, and fastops ARM build
Algunenano ab70466
Fix clang-tidy warnings: default arg, unused var, redundant cast
Algunenano c61431f
Disable ENABLE_MULTITARGET_CODE for non-default x86 arch levels
Algunenano 18f38a6
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano e10d6de
Work around clang-21 codegen bug in join selectivity computation
Algunenano 1754221
Address review: fix default comment, add popcnt to v2 preflight, stre…
Algunenano 031970c
Address review: complete v3 preflight flags, fix error message wording
Algunenano 7ca3657
Address review: fix default comment, simplify CPU preflight checks
Algunenano 7798fed
Add LLVM bug tracker reference to the codegen workaround
Algunenano fb965b2
Work around LLVM x86 backend bug in join selectivity computation
Algunenano 3a62f4b
Merge branch 'master' into x86v3
Algunenano 782aaef
Compile arrayNorm.cpp at x86-64-v2 level on v3 builds
Algunenano 9b47f71
Fix install script abort on non-AVX2 hosts, compile arrayNorm at v2
Algunenano f8e8e34
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 5322e34
Simplify arrayNorm v2 compile flags
Algunenano 483442c
Compile FunctionsStringDistance.cpp at v2 to fix Jaccard regression
Algunenano d3578a7
Compile randomString.cpp at v2 to fix vzeroupper-in-loop
Algunenano bb05e83
Merge remote-tracking branch 'mine/x86v3' into x86v3
Algunenano f46df5e
Split QuantileTiming::merge to keep hot tiny path inline
Algunenano 020709f
Strengthen v4 host check to detect Knights-Landing-style AVX-512 CPUs
Algunenano 1cfd404
Rename example class `Myv3Impl` -> `Myv4Impl` in `PerformanceAdaptors.h`
Algunenano fafaed1
Compile `FunctionsHashingMisc.cpp` at v2 to fix empty-string hash reg…
Algunenano fd8c3de
Skip the intermediate `Field` for the const buckets argument
Algunenano 143e4d8
Compile `arrayDistance.cpp` at v2 to fix BF16 distance regressions
Algunenano 41e4556
Compute trunc as `x - x % scale` to avoid the trailing multi-word mul…
Algunenano a8f4b62
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 0e45100
Short-circuit same-width integer conversions to `std::memcpy`
Algunenano 635d4c0
Compile `StorageGenerateRandom.cpp` at v2 to fix `generate_table_func…
Algunenano b1dae92
Outline `std::log` in `NaiveBayesClassifier::classify` to avoid v3 LT…
Algunenano 59ecbf0
Compress the v3-override comments in CMakeLists into TODO blurbs
Algunenano a61ed3d
Disable vectorizers on Decimal128 multiply hot loop at v3
Algunenano 03d2968
Fix dispatch example in TargetSpecific.h to call default impl
Algunenano afa1c5b
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 4aa9199
Address PR review feedback: trim comments, use natural language
Algunenano 0ea30f0
Anchor `objcopy`->`ar` substitution to end of `OBJCOPY` path
Algunenano 8fbd1f7
Rewrite only the basename when deriving `ar` from `OBJCOPY`
Algunenano 11e6269
Restore v3 dispatch for `FunctionAnyHash` / `FunctionIntHash`
Algunenano e1b16e7
Merge remote-tracking branch 'blessed/master' into x86v3
Algunenano 66f976d
Disable BMI on `AggregateFunctionUniq.cpp` to fix `uniq_stored` regre…
Algunenano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Localize known C library symbols in a Rust static library (.a). | ||
| # | ||
| # Rust static libraries bundle compiler_builtins and libm, which export | ||
| # standard C symbols (cbrt, fma, sin, memcpy, __muloti4, etc.) as globals. | ||
| # When linked before our own C implementations (libllvmlibc, glibc-compat), | ||
| # these silently win — bypassing our -falign-functions=64, -march, and other | ||
| # optimization flags. | ||
| # | ||
| # This script localizes those known C library symbols so the linker picks | ||
| # our own implementations instead. All other symbols (Rust-mangled, crate | ||
| # FFI, etc.) are left untouched. | ||
| # | ||
| # Usage: localize_rust_c_symbols.sh <library.a> <objcopy> | ||
|
|
||
| set -eu | ||
|
|
||
| LIB_PATH="$1" | ||
| OBJCOPY="$2" | ||
|
|
||
| if [ -z "$LIB_PATH" ] || [ -z "$OBJCOPY" ]; then | ||
| echo "Usage: $0 <library.a> <objcopy>" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "$LIB_PATH" ]; then | ||
| echo "Error: Rust library not found: $LIB_PATH" >&2 | ||
| echo "If this is a workspace subcrate, set IMPORTED_LOCATION on the target" >&2 | ||
| echo "before calling clickhouse_config_crate_flags()." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Known C library symbols that Rust's compiler_builtins / libm may export. | ||
| # This list covers: | ||
| # - C math functions (libm) | ||
| # - Compiler-rt builtins (__muloti4, __divti3, etc.) | ||
| # - C string/memory functions that may be provided by Rust | ||
| KNOWN_C_SYMBOLS=( | ||
| # Math functions (float64) | ||
| cbrt cos sin tan acos asin atan atan2 | ||
| exp exp2 exp10 log log2 log10 log1p expm1 | ||
| pow sqrt hypot | ||
| fma fmod remainder | ||
| ceil floor round trunc nearbyint rint | ||
| copysign fabs fdim fmax fmin | ||
| erf erfc tgamma lgamma | ||
| frexp ldexp modf scalbn ilogb logb | ||
| nextafter nexttoward | ||
| # Math functions (float32) | ||
| cbrtf cosf sinf tanf acosf asinf atanf atan2f | ||
| expf exp2f exp10f logf log2f log10f log1pf expm1f | ||
| powf sqrtf hypotf | ||
| fmaf fmodf remainderf | ||
| ceilf floorf roundf truncf nearbyintf rintf | ||
| copysignf fabsf fdimf fmaxf fminf | ||
| erff erfcf tgammaf lgammaf | ||
| frexpf ldexpf modff scalbnf ilogbf logbf | ||
| nextafterf nexttowardf | ||
| # Math functions (long double) | ||
| ceill floorl roundl truncl | ||
| sqrtl frexpl ldexpl scalbnl | ||
| # Compiler-rt integer builtins | ||
| __absvdi2 __absvsi2 __absvti2 | ||
| __addvdi3 __addvsi3 __addvti3 | ||
| __cmpdi2 __cmpti2 | ||
| __divdc3 __divsc3 | ||
| __muldc3 __mulsc3 | ||
| __mulvdi3 __mulvsi3 __mulvti3 | ||
| __negdf2 __negsf2 __negdi2 __negti2 | ||
| __negvdi2 __negvsi2 __negvti2 | ||
| __paritydi2 __paritysi2 __parityti2 | ||
| __popcountdi2 __popcountsi2 __popcountti2 | ||
| __muloti4 | ||
| ) | ||
|
|
||
| # Collect which of these actually exist as global symbols in the library | ||
| TMPFILE=$(mktemp) | ||
| WORK_DIR="" | ||
| cleanup() { rm -f "$TMPFILE"; [ -n "$WORK_DIR" ] && rm -rf "$WORK_DIR"; true; } | ||
| trap cleanup EXIT | ||
|
|
||
| if ! command -v llvm-nm >/dev/null 2>&1; then | ||
| echo "Error: llvm-nm not found in PATH (required for Rust C-symbol localization)" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Get all global defined symbols from the library. llvm-nm may print per-member errors for non-ELF archive | ||
| # members (e.g. debug metadata objects) - those are non-fatal as long as at least one ELF member is read. | ||
| # A truly broken/missing archive produces empty output and is caught below. | ||
| llvm-nm "$LIB_PATH" 2>/dev/null \ | ||
|
Algunenano marked this conversation as resolved.
|
||
| | grep -E '^[0-9a-f]+ [TDBCWV] ' \ | ||
| | awk '{print $3}' \ | ||
| | sort -u \ | ||
| > "$TMPFILE" || true | ||
|
|
||
| if [ ! -s "$TMPFILE" ]; then | ||
| echo "Error: llvm-nm produced no symbols for $LIB_PATH; cannot localize Rust C symbols" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Build objcopy flags for symbols that exist in both lists | ||
| LOCALIZE_FLAGS="" | ||
| for sym in "${KNOWN_C_SYMBOLS[@]}"; do | ||
| if grep -qxF "$sym" "$TMPFILE"; then | ||
| LOCALIZE_FLAGS="$LOCALIZE_FLAGS --localize-symbol=$sym" | ||
| fi | ||
| done | ||
|
|
||
| if [ -n "$LOCALIZE_FLAGS" ]; then | ||
| # Try direct objcopy on the archive first (fast path). | ||
| # Some Rust archives contain non-ELF members (e.g. debug metadata objects) | ||
| # that cause llvm-objcopy to fail. In that case, fall back to extracting | ||
| # individual members, processing only valid ELF objects, and repacking. | ||
| if ! $OBJCOPY $LOCALIZE_FLAGS "$LIB_PATH" 2>/dev/null; then | ||
| # Substitute only inside the basename so a directory containing `objcopy` | ||
| # is not rewritten and a versioned name like `llvm-objcopy-21` still maps | ||
| # to `llvm-ar-21`. | ||
| OBJCOPY_NAME="${OBJCOPY##*/}" | ||
| AR_NAME="${OBJCOPY_NAME/objcopy/ar}" | ||
| if [ "$OBJCOPY_NAME" = "$OBJCOPY" ]; then | ||
| AR="$AR_NAME" | ||
| else | ||
| AR="${OBJCOPY%/*}/$AR_NAME" | ||
| fi | ||
| WORK_DIR=$(mktemp -d) | ||
|
|
||
| (cd "$WORK_DIR" && "$AR" x "$LIB_PATH") | ||
| for obj in "$WORK_DIR"/*.o; do | ||
| $OBJCOPY $LOCALIZE_FLAGS "$obj" 2>/dev/null || true | ||
|
Algunenano marked this conversation as resolved.
|
||
| done | ||
| "$AR" rcs "$LIB_PATH" "$WORK_DIR"/*.o | ||
| fi | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| #if defined(__SSE2__) | ||
| # define LIBDIVIDE_SSE2 | ||
| #elif defined(__AVX512F__) || defined(__AVX512BW__) || defined(__AVX512VL__) | ||
| #if defined(__AVX512F__) || defined(__AVX512BW__) || defined(__AVX512VL__) | ||
| # define LIBDIVIDE_AVX512 | ||
| #elif defined(__AVX2__) | ||
| # define LIBDIVIDE_AVX2 | ||
| #elif defined(__SSE2__) | ||
| # define LIBDIVIDE_SSE2 | ||
| #elif defined(__aarch64__) && defined(__ARM_NEON) | ||
| # define LIBDIVIDE_NEON | ||
| #endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You can’t perform that action at this time.

Uh oh!
There was an error while loading. Please reload this page.