Skip to content

Commit 2a198f1

Browse files
*: support vector search (#9486)
close #9032 *: support vector search Co-authored-by: JaySon <tshent@qq.com> Co-authored-by: JaySon-Huang <tshent@qq.com>
1 parent 69dd613 commit 2a198f1

File tree

210 files changed

+16885
-594
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+16885
-594
lines changed

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,12 @@
146146
[submodule "contrib/not_null"]
147147
path = contrib/not_null
148148
url = https://github.com/bitwizeshift/not_null.git
149+
[submodule "contrib/usearch"]
150+
path = contrib/usearch
151+
url = https://github.com/unum-cloud/usearch.git
152+
[submodule "contrib/simsimd"]
153+
path = contrib/simsimd
154+
url = https://github.com/ashvardanian/SimSIMD
155+
[submodule "contrib/highfive"]
156+
path = contrib/highfive
157+
url = https://github.com/BlueBrain/HighFive

cmake/cpu_features.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ elseif (ARCH_AMD64)
9595
# so we do not set the flags to avoid core dump in old machines
9696
option (TIFLASH_ENABLE_AVX_SUPPORT "Use AVX/AVX2 instructions on x86_64" ON)
9797
option (TIFLASH_ENABLE_AVX512_SUPPORT "Use AVX512 instructions on x86_64" ON)
98-
98+
9999
# `haswell` was released since 2013 with cpu feature avx2, bmi2. It's a practical arch for optimizer
100100
option (TIFLASH_ENABLE_ARCH_HASWELL_SUPPORT "Use instructions based on architecture `haswell` on x86_64" ON)
101101

contrib/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,12 @@ add_subdirectory(aws-cmake)
198198
add_subdirectory(simdjson)
199199

200200
add_subdirectory(fastpforlib)
201+
202+
add_subdirectory(usearch-cmake)
203+
204+
add_subdirectory(simsimd-cmake)
205+
206+
if (ENABLE_TESTS AND NOT CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG")
207+
add_subdirectory(hdf5-cmake)
208+
add_subdirectory(highfive-cmake)
209+
endif ()

contrib/hdf5-cmake/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/download/*

contrib/hdf5-cmake/CMakeLists.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
include(ExternalProject)
2+
3+
# hdf5 is too large. Instead of adding as a submodule, let's simply download from GitHub.
4+
ExternalProject_Add(hdf5-external
5+
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
6+
DOWNLOAD_DIR ${TiFlash_SOURCE_DIR}/contrib/hdf5-cmake/download
7+
URL https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5_1.14.4.3.zip
8+
URL_HASH MD5=bc987d22e787290127aacd7b99b4f31e
9+
CMAKE_ARGS
10+
-DCMAKE_BUILD_TYPE=Release
11+
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
12+
-DBUILD_STATIC_LIBS=ON
13+
-DBUILD_SHARED_LIBS=OFF
14+
-DBUILD_TESTING=OFF
15+
-DHDF5_BUILD_HL_LIB=OFF
16+
-DHDF5_BUILD_TOOLS=OFF
17+
-DHDF5_BUILD_CPP_LIB=ON
18+
-DHDF5_BUILD_EXAMPLES=OFF
19+
-DHDF5_ENABLE_Z_LIB_SUPPORT=OFF
20+
-DHDF5_ENABLE_SZIP_SUPPORT=OFF
21+
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/${CMAKE_FIND_LIBRARY_PREFIXES}hdf5.a # Workaround for Ninja
22+
USES_TERMINAL_DOWNLOAD TRUE
23+
USES_TERMINAL_CONFIGURE TRUE
24+
USES_TERMINAL_BUILD TRUE
25+
USES_TERMINAL_INSTALL TRUE
26+
EXCLUDE_FROM_ALL TRUE
27+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
28+
)
29+
30+
ExternalProject_Get_Property(hdf5-external INSTALL_DIR)
31+
32+
add_library(tiflash_contrib::hdf5 STATIC IMPORTED GLOBAL)
33+
set_target_properties(tiflash_contrib::hdf5 PROPERTIES
34+
IMPORTED_LOCATION ${INSTALL_DIR}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}hdf5.a
35+
)
36+
add_dependencies(tiflash_contrib::hdf5 hdf5-external)
37+
38+
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
39+
target_include_directories(tiflash_contrib::hdf5 SYSTEM INTERFACE
40+
${INSTALL_DIR}/include
41+
)

contrib/highfive

Submodule highfive added at 0d0259e
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
set(HIGHFIVE_PROJECT_DIR "${TiFlash_SOURCE_DIR}/contrib/highfive")
2+
set(HIGHFIVE_SOURCE_DIR "${HIGHFIVE_PROJECT_DIR}/include")
3+
4+
if (NOT EXISTS "${HIGHFIVE_SOURCE_DIR}/highfive/highfive.hpp")
5+
message (FATAL_ERROR "submodule contrib/highfive not found")
6+
endif()
7+
8+
add_library(_highfive INTERFACE)
9+
10+
target_include_directories(_highfive SYSTEM INTERFACE
11+
${HIGHFIVE_SOURCE_DIR}
12+
)
13+
14+
target_link_libraries(_highfive INTERFACE
15+
tiflash_contrib::hdf5
16+
)
17+
18+
add_library(tiflash_contrib::highfive ALIAS _highfive)

contrib/simsimd

Submodule simsimd added at ff51434
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
set(SIMSIMD_PROJECT_DIR "${TiFlash_SOURCE_DIR}/contrib/simsimd")
2+
set(SIMSIMD_SOURCE_DIR "${SIMSIMD_PROJECT_DIR}/include")
3+
4+
add_library(_simsimd INTERFACE)
5+
6+
if (NOT EXISTS "${SIMSIMD_SOURCE_DIR}/simsimd/simsimd.h")
7+
message (FATAL_ERROR "submodule contrib/simsimd not found")
8+
endif()
9+
10+
target_include_directories(_simsimd SYSTEM INTERFACE
11+
${SIMSIMD_SOURCE_DIR})
12+
13+
add_library(tiflash_contrib::simsimd ALIAS _simsimd)

0 commit comments

Comments
 (0)