Commit Graph

511 Commits

Author SHA1 Message Date
Andrew Kane
3bd67fef54 DRY halfvec distance functions 2024-04-07 19:03:20 -07:00
Andrew Kane
d861a0304e Removed extra space [skip ci] 2024-04-07 19:02:30 -07:00
Andrew Kane
d8719d59a3 Improved halfvec performance with F16C support 2024-04-07 18:53:50 -07:00
Andrew Kane
33daf87fcb Improved performance of HalfToFloat4 2024-04-07 13:01:58 -07:00
Andrew Kane
8d7e0e693c Fixed vector to sparsevec conversion 2024-04-07 10:30:54 -07:00
Andrew Kane
60104264d5 Improved error message [skip ci] 2024-04-06 15:52:26 -07:00
Andrew Kane
4450029bdc Changed indices to start at 1 for sparse vectors to match SQL 2024-04-06 14:02:07 -07:00
Andrew Kane
aec853dc68 Added memory usage for HNSW index scans [skip ci] 2024-04-04 14:37:39 -07:00
Andrew Kane
8961de6179 Improved halfvec input check [skip ci] 2024-04-03 22:23:23 -07:00
Andrew Kane
9f61dcff5d Improved error messages for halfvec input [skip ci] 2024-04-03 22:20:13 -07:00
Andrew Kane
3219a30290 Raise error for varbit 2024-04-03 21:30:43 -07:00
Andrew Kane
fc1aeee62c Added SPARSEVEC_MAX_NNZ 2024-04-03 21:05:35 -07:00
Andrew Kane
35d0fe88b9 Added IvfflatType [skip ci] 2024-04-03 16:40:27 -07:00
Andrew Kane
aaa2d644ce Added quantize_binary and subvector functions for halfvec 2024-04-03 14:53:03 -07:00
Andrew Kane
060d299e4b Improved error message for out of range elements 2024-04-03 10:12:17 -07:00
Andrew Kane
abac7a3f77 Added sparsevec type 2024-04-02 14:25:09 -07:00
Andrew Kane
32a502c838 Added halfvec type 2024-04-02 13:55:45 -07:00
Andrew Kane
835f010257 Fixed missing header for Postgres 12 2024-04-02 12:17:41 -07:00
Andrew Kane
d6044dd423 Added subvector function 2024-04-02 12:13:04 -07:00
Andrew Kane
c75634a03c Fixed type check [skip ci] 2024-04-01 22:31:02 -07:00
Andrew Kane
ab7b2ed39e Updated comparison operators to support vectors with different dimensions - #451 2024-04-01 22:12:06 -07:00
Andrew Kane
1c82bdd932 Updated comments [skip ci] 2024-04-01 20:33:12 -07:00
Andrew Kane
94a444f029 Added support for bit vectors to HNSW 2024-04-01 20:30:55 -07:00
Andrew Kane
2f2f3631a8 Improved vector_out code 2024-03-31 09:55:07 -07:00
Andrew Kane
2c48e3edc2 Mark type-specific code 2024-03-29 14:01:48 -07:00
Andrew Kane
de410a2915 Use variable for max dimemsions [skip ci] 2024-03-29 10:57:16 -07:00
Andrew Kane
64aa99aa31 Added todo [skip ci] 2024-03-29 10:56:24 -07:00
Andrew Kane
997fa167da Removed vector-specific code from HNSW 2024-03-29 10:50:06 -07:00
Andrew Kane
396090d8e0 Improved code [skip ci] 2024-03-27 21:38:22 -07:00
Andrew Kane
ba18942fcf Removed normvec from IVFFlat for simplicity (no difference in performance) 2024-03-27 16:41:17 -07:00
Andrew Kane
8e59455c3c Removed normvec for simplicity (no difference in performance) 2024-03-27 16:33:11 -07:00
Andrew Kane
1dc6514b66 Updated comment [skip ci] 2024-03-15 12:38:14 -07:00
Andrew Kane
6c53f7ca02 Updated comment [skip ci] 2024-03-15 12:37:47 -07:00
Heikki Linnakangas
0d35a14198 Fix compiler warnings in strict C99 mode (#487)
Redefining a typedef is a C11 feature:

    In file included from src/hnsw.c:10:
    src/hnsw.h:147:5: warning: redefinition of typedef 'HnswElementData' is a C11 feature [-Wtypedef-redefinition]
    }                       HnswElementData;
                            ^
    src/hnsw.h:118:32: note: previous definition is here
    typedef struct HnswElementData HnswElementData;
                                   ^
    src/hnsw.h:163:5: warning: redefinition of typedef 'HnswNeighborArray' is a C11 feature [-Wtypedef-redefinition]
    }                       HnswNeighborArray;
                            ^
    src/hnsw.h:119:34: note: previous definition is here
    typedef struct HnswNeighborArray HnswNeighborArray;
                                     ^
    2 warnings generated.

I got these warnings when I built PostgreSQL with "CC=clang
CFLAGS=-std=gnu99"; other similar options would surely produce the
warnings too.
2024-03-12 02:02:33 -07:00
Andrew Kane
3ea2ce89be Reduced lock contention with parallel HNSW index builds 2024-03-11 20:16:55 -07:00
Andrew Kane
91e3d2905f Fixed sort function for Postgres 12 2024-02-28 16:26:41 -08:00
Andrew Kane
fe2406564f Replaced pairing heap with array in SelectNeighbors - closes #447
Co-authored-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>
2024-02-28 15:47:26 -08:00
Andrew Kane
fa52511eaa Fixed closer caching for Postgres 12 2024-02-28 15:44:38 -08:00
Andrew Kane
b447ae4989 Avoid base address for relptr for Postgres < 14.5 2024-02-28 14:10:14 -08:00
Andrew Kane
efed873a3e Revert "Replaced pairing heap with array in SelectNeighbors - closes #447"
This reverts commit 14b278dec9.
2024-02-28 11:33:14 -08:00
Andrew Kane
14b278dec9 Replaced pairing heap with array in SelectNeighbors - closes #447
Co-authored-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>
2024-02-28 11:25:12 -08:00
Andrew Kane
ca10cbaa7d Revert "Remove offsethash"
This reverts commit 1cbd204f52.
2024-02-20 16:07:32 -08:00
Andrew Kane
eb29019a14 Revert "Eliminate a few HnswPtrAccess invocations"
This reverts commit 334c386a45.
2024-02-20 16:07:21 -08:00
Heikki Linnakangas
334c386a45 Eliminate a few HnswPtrAccess invocations
HnswPtrAccess() is pretty cheap, but it stills seems worthwhile to
avoid repeated calls in the hot paths when it can be easily avoided.
2024-02-19 14:13:18 +02:00
Heikki Linnakangas
1cbd204f52 Remove offsethash
The original motivation was to eliminate the superfluous HnswPtrAccess
call from AddToVisited. The caller has to call HnswPtrAccess() anyway,
so it makes sense to pass the HnswElement rather than HnswElementPtr
to AddToVisited(). But then I realized that we can use the
pointer-variant even with shared memory, because the visited-hash is
backend-private, and the addresses where the elements are mapped to in
shared memory are stable within the backend.
2024-02-19 14:12:26 +02:00
Andrew Kane
5ba62fca84 Fixed crash with shared_preload_libraries - fixes #460 2024-02-14 17:13:30 -08:00
Andrew Kane
f43cd0ed98 Improved type [skip ci] 2024-02-05 19:38:52 -08:00
Andrew Kane
2716a223a6 Fixed error with ANALYZE and vectors with different dimensions - fixes #451 2024-02-02 10:47:48 -08:00
Andrew Kane
5b43aaad5a Removed unneeded item ids 2024-01-28 23:14:52 -08:00
Andrew Kane
797ce8034c Ran pgindent [skip ci] 2024-01-28 23:03:48 -08:00