forked from 1yefuwang1/vectorlite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement vector distance using Google's highway library (1yefuwang1#22)
* Implement vector distance using highway * Add benchmark * Add normalize benchmark * Implement l2 squared * Rename to ops * implement hnswlib::SpaceInterface using vectorlite distance functions * re-organize cmake files * Fix path issues * Run ops benchmark when building wheels * Add ops readme * Fix UT on macos ARM * Fix UT on MSVC * Fix link issue on Linux
- Loading branch information
1 parent
b3c2b6d
commit 89d6d7f
Showing
45 changed files
with
967 additions
and
119 deletions.
There are no files selected for viewing
This file contains 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,5 +1,9 @@ | ||
{ | ||
"clangd.arguments": [ | ||
"--compile-commands-dir=${workspaceFolder}/build/dev" | ||
] | ||
], | ||
"files.associations": { | ||
".fantomasignore": "ignore", | ||
"string_view": "cpp" | ||
} | ||
} |
This file contains 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 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 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 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 +1 @@ | ||
cmake --preset dev && cmake --build build/dev -j8 && ctest --test-dir build/dev --output-on-failure && pytest bindings/python/vectorlite_py/test | ||
cmake --preset dev && cmake --build build/dev -j8 && ctest --test-dir build/dev/vectorlite --output-on-failure && pytest bindings/python/vectorlite_py/test |
This file contains 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 +1 @@ | ||
cmake --preset release && cmake --build build/release -j8 && ctest --test-dir build/release --output-on-failure && pytest bindings/python/vectorlite_py/test | ||
cmake --preset release && cmake --build build/release -j8 && ctest --test-dir build/release/vectorlite --output-on-failure && pytest bindings/python/vectorlite_py/test |
This file contains 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 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 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 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 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
Submodule vcpkg
updated
95 files
This file contains 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,36 +1,47 @@ | ||
{ | ||
"name": "vectorlite", | ||
"version-string": "0.1.0", | ||
"license": "MIT", | ||
"description": "SQLite extension for fast vector search", | ||
"license": "MIT", | ||
"builtin-baseline": "67cc1677c3bf5c23ea14b9d2416c7422fdeac492", | ||
"dependencies": [ | ||
{ | ||
"name": "sqlite3", | ||
"version>=": "3.43.1" | ||
"name": "abseil", | ||
"features": [ | ||
"cxx17" | ||
], | ||
"version>=": "20240116.2" | ||
}, | ||
{ | ||
"name": "rapidjson", | ||
"version>=": "2023-07-17" | ||
"name": "gtest", | ||
"version>=": "1.14.0" | ||
}, | ||
{ | ||
"name": "hnswlib", | ||
"version>=": "0.8.0" | ||
}, | ||
{ | ||
"name": "gtest", | ||
"version>=": "1.14.0" | ||
"name": "rapidjson", | ||
"version>=": "2023-07-17" | ||
}, | ||
{ | ||
"name": "abseil", | ||
"name": "re2", | ||
"version>=": "2023-07-01" | ||
}, | ||
{ | ||
"name": "sqlite3", | ||
"version>=": "3.43.1" | ||
}, | ||
{ | ||
"name": "highway", | ||
"features": [ | ||
"cxx17" | ||
"contrib" | ||
], | ||
"version>=": "20240116.2" | ||
"version>=": "1.2.0" | ||
}, | ||
{ | ||
"name": "re2", | ||
"version>=": "2023-07-01" | ||
"name": "benchmark", | ||
"version>=": "1.8.5" | ||
} | ||
], | ||
"builtin-baseline": "67cc1677c3bf5c23ea14b9d2416c7422fdeac492" | ||
} | ||
] | ||
} |
This file contains 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,47 @@ | ||
configure_file(version.h.in version.h) | ||
message(STATUS "version.h generated to: ${PROJECT_BINARY_DIR}") | ||
|
||
find_path(RAPIDJSON_INCLUDE_DIRS rapidjson/rapidjson.h) | ||
message(STATUS "RapidJSON include dir: ${RAPIDJSON_INCLUDE_DIRS}") | ||
find_path(HNSWLIB_INCLUDE_DIRS hnswlib/hnswlib.h) | ||
message(STATUS "HNSWLIB include dir: ${HNSWLIB_INCLUDE_DIRS}") | ||
|
||
message(STATUS "Compiling on ${CMAKE_SYSTEM_PROCESSOR}") | ||
|
||
add_subdirectory(ops) | ||
|
||
add_library(vectorlite SHARED vectorlite.cpp virtual_table.cpp vector.cpp vector_view.cpp util.cpp vector_space.cpp index_options.cpp sqlite_functions.cpp constraint.cpp) | ||
# remove the lib prefix to make the shared library name consistent on all platforms. | ||
set_target_properties(vectorlite PROPERTIES PREFIX "") | ||
target_include_directories(vectorlite PUBLIC ${RAPIDJSON_INCLUDE_DIRS} ${HNSWLIB_INCLUDE_DIRS} ${PROJECT_BINARY_DIR}) | ||
target_link_libraries(vectorlite PRIVATE unofficial::sqlite3::sqlite3 absl::status absl::statusor absl::strings re2::re2 ops) | ||
# copy the shared library to the python package to make running integration tests easier | ||
add_custom_command(TARGET vectorlite POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:vectorlite> ${PROJECT_SOURCE_DIR}/bindings/python/vectorlite_py/$<TARGET_FILE_NAME:vectorlite>) | ||
|
||
include(GoogleTest) | ||
enable_testing() | ||
file(GLOB TEST_SOURCES *.cpp) | ||
add_executable(unit_test ${TEST_SOURCES}) | ||
target_include_directories(unit_test PUBLIC ${PROJECT_BINARY_DIR}) | ||
target_link_libraries(unit_test PRIVATE GTest::gtest GTest::gtest_main unofficial::sqlite3::sqlite3 absl::status absl::statusor absl::strings re2::re2 ops) | ||
# target_compile_options(unit_test PRIVATE -Wall -fno-omit-frame-pointer -g -O0) | ||
# target_link_options(unit_test PRIVATE -fsanitize=address) | ||
if (MSVC) | ||
target_compile_options(vectorlite PRIVATE /arch:AVX) | ||
target_compile_options(unit_test PRIVATE /arch:AVX) | ||
endif() | ||
|
||
if(CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
target_link_libraries(vectorlite PRIVATE absl::log) | ||
target_link_libraries(unit_test PRIVATE absl::log) | ||
endif() | ||
|
||
# TODO: For mysterious reason, absl::log symbols are required for even release build on MSVC. Only DLOG are used which should be guarded by NDEBUG and not included in Release build. | ||
if(MSVC) | ||
target_link_libraries(vectorlite PRIVATE absl::log) | ||
target_link_libraries(unit_test PRIVATE absl::log) | ||
endif() | ||
|
||
gtest_discover_tests(unit_test) | ||
|
||
add_test(NAME unit_test COMMAND unit_test) |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.