From 3a042c080473957ffe40c5e299b06714868ab841 Mon Sep 17 00:00:00 2001 From: Robert Schulze Date: Fri, 1 Nov 2024 12:55:02 +0000 Subject: [PATCH] Enable dynamic dispatch in SimSIMD --- contrib/SimSIMD-cmake/CMakeLists.txt | 6 ++++-- src/Storages/MergeTree/MergeTreeIndexVectorSimilarity.cpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/SimSIMD-cmake/CMakeLists.txt b/contrib/SimSIMD-cmake/CMakeLists.txt index 1d434490c7c..8350417479a 100644 --- a/contrib/SimSIMD-cmake/CMakeLists.txt +++ b/contrib/SimSIMD-cmake/CMakeLists.txt @@ -1,6 +1,8 @@ # See contrib/usearch-cmake/CMakeLists.txt, why only enabled on x86 if (ARCH_AMD64) set(SIMSIMD_PROJECT_DIR "${ClickHouse_SOURCE_DIR}/contrib/SimSIMD") - add_library(_simsimd INTERFACE) - target_include_directories(_simsimd SYSTEM INTERFACE "${SIMSIMD_PROJECT_DIR}/include") + set(SIMSIMD_SRCS ${SIMSIMD_PROJECT_DIR}/c/lib.c) + add_library(_simsimd ${SIMSIMD_SRCS}) + target_include_directories(_simsimd SYSTEM PUBLIC "${SIMSIMD_PROJECT_DIR}/include") + target_compile_definitions(_simsimd PUBLIC SIMSIMD_DYNAMIC_DISPATCH) endif() diff --git a/src/Storages/MergeTree/MergeTreeIndexVectorSimilarity.cpp b/src/Storages/MergeTree/MergeTreeIndexVectorSimilarity.cpp index 5a725922e14..0b5ffa659dc 100644 --- a/src/Storages/MergeTree/MergeTreeIndexVectorSimilarity.cpp +++ b/src/Storages/MergeTree/MergeTreeIndexVectorSimilarity.cpp @@ -118,6 +118,8 @@ USearchIndexWithSerialization::USearchIndexWithSerialization( if (!result) throw Exception(ErrorCodes::INCORRECT_DATA, "Could not create vector similarity index. Error: {}", String(result.error.release())); swap(result.index); + + /// LOG_TRACE(getLogger("XXX"), "{}", simsimd_uses_dynamic_dispatch()); } void USearchIndexWithSerialization::serialize(WriteBuffer & ostr) const