Coder Social home page Coder Social logo

vectorsimilarity's Introduction

nightly codecov CodeQL Known Vulnerabilities

VectorSimilarity

This repo exposes C API for using vector similarity search. Allows Creating indices of vectors and searching for top K similar to some vector in two methods: brute force, and by using the hnsw algorithm (probabilistic).

The API header files are vec_sim.h and query_results.h, which are located in src/VecSim.

Algorithms

All of the algorithms in this library are designed to work inside RediSearch and support the following features:

  1. In place insert, delete, and update vectors in the index.
  2. KNN queries - results can be ordered by score or ID.
  3. Iterator interface for consecutive KNN queries.
  4. Range queries
  5. Multiple vector indexing for the same label (multi-value indexing)
  6. 3rd party allocators

Datatypes SIMD support

Operation x86_64 arm64v8 Apple silicone
FP32 Internal product SSE, AVX, AVX512 No SIMD support No SIMD support
FP32 L2 distance SSE, AVX, AVX512 No SIMD support No SIMD support
FP64 Internal product SSE, AVX, AVX512 No SIMD support No SIMD support
FP64 L2 distance SSE, AVX, AVX512 No SIMD support No SIMD support

Flat (Brute Force)

Brute force comparison of the query vector q with the stored vectors. Vectors are stored in vector blocks, which are contiguous memory blocks, with configurable size.

HNSW

Modified implementation of hnswlib. Modified to accommodate the above feature set.

Build

For building you will need:

  1. Python 3 as python (either by creating a virtual environment or setting your system python to point to the right python distribution)
  2. gcc >= 10
  3. cmake version >= 3.10

To build the main library, unit tests, and Python bindings in one command run

make

Unit tests

To execute unit tests run

make unit_test

Memory check

To run the unit tests with Valgrind run

make unit_test VALGRIND=1

Python bindings

Examples of using the Python bindings to run vector similarity search can be found in tests/flow. To build the Python wheel, first create a dedicated virtualenv using Python 3.7 and higher. Then, activate the environment, install the dependencies, and build the package. Please note, due to the way poetry generates a setup.py, you may have to erase it before re-running poetry build.

python -m venv venv
source venv/bin/activate
pip install poetry
poetry install
poetry build

To run in debug mode, replace the last two lines with:

DEBUG=1 poetry install
DEBUG=1 poetry build

After building the wheel, if you want to use the package you built, you will need to manually execute a pip install dist/.whl. Remember to replace with the complete package name.

Testing Python bindings

This will create a new virtual environment (if needed), install the wheel, and execute the Python bindings tests

poetry run pytest tests/flow

Or you can use the make command:

make flow_test

Benchmark

To benchmark the capabilities of this library, follow the instructions in the benchmarks user guide. If you'd like to create your own benchmarks, you can find more information in the developer guide.

vectorsimilarity's People

Contributors

alonre24 avatar ashtul avatar chayim avatar dependabot[bot] avatar dvirdukhan avatar gkorland avatar guyav46 avatar jonasbn avatar lsena avatar meiravgri avatar rafie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vectorsimilarity's Issues

please provide a PDF of your CLA that I can route for signature

Hello, my organization does not permit developers to "sign" a CLA via GitHub login. I need an actual document that I can route through DocuSign for approval (digital stamping) by my legal department before someone with authority to agree to the CLA (not a developer) can digitally sign it. Can you please provide a PDF version of the CLA with a place for signature? Thanks!

Compilation error

Describe the bug
The compilation fails.

To Reproduce
Steps to reproduce the behavior:
Compile.

Expected behavior
Successful compilation.

Screenshots

[ 71%] Building C object CMakeFiles/rscore.dir/src/rlookup.c.o
[ 71%] Building CXX object deps/googletest/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 72%] Building C object CMakeFiles/rscore.dir/src/rs_geo.c.o
[ 72%] Building C object CMakeFiles/rscore.dir/src/rules.c.o
[ 72%] Building C object CMakeFiles/rscore.dir/src/rwlock.c.o
[ 73%] Building C object CMakeFiles/rscore.dir/src/score_explain.c.o
[ 73%] Building C object CMakeFiles/rscore.dir/src/sortable.c.o
[ 73%] Building C object CMakeFiles/rscore.dir/src/spec.c.o
[ 73%] Building C object CMakeFiles/rscore.dir/src/spell_check.c.o
[ 74%] Building C object CMakeFiles/rscore.dir/src/stemmer.c.o
[ 74%] Building C object CMakeFiles/rscore.dir/src/stopwords.c.o
[ 74%] Building C object CMakeFiles/rscore.dir/src/suffix.c.o
[ 75%] Building C object CMakeFiles/rscore.dir/src/suggest.c.o
[ 75%] Building C object CMakeFiles/rscore.dir/src/summarize_spec.c.o
[ 75%] Building C object CMakeFiles/rscore.dir/src/synonym_map.c.o
[ 76%] Building C object CMakeFiles/rscore.dir/src/tag_index.c.o
[ 76%] Building C object CMakeFiles/rscore.dir/src/tokenize.c.o
[ 76%] Building C object CMakeFiles/rscore.dir/src/tokenize_cn.c.o
In file included from /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/info_iterator_struct.h:10,
                 from /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/vec_sim_interface.h:11,
                 from /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/vec_sim_index.h:9,
                 from /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/index_factories/tiered_factory.h:11,
                 from /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/index_factories/tiered_factory.cpp:7:
In function 'T* array_ensure_cap(T*, size_t) [with T = VecSimQueryResult]',
    inlined from 'T* array_concat(T*, T*) [with T = VecSimQueryResult]' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/arr_cpp.h:67:27,
    inlined from 'void concat_results(VecSimQueryResult_List&, VecSimQueryResult_List&)' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/query_result_utils.h:103:23,
    inlined from 'VecSimQueryResult_List VecSimTieredIndex<DataType, DistType>::rangeQuery(const void*, double, VecSimQueryParams*, VecSimQueryResult_Order) const [with DataType = float; DistType = float]' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/vec_sim_tiered_index.h:246:27:
/home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/arr_cpp.h:46:20: error: array subscript -1 is outside array bounds of 'VecSimQueryResult [576460752303423487]' [-Werror=array-bounds=]
   46 |     if (cap > hdr->cap) {
      |               ~~~~~^~~
[ 76%] Linking CXX static library ../../../lib/libgtest_main.a
[ 76%] Built target gtest_main
In function 'T* array_ensure_cap(T*, size_t) [with T = VecSimQueryResult]',
    inlined from 'T* array_concat(T*, T*) [with T = VecSimQueryResult]' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/arr_cpp.h:67:27,
    inlined from 'void concat_results(VecSimQueryResult_List&, VecSimQueryResult_List&)' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/query_result_utils.h:103:23,
    inlined from 'VecSimQueryResult_List VecSimTieredIndex<DataType, DistType>::rangeQuery(const void*, double, VecSimQueryParams*, VecSimQueryResult_Order) const [with DataType = double; DistType = double]' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/vec_sim_tiered_index.h:246:27:
/home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/arr_cpp.h:46:20: error: array subscript -1 is outside array bounds of 'VecSimQueryResult [576460752303423487]' [-Werror=array-bounds=]
   46 |     if (cap > hdr->cap) {
      |               ~~~~~^~~
[ 77%] Building C object CMakeFiles/rscore.dir/src/trie/levenshtein.c.o
[ 77%] Building C object CMakeFiles/rscore.dir/src/trie/rune_util.c.o
[ 77%] Building C object CMakeFiles/rscore.dir/src/trie/sparse_vector.c.o
In function 'T* array_ensure_cap(T*, size_t) [with T = VecSimQueryResult]',
    inlined from 'T* array_concat(T*, T*) [with T = VecSimQueryResult]' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/arr_cpp.h:67:27,
    inlined from 'void concat_results(VecSimQueryResult_List&, VecSimQueryResult_List&)' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/query_result_utils.h:103:23,
    inlined from 'VecSimQueryResult_List TieredHNSWIndex<DataType, DistType>::TieredHNSW_BatchIterator::getNextResults(size_t, VecSimQueryResult_Order) [with DataType = float; DistType = float]' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/algorithms/hnsw/hnsw_tiered.h:913:27:
/home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/arr_cpp.h:46:20: error: array subscript -1 is outside array bounds of 'VecSimQueryResult [576460752303423487]' [-Werror=array-bounds=]
   46 |     if (cap > hdr->cap) {
      |               ~~~~~^~~
[ 77%] Building C object CMakeFiles/rscore.dir/src/trie/trie.c.o
[ 78%] Building C object CMakeFiles/rscore.dir/src/trie/trie_type.c.o
[ 78%] Building C object CMakeFiles/rscore.dir/src/util/arr.c.o
In function 'T* array_ensure_cap(T*, size_t) [with T = VecSimQueryResult]',
    inlined from 'T* array_concat(T*, T*) [with T = VecSimQueryResult]' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/arr_cpp.h:67:27,
    inlined from 'void concat_results(VecSimQueryResult_List&, VecSimQueryResult_List&)' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/query_result_utils.h:103:23,
    inlined from 'VecSimQueryResult_List TieredHNSWIndex<DataType, DistType>::TieredHNSW_BatchIterator::getNextResults(size_t, VecSimQueryResult_Order) [with DataType = double; DistType = double]' at /home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/algorithms/hnsw/hnsw_tiered.h:913:27:
/home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/VectorSimilarity/src/VecSim/utils/arr_cpp.h:46:20: error: array subscript -1 is outside array bounds of 'VecSimQueryResult [576460752303423487]' [-Werror=array-bounds=]
   46 |     if (cap > hdr->cap) {
      |               ~~~~~^~~
[ 78%] Building C object CMakeFiles/rscore.dir/src/util/array.c.o
[ 79%] Building C object CMakeFiles/rscore.dir/src/util/block_alloc.c.o
[ 79%] Building C object CMakeFiles/rscore.dir/src/util/dict.c.o
[ 79%] Building C object CMakeFiles/rscore.dir/src/util/fnv.c.o
[ 80%] Building C object CMakeFiles/rscore.dir/src/util/heap.c.o
[ 80%] Building C object CMakeFiles/rscore.dir/src/util/khtable.c.o
[ 80%] Building C object CMakeFiles/rscore.dir/src/util/logging.c.o
[ 80%] Building C object CMakeFiles/rscore.dir/src/util/mempool.c.o
[ 81%] Building C object CMakeFiles/rscore.dir/src/util/minmax_heap.c.o
[ 81%] Building C object CMakeFiles/rscore.dir/src/util/misc.c.o
[ 81%] Building C object CMakeFiles/rscore.dir/src/util/quantile.c.o
[ 82%] Building C object CMakeFiles/rscore.dir/src/util/references.c.o
[ 82%] Building C object CMakeFiles/rscore.dir/src/util/threadpool_api.c.o
[ 82%] Building C object CMakeFiles/rscore.dir/src/util/workers.c.o
cc1plus: all warnings being treated as errors
[ 83%] Building C object CMakeFiles/rscore.dir/src/value.c.o
[ 83%] Building C object CMakeFiles/rscore.dir/src/varint.c.o
[ 83%] Building C object CMakeFiles/rscore.dir/src/vector_index.c.o
make[3]: *** [deps/VectorSimilarity/src/VecSim/CMakeFiles/VectorSimilarity.dir/build.make:104: deps/VectorSimilarity/src/VecSim/CMakeFiles/VectorSimilarity.dir/index_factories/tiered_factory.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
[ 83%] Built target rscore
make[2]: *** [CMakeFiles/Makefile2:611: deps/VectorSimilarity/src/VecSim/CMakeFiles/VectorSimilarity.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[ 83%] Linking CXX static library libredisearch-geometry.a
[ 83%] Built target redisearch-geometry
make[1]: *** [Makefile:136: all] Error 2
make: *** [/home/matheus/aur/redi-search/src/redi-search-2.8.4/deps/readies/mk/cmake.rules:31: /home/matheus/aur/redi-search/src/redi-search-2.8.4/bin/linux-x64-release/search/redisearch.so] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
error: failed to build:

Environment (please complete the following information):

  • OS: Arch Linux
  • CPU model
  • Version/branch: 2.8.4
  • GCC: 13.2.1

Additional context

Is VectorSimilarity Usable For C API?

As far as I can tell, documentation of how to actually use the VectorSimilarity C API from a client program is scarce, and it doesn't seem to be yet ready for this purpose. Can you please provide clarification on the roadmap for moving this to production? I'm ideally looking for support of RediSearch and vector similarity in C++ for production use, though a simple C option would be sufficient!

vecsim index performance: hnswlib::L2SqrSIMD4Ext takes 39.35% of on-cpu cycles ( _mm_add_ps and _mm_loadu_ps are related to it )

Sample rdb loadable via vecsim search brach:

s3://benchmarks.redislabs/redisearch/vecsim/ann-benchmarks/glove-100-angular/dump.rdb

Sample query:

627473461.931705 [0 127.0.0.1:41480] "HSET" "ann_14541" "vector" "\x98Q\xec\xbd\x84\x81\xf7>\xb4<o\xbe*\xe3\xbf>m\xc5\xde\xbe\xf7u\b\xbfK\x02\x14>V\x82%\xbe\x02\x829>W\xb1x<y\x1e$?\xd69\xd6>\xa8Wz?;\xdf\x87\xbf\xa3\x92\xca?=\xb8\xdb\xbe\xcc\xb45?\xdc\x7f\xa4=\x0eJ(?\x97sy?W\xcf\x01?+\xa4\x9c\xbeKY\xa6\xbe\xdb3\xbb>\xee_\xb9>\x9c\xdc\xdf>\xb0\xac4\xbd\x92\a\x82\xbd\xd6s\xb2\xbeU\xde\x1e?E\rN?e\x01\x93<\x1f\xbf7>\xa1\xd6\x14\xbf\x97\xa8\xde\xbe\x1d8\xf7\xbeX9\x84>\xa0\x1a\x97?\x12\xa2\xfc\xbc\xd9|\xac>\x9c\xa7\xba\xbe\xbb\xf2Y>=~\xcf\xbe\x93\xa9\x02>\xa0\xe0\x82\xbe\xffx\xef=u\xc85\xbf\x05\xa2\xa7\xbd\xb1\x16_\xbeJ\x98\t?\xe6t\x19\xbe\xef\xac\xdd=\xf4\xa6:?\xf6E\x02\xbe\x9f\xc8\x0b?ms\x83\xbe\xc8\xef\x05\xbfi5\x04\xbe\xe2X\a?O\xcc\x9a>*o\x17?_{.?8g\x94?\xee\xb1\x84\xbe\xdf\xa6W\xbf>\"\xe6\xbdk\x9a7\xbd\xfb\\M>\x1f\x11\xd3\xbe\\ y?\xcb\xdb1>\"\xc3\x12?+\x18\x95\xbe\xf2\xb5\x1f\xbf\xc4%\xb7\xbe\xb5\x1a\x1a?WC\xa2>\xb9\x88o>$\xd6J?\x89_1\xbc_{F>\x89\xb4\x8d\xbdI.\x8f\xbf\xa2b\x9c>\xaa\xb7\xd6\xbe\xbb\x0f ?z\xc2r>\xa1\x10\xc1\xbe\xda \x03\xbf\xbe\xf6\x8c>\xa1\x83\xae\xbc\xbaI\xb4?\x96&\x85\xbd\xc4\xeb\xca\xbe\xee\xce\x1a?\xf47\x81\xbe\x89\b\xbf\xbd\x99\r\xe2>;p\x8e\xbe/\xf8t="

Top on CPU consumers:

Flat Flat% Sum% Cum Cum% Name Inlined?
38718330030 17.65% 17.65% 38766179198 17.67% _mm_loadu_ps (inline)
18647707936 8.50% 26.15% 18666112242 8.51% _mm_add_ps (inline)
15234704835 6.94% 33.09% 86321125827 39.35% hnswlib::L2SqrSIMD4Ext  
10545240828 4.81% 37.90% 10556520348 4.81% _mm_mul_ps (inline)
3086731940 1.41% 39.31% 3086731940 1.41% _mm_sub_ps (inline)
0 0.00% 39.31% 86317305756 39.34% vectorIndexer (inline)
0 0.00% 39.31% 86317305756 39.34% moduleNotifyKeyspaceEvent  
0 0.00% 39.31% 86317305756 39.34% indexBulkFields  
0 0.00% 39.31% 68849073985 31.38% hnswlib::HierarchicalNSW::searchBaseLayer  
0 0.00% 39.31% 12029285653 5.48% hnswlib::HierarchicalNSW::mutuallyConnectNewElement  
0 0.00% 39.31% 86258259186 39.32% hnswlib::HierarchicalNSW::addPoint  
0 0.00% 39.31% 86317305756 39.34% Indexes_UpdateMatchingWithSchemaRules  
0 0.00% 39.31% 86317305756 39.34% Indexer_Process  
0 0.00% 39.31% 86317305756 39.34% Indexer_Add  
0 0.00% 39.31% 86317305756 39.34% IndexerBulkAdd  
0 0.00% 39.31% 86317305756 39.34% IndexSpec_UpdateDoc  
0 0.00% 39.31% 86317305756 39.34% HashNotificationCallback  
0 0.00% 39.31% 86317305756 39.34% HNSWIndex_AddVector  
0 0.00% 39.31% 86317305756 39.34% Document_AddToIndexes  
0 0.00% 39.31% 86317305756 39.34% AddDocumentCtx_Submit  

Flame Chart detail of hnswlib::L2SqrSIMD4Ext cpu cycles

image

Link:
https://s3.amazonaws.com/benchmarks.redislabs/redisearch/vecsim/perf-tasks/ann-benchmarks/glove-100-angular/ann-benchmark-indexing.svg

Add `Index_UpdateVector` function to the LLAPI

The function will have 3 return values.

  1. Old_id and vector match.
  2. Old_id matches, vector does not match.
  3. Old_id does not match regardless of the vector match.

The function will be used by RediSearch when a document gets updated in order to avoid deletion and addition of a vector which are costly.

Suggestion for a function signature:
typedef int (*Index_UpdateVector)(VecSimIndex* index, const void* blob, size_t old_id, size_t new_id);

Cannot build it. AVX problem

Hello. Trying VecSim module on Debian stretch, but getting this error. With VECSIM_MARCH: x86_x64-v4 result is the same.
Debian is running on vmware machine on Ryzen 5000. Tried the same on the e5-2690v3x2 - no luck.
What am I doing wrong?

The output:

Not searching for unused variables given on the command line.
# VectorSimilarity root: /root/redis/VectorSimilarity
# VectorSimilarity binroot: /root/redis/VectorSimilarity/bin/linux-x64-release
# OS=
# OSNICK=stretch
# ARCH=x64
# VECSIM_MARCH: native
-- Failed to find LLVM FileCheck
-- git version: v0.0.0-dirty normalized to 0.0.0
-- Version: 1.6.0
-- Performing Test HAVE_STD_REGEX -- success
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
VecSim/spaces VECSIM_MARCH: native
# VectorSimilarity/tests/unit root: /root/redis/VectorSimilarity
# VectorSimilarity/tests/unit binroot: /root/redis/VectorSimilarity/bin/linux-x64-release
# VectorSimilarity_ModuleTest root:/root/redis/VectorSimilarity
# VectorSimilarity_ModuleTest binroot:/root/redis/VectorSimilarity/bin/linux-x64-release
# VectorSimilarity_Benchmark root: /root/redis/VectorSimilarity
# VectorSimilarity_Benchmark binroot: /root/redis/VectorSimilarity/bin/linux-x64-release
-- Configuring done
-- Generating done
-- Build files have been written to: /root/redis/VectorSimilarity/bin/linux-x64-release
Building /root/redis/VectorSimilarity/bin/linux-x64-release/libVectorSimilarity.so ...
[  1%] Building CXX object VecSim/spaces/CMakeFiles/VectorSimilaritySpaces.dir/L2/L2_AVX512.cpp.o
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp: In function ‘float L2SqrSIMD16Ext_AVX512(const void*, const void*, const void*)’:
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:16:34: warning: AVX512F vector return without AVX512F enabled changes the ABI [-Wpsabi]
     __m512 sum = _mm512_set1_ps(0);
                                  ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/6/include/x86intrin.h:48,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/space_includes.h:14,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:3:
/usr/lib/gcc/x86_64-linux-gnu/6/include/avx512fintrin.h:180:1: error: inlining failed in call to always_inline ‘__m512 _mm512_set1_ps(float)’: target specific option mismatch
 _mm512_set1_ps (float __A)
 ^~~~~~~~~~~~~~
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:16:34: note: called from here
     __m512 sum = _mm512_set1_ps(0);
                                  ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/6/include/x86intrin.h:48,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/space_includes.h:14,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:3:
/usr/lib/gcc/x86_64-linux-gnu/6/include/avx512fintrin.h:5718:1: error: inlining failed in call to always_inline ‘__m512 _mm512_loadu_ps(const void*)’: target specific option mismatch
 _mm512_loadu_ps (void const *__P)
 ^~~~~~~~~~~~~~~
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:19:37: note: called from here
         v1 = _mm512_loadu_ps(pVect1);
                                     ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/6/include/x86intrin.h:48,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/space_includes.h:14,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:3:
/usr/lib/gcc/x86_64-linux-gnu/6/include/avx512fintrin.h:5718:1: error: inlining failed in call to always_inline ‘__m512 _mm512_loadu_ps(const void*)’: target specific option mismatch
 _mm512_loadu_ps (void const *__P)
 ^~~~~~~~~~~~~~~
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:21:37: note: called from here
         v2 = _mm512_loadu_ps(pVect2);
                                     ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/6/include/x86intrin.h:48,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/space_includes.h:14,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:3:
/usr/lib/gcc/x86_64-linux-gnu/6/include/avx512fintrin.h:10710:1: error: inlining failed in call to always_inline ‘__m512 _mm512_add_ps(__m512, __m512)’: target specific option mismatch
 _mm512_add_ps (__m512 __A, __m512 __B)
 ^~~~~~~~~~~~~
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:25:60: note: called from here
         sum = _mm512_add_ps(sum, _mm512_mul_ps(diff, diff));
                                                            ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/6/include/x86intrin.h:48,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/space_includes.h:14,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:3:
/usr/lib/gcc/x86_64-linux-gnu/6/include/avx512fintrin.h:10830:1: error: inlining failed in call to always_inline ‘__m512 _mm512_mul_ps(__m512, __m512)’: target specific option mismatch
 _mm512_mul_ps (__m512 __A, __m512 __B)
 ^~~~~~~~~~~~~
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:25:28: note: called from here
         sum = _mm512_add_ps(sum, _mm512_mul_ps(diff, diff));
               ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/6/include/x86intrin.h:48,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/space_includes.h:14,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:3:
/usr/lib/gcc/x86_64-linux-gnu/6/include/avx512fintrin.h:10770:1: error: inlining failed in call to always_inline ‘__m512 _mm512_sub_ps(__m512, __m512)’: target specific option mismatch
 _mm512_sub_ps (__m512 __A, __m512 __B)
 ^~~~~~~~~~~~~
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:23:37: note: called from here
         diff = _mm512_sub_ps(v1, v2);
                                     ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/6/include/immintrin.h:45:0,
                 from /usr/lib/gcc/x86_64-linux-gnu/6/include/x86intrin.h:48,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/space_includes.h:14,
                 from /root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:3:
/usr/lib/gcc/x86_64-linux-gnu/6/include/avx512fintrin.h:373:1: error: inlining failed in call to always_inline ‘void _mm512_store_ps(void*, __m512)’: target specific option mismatch
 _mm512_store_ps (void *__P, __m512 __A)
 ^~~~~~~~~~~~~~~
/root/redis/VectorSimilarity/src/VecSim/spaces/L2/L2_AVX512.cpp:28:33: note: called from here
     _mm512_store_ps(TmpRes, sum);
                                 ^
VecSim/spaces/CMakeFiles/VectorSimilaritySpaces.dir/build.make:127: recipe for target 'VecSim/spaces/CMakeFiles/VectorSimilaritySpaces.dir/L2/L2_AVX512.cpp.o' failed
make[3]: *** [VecSim/spaces/CMakeFiles/VectorSimilaritySpaces.dir/L2/L2_AVX512.cpp.o] Error 1
CMakeFiles/Makefile2:1523: recipe for target 'VecSim/spaces/CMakeFiles/VectorSimilaritySpaces.dir/all' failed
make[2]: *** [VecSim/spaces/CMakeFiles/VectorSimilaritySpaces.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make[1]: *** [all] Error 2
Makefile:191: recipe for target '/root/redis/VectorSimilarity/bin/linux-x64-release/libVectorSimilarity.so' failed
make: *** [/root/redis/VectorSimilarity/bin/linux-x64-release/libVectorSimilarity.so] Error 2
Press any key to continue...```

[Feature Request] integrate redis similarity search into docarray

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Hi everyone, thanks for your great work on adding HNSW to Redis. I'm Bo working at @jina-ai . We build tools for developers for vector similarity search. And we would like to integrate Redis as one of our storage option in docarray, i was wondering can we have some collaborations over that?

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Crush when vector index is queried after it was emptied

test:

def test_query_empty(env):
    conn = getConnectionByEnv(env)
    conn.execute_command('FT.CREATE', 'idx', 'SCHEMA', 'v', 'VECTOR', 'INT32', '2', 'L2', 'HNSW')
    env.expect('FT.SEARCH', 'idx', '@v:[abcdefgh TOPK 1]').equal([0L])
    conn.execute_command('HSET', 'a', 'v', 'redislab')
    env.expect('FT.SEARCH', 'idx', '@v:[abcdefgh TOPK 1]').equal([1L, 'a', ['v', 'redislab']])
    conn.execute_command('DEL', 'a')
    env.expect('FT.SEARCH', 'idx', '@v:[abcdefgh TOPK 1]').equal([0L])

Compilation error

Describe the bug
Unable to compile

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/RedisAI/VectorSimilarity
  2. cd VectorSimilarity
  3. make

Expected behavior
Compilation should succeed

Screenshots
image

Environment (please complete the following information):

  • OS: Fedora 37
  • CPU model: AMD Ryzen 7 5800HS
  • Master

Additional context
I got the exact issue when trying to compile on Alpine linux (x86).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.