From 832393abcf9e31f4c0a141fdd4ca0fb8dc5cf6be Mon Sep 17 00:00:00 2001 From: Raz Monsonego Date: Mon, 16 Nov 2026 18:24:46 +0200 Subject: [PATCH 1/4] [0.8] MOD-14130 Fix build failures on focal cross-compilation and x86 with old binutils (#912) Backport of #912 to 0.8. The binutils check replaces the Ubuntu 18.04 special case: GCC accepts -mavx512fp16 while focal's binutils 2.34 cannot assemble the FP16 instructions, so CXX_AVX512FP16 is turned off below binutils 2.38 and CXX_AVX512BF16 below 2.34. Spaces are gated on the target architecture (CMAKE_SYSTEM_PROCESSOR) rather than the host's. Adapted by hand: the guard sits one level deeper on this branch, and the SVE benchmark fix does not apply because the INT8/UINT8 space benchmarks do not exist here. (cherry picked from commit e5784b129bed790a7a1ee62ce78c791747c0204e) Co-Authored-By: Claude Fable 5.1 --- cmake/x86_64InstructionFlags.cmake | 34 ++++++++++++++++++++++++------ src/VecSim/spaces/CMakeLists.txt | 4 ++-- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/cmake/x86_64InstructionFlags.cmake b/cmake/x86_64InstructionFlags.cmake index 1fedda7fe..17f8e6427 100644 --- a/cmake/x86_64InstructionFlags.cmake +++ b/cmake/x86_64InstructionFlags.cmake @@ -20,15 +20,35 @@ if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)") CHECK_CXX_COMPILER_FLAG(-msse3 CXX_SSE3) CHECK_CXX_COMPILER_FLAG(-msse CXX_SSE) - # Turn off AVX512BF16 on Ubuntu 18.04 as it is not supported by its binutils assembler version. + # Check binutils version for AVX512 instruction support. + # Even if the compiler supports certain flags, the assembler (binutils) may not. + # - AVX512-BF16 requires binutils >= 2.34 + # - AVX512-FP16 requires binutils >= 2.38 if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") - execute_process(COMMAND lsb_release -rs - OUTPUT_VARIABLE UBUNTU_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) + # Get binutils/assembler version + execute_process(COMMAND as --version + OUTPUT_VARIABLE AS_VERSION_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + # Extract version number (e.g., "2.34" from "GNU assembler (GNU Binutils for Ubuntu) 2.34") + string(REGEX MATCH "[0-9]+\\.[0-9]+" BINUTILS_VERSION "${AS_VERSION_OUTPUT}") - if("${UBUNTU_VERSION}" STREQUAL "18.04") - message(STATUS "Compiling on Ubuntu 18.04, turning off CXX_AVX512BF16 flag.") - set(CXX_AVX512BF16 FALSE) + if(BINUTILS_VERSION) + message(STATUS "Detected binutils version: ${BINUTILS_VERSION}") + + # AVX512-BF16 requires binutils >= 2.34 + if(BINUTILS_VERSION VERSION_LESS "2.34") + message(STATUS "binutils ${BINUTILS_VERSION} < 2.34, turning off CXX_AVX512BF16 flag.") + set(CXX_AVX512BF16 FALSE) + endif() + + # AVX512-FP16 requires binutils >= 2.38 + if(BINUTILS_VERSION VERSION_LESS "2.38") + message(STATUS "binutils ${BINUTILS_VERSION} < 2.38, turning off CXX_AVX512FP16 flag.") + set(CXX_AVX512FP16 FALSE) + endif() + else() + message(WARNING "Could not detect binutils version, AVX512 features may fail to assemble") endif() endif() diff --git a/src/VecSim/spaces/CMakeLists.txt b/src/VecSim/spaces/CMakeLists.txt index 76b3fcc3d..4b9d655c5 100644 --- a/src/VecSim/spaces/CMakeLists.txt +++ b/src/VecSim/spaces/CMakeLists.txt @@ -13,7 +13,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall") set(OPTIMIZATIONS "") -if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)") +if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)") # Check that the compiler supports instructions flag. # from gcc14+ -mavx512bw is implicitly enabled when -mavx512vbmi2 is requested include(${root}/cmake/x86_64InstructionFlags.cmake) @@ -75,7 +75,7 @@ if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(x86_64)|(AMD64|amd64)|(^i.86$)") endif() endif() -if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(aarch64)|(arm64)|(ARM64)|(armv.*)") +if (CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)|(arm64)|(ARM64)|(armv.*)") include(${root}/cmake/aarch64InstructionFlags.cmake) # Create different optimization implementations for ARM architecture From 36c79adc1a3740bffccf7ae3a5e125e0beccdc09 Mon Sep 17 00:00:00 2001 From: dor-forer Date: Tue, 10 Nov 2026 09:48:01 +0000 Subject: [PATCH 2/4] Add Ubuntu 26.04 install script for the ubuntu-latest runner (#1111) Add Ubuntu 26.04 install script for the new ubuntu-latest runner GitHub's ubuntu-latest image moved to Ubuntu 26.04, and install_script.sh failed with "ubuntu_26.04.sh: No such file or directory". apt.llvm.org has no LLVM 18 repo for 26.04 (resolute), so install clang-format-18 from the Ubuntu archive and point the unversioned clang-format used by check-format.sh at it. Co-authored-by: Claude Opus 5.5 (cherry picked from commit 4d9e4d276992af7bddf6e64fc5ad6afa58adedbc) --- .install/ubuntu_26.04.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 .install/ubuntu_26.04.sh diff --git a/.install/ubuntu_26.04.sh b/.install/ubuntu_26.04.sh new file mode 100755 index 000000000..3967cdaf2 --- /dev/null +++ b/.install/ubuntu_26.04.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e +export DEBIAN_FRONTEND=noninteractive +MODE=$1 # whether to install using sudo or not + +$MODE apt update -qq + +# apt.llvm.org has no clang-18 repo for 26.04, but the Ubuntu archive ships clang-format-18. +# check-format.sh calls the unversioned clang-format, so point it at version 18. +$MODE apt install -yqq clang-format-18 +$MODE ln -sf /usr/bin/clang-format-18 /usr/local/bin/clang-format +clang-format --version + +$MODE apt install -yqq git wget build-essential lcov openssl libssl-dev \ + python3 python3-venv python3-dev unzip rsync curl +source install_cmake.sh $MODE From d8a38937bace9e4814345ecc81f9e12661b33859 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 22 Apr 2026 10:58:04 +0200 Subject: [PATCH 3/4] MOD-14977 Fix std::vector::swap assertion failure with GCC 15 (#938) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix std::vector::swap assertion failure with GCC 15 GCC 15 (Fedora 43) auto-enables _GLIBCXX_ASSERTIONS in unoptimized builds (-O0). This activates a runtime check in std::vector::swap (stl_vector.h:1847) that requires either propagate_on_container_swap to be true_type, or the two allocators to compare equal. TieredHNSW_BatchIterator::getNextResults swaps result vectors across allocator boundaries: flat_results (management-layer allocator) is swapped with the VecSimQueryReply returned by the frontend BF index (frontend allocator), and similarly for hnsw_results. These allocators are distinct VecSimAllocator instances, so operator== returns false, triggering __glibcxx_assert_fail -> abort(). Adding propagate_on_container_swap = true_type to VecsimSTLAllocator is safe because all VecSimAllocator instances use the same underlying allocation functions — they differ only in memory-tracking bookkeeping, not in actual alloc/free behavior. (cherry picked from commit 5bcc53e20d538d52d64a1eca508c88e5ac2a2125) --- src/VecSim/memory/vecsim_malloc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/VecSim/memory/vecsim_malloc.h b/src/VecSim/memory/vecsim_malloc.h index 5923fb300..9f9772071 100644 --- a/src/VecSim/memory/vecsim_malloc.h +++ b/src/VecSim/memory/vecsim_malloc.h @@ -111,6 +111,10 @@ inline void vecsim_free(void *p) { VecSimAllocator::memFunctions.freeFunction(p) template struct VecsimSTLAllocator { using value_type = T; + // Tiered indexes use separate allocators for frontend/backend/management layers. + // Swapping containers across these layers is safe (same underlying alloc functions), + // so we must tell std::vector::swap to swap the allocator along with the data. + using propagate_on_container_swap = std::true_type; private: VecsimSTLAllocator() {} @@ -146,3 +150,9 @@ template bool operator!=(const VecsimSTLAllocator &a, const VecsimSTLAllocator &b) { return a.vecsim_allocator != b.vecsim_allocator; } + +// Guard against regressions of the allocator swap-propagation trait. Tiered indexes swap +// std::vectors whose allocators reference different VecSimAllocator instances, which is UB +// unless the allocator is swapped along with the buffer (see hnsw_tiered.h getNextResults). +static_assert(std::allocator_traits>::propagate_on_container_swap::value, + "VecsimSTLAllocator must propagate on container swap."); From 1f09c3a37096dd6414449510f681325e268c52fd Mon Sep 17 00:00:00 2001 From: Raz Monsonego Date: Tue, 17 Nov 2026 09:48:18 +0200 Subject: [PATCH 4/4] Fix clang-format violations flagged by clang-format 18 ubuntu-latest now runs Ubuntu 26.04, whose archive ships clang-format 18, and it wants a space before the empty constructor body in three places. --- src/VecSim/batch_iterator.h | 2 +- tests/unit/test_allocator.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/VecSim/batch_iterator.h b/src/VecSim/batch_iterator.h index a2cbf4e8d..3353ee4ec 100644 --- a/src/VecSim/batch_iterator.h +++ b/src/VecSim/batch_iterator.h @@ -25,7 +25,7 @@ struct VecSimBatchIterator : public VecsimBaseObject { explicit VecSimBatchIterator(void *query_vector, void *tctx, std::shared_ptr allocator) : VecsimBaseObject(allocator), query_vector(query_vector), returned_results_count(0), - timeoutCtx(tctx){}; + timeoutCtx(tctx) {}; inline const void *getQueryBlob() const { return query_vector; } diff --git a/tests/unit/test_allocator.cpp b/tests/unit/test_allocator.cpp index 932a13971..11dd3bd30 100644 --- a/tests/unit/test_allocator.cpp +++ b/tests/unit/test_allocator.cpp @@ -30,7 +30,7 @@ struct ObjectWithSTL : public VecsimBaseObject { public: ObjectWithSTL(std::shared_ptr allocator) - : VecsimBaseObject(allocator), test_vec(allocator){}; + : VecsimBaseObject(allocator), test_vec(allocator) {}; }; struct NestedObject : public VecsimBaseObject { @@ -39,7 +39,7 @@ struct NestedObject : public VecsimBaseObject { public: NestedObject(std::shared_ptr allocator) - : VecsimBaseObject(allocator), stl_object(allocator), simpleObject(allocator){}; + : VecsimBaseObject(allocator), stl_object(allocator), simpleObject(allocator) {}; }; TEST_F(AllocatorTest, test_simple_object) {