Commit Graph

268 Commits

Author SHA1 Message Date
Andrey Vasnetsov
b5edc9066b use 64-bit dim-id for storing sparse vectors (#5687)
* use 64-bit dim-id for storing sparse vectors

* allow to disable compression in blob storage

* use bitpack compression instead of lz4

* add basic bench for mmap sparse vector storage

* misc

* bump storage compat pre-release

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2025-01-07 21:45:09 +01:00
Luis Cossío
6e1245c414 Fast loading of mmap sparse storage (#5533)
* use mmap bitslice and a metadata file to avoid loading

* fix and test reported files

* add new files to flusher

* update rocksdb+blob_store compatibility test

* switch to DynamicMmapFlags

* fix setting deleted to `false` on short bitslice

* remove `MmapBitSlice::extend`

* add some more tests to mmap sparse vector storage

* calculate deleted_count and next_point_offset on load

* get rid of metadata file

* cleanup

* fix test

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-12-18 16:53:06 -03:00
Luis Cossío
fa525d2b44 Prefer vector index for size_of_available_vectors_in_bytes (#5587)
* get total sparse size from inverted index

* populate on load if not present

* use debug assertion

* correct size calculation

* r u happy clippy

* fix total sparse size in immutable ram

* don't use options. move size_of_available_vectors to other traits

* adjust test

* fix rebase
2024-12-18 13:04:07 -03:00
Luis Cossío
14c1979a47 Integrate mmap bool index (#5571)
* add on_disk option for bool index

* test that all files are covered

* generate openapi and docs

* clippy

* remove `populate` changes

* use `walkdir` crate

* Apply clippy suggestions

---------

Co-authored-by: timvisee <tim@visee.me>
2024-12-16 20:35:10 -03:00
Jojii
e0d0e233d8 Timeout aware hardware counter (#5555)
* Make hardware counting timeout aware

* improve test

* rebuild everything

* fmt

* post-rebase fixes

* upd tests

* fix tests

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-12-10 12:12:36 +01:00
Andrey Vasnetsov
2a5b46e780 use fsync instead of flush (#5629) 2024-12-10 00:13:03 +01:00
Ivan Pleshkov
8490f5cd3c Atomic save chunked mmap config (#5628)
* atomic save chunked mmap config

* are you happy clippy

* log error

* review remarks
2024-12-09 22:24:54 +01:00
Arnaud Gourlay
8a94f0ceba Enforce clippy needless_pass_by_ref_mut (#5561) 2024-12-03 10:15:18 +01:00
xzfc
4548ebe4bf Reduce debug size (#5556)
* debug size: RawScorerImpl::peek_top_iter

* debug size: TypedMultiDenseVector::multi_vectors() uses

* debug size: stop_condition -> stopped
2024-12-02 14:33:35 +00:00
Luis Cossío
608736219f restructure sparse storages module (#5532) 2024-11-27 13:46:57 -06:00
Luis Cossío
2de122adea Compatibility for mmap sparse vectors (#5454)
* implement mmap sparse vector storage

* add to VectorStorageEnum

* clippy

* add tests, fix both simple and mmap storages

* smol correction on total_vector_count

* add sparse storage type to config

* fix reading config without storage type

* generate openapi

* use blob_store by path

* hidden setting to enable new storage

* validate existing path in `BlobStore::open()`

* use new dir for each sparse vector name

* fix and rename `max_point_offset`

Plus some extra refactors

* add storage compat test, to always check both storages work

* fix opening of storage + other misc fixes

* FIX!!!

`Unset` operations in the Tracker weren't updating the
`next_pointer_id`. So, when reopening the storage, those points wouldn't
get marked as deleted in the bitslice, thus creating the illusion that
they should exist, when they did not.

* refactor naming from `iter_*` to `for_each_*`

* fix checking for BlobStore existance

* fix typo

* fix error message

* better docs for open_or_create

* fix after rebase
2024-11-27 11:45:16 -06:00
Arnaud Gourlay
b6caf4e55b Clippy 1.83 (#5513)
* Clippy 1.83

* there is more
2024-11-27 11:24:58 +01:00
Ivan Pleshkov
a770a7f3a0 Gpu vectors (#5339)
* parent 33b2c176cb
author Ivan Pleshkov <pleshkov.ivan@gmail.com> 1729676438 +0200
committer Ivan Pleshkov <pleshkov.ivan@gmail.com> 1732012991 +0100

parent 33b2c176cb
author Ivan Pleshkov <pleshkov.ivan@gmail.com> 1729676438 +0200
committer Ivan Pleshkov <pleshkov.ivan@gmail.com> 1732012977 +0100

parent 33b2c176cb
author Ivan Pleshkov <pleshkov.ivan@gmail.com> 1729676438 +0200
committer Ivan Pleshkov <pleshkov.ivan@gmail.com> 1732012901 +0100

parent 33b2c176cb
author Ivan Pleshkov <pleshkov.ivan@gmail.com> 1729676438 +0200
committer Ivan Pleshkov <pleshkov.ivan@gmail.com> 1732012766 +0100

parent 33b2c176cb
author Ivan Pleshkov <pleshkov.ivan@gmail.com> 1729676438 +0200
committer Ivan Pleshkov <pleshkov.ivan@gmail.com> 1732012730 +0100

vulkan api wrapper crate

fmt

gpu is not a workspace member

exclude gpu from workspace

disable tests for gpu crate

ash version up

change collection for pipeline builder

gpu test

gpu is not optional

check device features

remove feature

make all fields private

more comments

are you happy fmt

qdrant team as authors

gpu vectors

move changes from magic branch

move storage updates

are you happy codespell

are you happy clippy

don't make storage_impl public

review remarks

are you happy clippy

are you happy fmt

* Update lib/segment/src/index/hnsw_index/gpu/gpu_vector_storage/tests.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* review remarks

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2024-11-27 09:50:10 +01:00
Luis Cossío
fbf2ca940f [vector storages] Don't skip marking as deleted (#5510)
* don't skip marking as deleted

* edit test, which fails in dev

* better description
2024-11-25 08:31:03 -06:00
Arnaud Gourlay
23f2e5ad13 Optimize mmap sequential access for large scoring (#5440)
* Optimize mmap sequential access for large scoring

* use it

* make windows happy

* add missing CPU counters

* Will not need

* more unix build

* add benchmark

* fix and bench cmp

* larger batch size

* start appendable mmap implem

* reenable debug for bench

* remove old impl for comparison

* impl for chunk mmap

* fix windows

* debug assert

* errare human est

* windows cfg

* generalize peek_top_iter

* remove blanket implementation to force explicit decision

* less TODO

* account for size of T

* fmr

* simplify chunk impl

* relax constraint on contiguous ids

* remove madvice WILLNEED and clean batching infra

* some premature optimizations

* extra sequential mmap for MMapVectorStorage

* add read-only typed mmap

* add read-only typed mmap

* fix comments

* implement batch reads for chuncked mmap

* fix is_read_with_prefetch_efficient

* cleanup

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-11-15 17:14:37 +01:00
Andrey Vasnetsov
c53ad9c103 use more stable computation of vectors_size_bytes + refactoring (#5437)
* use more stable computation of vectors_size_bytes + refactoring

* sync openapi
2024-11-13 16:52:14 +01:00
Arnaud Gourlay
2a0f9e9212 Use references for less cloning when possible (#5409) 2024-11-11 10:26:17 +01:00
Arnaud Gourlay
a9c45313e7 Remove redundant clones (#5402)
* Remove redundant clones

* fmt
2024-11-08 13:02:23 +01:00
Jojii
7b677fb7fa Hardware counting for quantization (#5369)
* add cpu measurement for quantization

* clippy

* fix tests

* discard hardware counters in benchmarks

* Forwarding hardware counter in distributed setup (#5371)

* make hardware counter available in distributed setup

* clippy

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-11-06 16:23:02 +01:00
Andrey Vasnetsov
f843ab6610 detailed is_on_disk (#5373) 2024-11-06 11:04:30 +01:00
Kumar Shivendu
31ce928fcf Track vector storage usage in bytes for each of the segments (#5292)
* Track disk usage for each of the vectors and segments

* Dont extend vector_data field

* Remove comment and improve var name

* Introduce vectors_size_bytes and rename available_size_in_bytes

* Introduce vectors_size_bytes and rename available_size_in_bytes

* fix linter

* Avoid converting to u64

* calculate vectors_size_bytes for proxy segments

* Fix OpenAPI spec

* fix typo
2024-10-25 15:09:31 +05:30
Jojii
98ef428878 Hw counter utilization checks (#5288)
* Enforce usage of hardware counter values

* improve comments

* log a warning in release mode

* some minor improvements

* avoid cloning for hardware counter

* fmt

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-10-25 09:52:18 +02:00
Jojii
669cc4f895 Cpu measurements for dense vector + custom sparse scorer (#5261)
* add measurements for dense vector and custom sparse scorer

* adjust sparse vector scoring cpu measurement

* review suggestions

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-10-22 14:46:17 +02:00
Jojii
5696543123 Add CPU measurement for multivectors (#5241)
* Add CPU measurement for multivectors

* add further test sparse vector search

* make updating vector_query_context consistent

* review fix + take element type into consideration

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-10-18 09:58:02 +02:00
Arnaud Gourlay
90d3d57483 [perf] Do not capture backtrace on get_sparse_vector_opt (#5219)
* Do not capture backtrace on get_sparse_vector_opt

* clean import
2024-10-15 11:07:01 +02:00
Arnaud Gourlay
3de4e107d4 fix lints for Clippy 1.82 (#5229)
* fix lints for Clippy 1.82

* regen openapi
2024-10-14 13:13:58 +02:00
Andrey Vasnetsov
e0d507dac7 Inference interface in REST and gRPC (#5165)
* include document & image objects into grpc API

* introduce image and object to rest api

* minor refactoring

* rename Vector -> VectorInternal

* decompose vector data structures

* add schema

* fmt

* grpc docs

* fix conversion

* fix clippy

* fix another conversion

* rename VectorInput -> VectorInputInternal

* replace grpc TryFrom with async functions

* fmt

* replace rest TryFrom with async functions

* add image and object into query rest

* separate inference related conversions

* move json-related conversions into a separate file

* move vector-related transformations into a separate file

* move more vector related-conversions into dedicated module
2024-10-09 10:15:46 +02:00
Arnaud Gourlay
a9e6849ec2 Optimize reading quantized vectors (#5091) 2024-09-16 18:44:18 +02:00
Andrey Vasnetsov
e8d5cfc63c Allow explicit populate of mmap (#4923)
* expose mmap populate

* expose mmap populate in open_read_mmap

* FOR TEST, REVERSE IT: make InRamChunkedMmap default

* enable populate advise on unix

* fix clippy

* unix -> linux

* Update lib/collection/src/config.rs

* clippy fixes

* resolve conflicts

* fmt

* Runtime check for PopulateRead

---------

Co-authored-by: xzfc <xzfcpw@gmail.com>
2024-09-14 20:53:07 +02:00
Tim Visée
cae2cbbc79 Fix point deletions on mmap segment optimization (#4952)
* Don't use ID but current point offset when optimizing dense mmap storage

This change now matches the implementation in all other storage types.

* Remove now obsolete point offsets in update_from point iterator

* Fix test
2024-08-26 20:02:08 +02:00
Luis Cossío
770d0e5d00 use total_cmp on ordering_after, skip cases where relaxed cmp is Equal (#4911) 2024-08-19 17:09:51 +02:00
xzfc
761d18e037 Drop DynamicMmapFlags file rotation logic (#4891)
* Drop DynamicMmapFlags file rotation logic

* Always use flags_a.dat

* Touch up
2024-08-15 12:02:38 +00:00
Andrey Vasnetsov
707134b43e Refactor chunked mmaps (#4888)
* remove dependency on segment in chunked mmap

* move chunked utils to memory subcrate
2024-08-15 12:04:39 +02:00
xzfc
0e6f86bdfb InRamChunkedMmap: optimize using madvise (#4881)
* refactor: introduce AdviceSetting for open_read_mmap/open_write_mmap

* perf: use Advice::Normal in a few places

* perf: use MADV_DONTNEED after reading

* perf: use POSIX_FADV_DONTNEED after reading
2024-08-14 13:41:37 +00:00
Andrey Vasnetsov
44130a462e Mmap subcrate refactoring (#4886)
* make mmap_type independent from segment structures

* make bitvec and thiserror workspace dependencies

* move mmap_type into common/memory subcrate

* fmt
2024-08-14 11:04:56 +02:00
Luis Cossío
fbd88baf41 Fix reco query tests flakiness (#4815)
* relax float comparison

* use simple delta comparison

* do ulps equality without extra crate
2024-08-09 11:20:24 -04:00
Andrey Vasnetsov
e77b6332dd Use mmap lock as default vector storage (#4828)
* add force_ram parameter to chuncked mmap vector storage

* enable mlocked mmap vector storage on unix by default

* regen openapi

* add mlock on creation of chunck

* minor unrelated renaming

* rollback changes in LockedChunkedMmap

* fmt

* make AppendableMmapDenseVectorStorage generic of storage type

* make AppendableMmapMultiDenseVectorStorage generic of storage type

* implement initialization of InRamChunkedMmap

* implement MultiDenseAppendableInRam and variations

* enable InRamChunkedMmap for multivectors

* use same CHUNK_SIZE for mmap and regular chuncked vectors

* enable InRamChunkedMmap by default

* fix tests

* rollback usage of InRamChunkedMmap by default

* review changes

* add assertion on chunk_capacity [skip-ci]
2024-08-07 16:34:58 +02:00
Luis Cossío
f20d0dc4e2 fix new pedantic lints on mac target_os (#4732) 2024-07-22 16:22:53 -04:00
xzfc
a0ea3caccf Enable some of the pedantic clippy lints (#4715)
* Use workspace lints

* Enable lint: manual_let_else

* Enable lint: enum_glob_use

* Enable lint: filter_map_next

* Enable lint: ref_as_ptr

* Enable lint: ref_option_ref

* Enable lint: manual_is_variant_and

* Enable lint: flat_map_option

* Enable lint: inefficient_to_string

* Enable lint: implicit_clone

* Enable lint: inconsistent_struct_constructor

* Enable lint: unnecessary_wraps

* Enable lint: needless_continue

* Enable lint: unused_self

* Enable lint: from_iter_instead_of_collect

* Enable lint: uninlined_format_args

* Enable lint: doc_link_with_quotes

* Enable lint: needless_raw_string_hashes

* Enable lint: used_underscore_binding

* Enable lint: ptr_as_ptr

* Enable lint: explicit_into_iter_loop

* Enable lint: cast_lossless
2024-07-22 08:19:19 +00:00
Jojii
68373fb600 Basic defragmentation (#4610)
* sorting

* migrate tests and move logic into SegmentBuilder

* add test and improve implementation

* improve code

* review

* code review improvements

* add index building to test

* Do not clone ranges

* Resolve clippy warnings due to recent PR on dev

* review suggestions

* Defragmentation in api (#4684)

* add tenant config to api

* deduplicate used defragmentation keys

* rename is_tenant to is_primary

* use all values to defrag key

* rename is_primary -> is_tenant

* update schema

---------

Co-authored-by: generall <andrey@vasnetsov.com>
Co-authored-by: timvisee <tim@visee.me>
2024-07-18 11:43:56 +02:00
Roman Titov
2e4503918a Derive/implement fmt::Debug for Segment (#4632) 2024-07-09 14:19:42 +02:00
xzfc
9daf5799d2 Remove dead code (#4623) 2024-07-08 09:51:59 +02:00
Arnaud Gourlay
ba522730f8 Fix DynamicMmapFlag counting by not using get proxy (#4589)
* Fix DynamicMmapFlag counting by not using get proxy

* Just count ones in the bitslice of our configured size

---------

Co-authored-by: timvisee <tim@visee.me>
2024-07-02 11:48:20 +02:00
Ivan Pleshkov
5584ed0435 Fix colberts TODOs (#4566)
* Fix colberts TODOs

* are you happy clippy
2024-06-27 10:50:02 +02:00
Andrey Vasnetsov
1878713679 Fix multivector for unnamed vectors (#4482)
* minor conversion improvement

* use NamedVectors in update_vectors

* remove merge from VectorStruct

* rename Multi -> Named in vector struct

* add multi-dense vectors option into VectorStruct

* generate openapi

* rename VectorStruct -> VectorStructInternal

* add conversion for anonymous multivec in grpc

* renames for BatchVectorStruct

* implement multi-dense for batch

* allow multi-dense in batch upserts

* test and fixes
2024-06-18 20:38:24 +02:00
Ivan Pleshkov
3d7647f89b Max size of multivector to fix chunk in storage (#4478)
* Max size of multivector to fix chunk in storage

* Update lib/common/common/src/validation.rs

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2024-06-17 17:14:18 +02:00
Andrey Vasnetsov
3e4c6dc0d3 Fix inplace updates for sparse index (#4375)
* include old vector into update function and clean posting lists accordingly

* add integration test

* fix counter

* also remove old vector if the insertion is empty

* clippy

* borrow once

* fix max_next_weight correcton on delete + test

* vector index responsible for updating vector storage

* review fixes

* add debug assert
2024-06-12 12:13:49 +02:00
Arnaud Gourlay
c53a5470a9 Fix multivector simple storage metadata (#4424)
* Fix multivector simple storage metadata

* code review naming
2024-06-10 18:13:13 +02:00
Luis Cossío
9ec1266dca universal-query: convert CollectionQueryRequest into ShardQueryRequest (resolve ids into vectors) (#4360)
- make `VectorQuery` generic
- retrieve ids from `CollectionQueryRequest` and convert into vectors
- implement `RetrieveRequest` trait for it
- calculate avg vector with logic from `recommendations.rs`
- convert `CollectionQueryRequest` into `ShardQueryRequest`
- begin implementing `query()` fn in collection
2024-06-07 12:58:47 -04:00
Arnaud Gourlay
4db2b7a0de Add get optional vector for all storages (#4368)
* Add get optional vector for dense simple storage

* more bound checks

* remove storage get_opt blanket implementation

* remove duplication

* remove duplication

* Update lib/segment/src/vector_storage/multi_dense/simple_multi_dense_vector_storage.rs

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2024-06-06 18:07:06 +02:00