65 Commits

Author SHA1 Message Date
xzfc
a1a005c7d5 rustdoc: syntax/path fixes 2026-04-07 21:13:58 +00:00
qdrant-cloud-bot
45b551a72c build(deps): sync Cargo.toml version floors with Cargo.lock (#8495)
Bump minimum version requirements to match what Cargo.lock already
resolved to. No functional change — these versions were already being
used at build time.

- ahash: 0.8.11 -> 0.8.12
- charabia: 0.9.7 -> 0.9.9
- chrono: 0.4.43 -> 0.4.44
- config: 0.15.13 -> 0.15.22
- crc: 3.3.0 -> 3.4.0
- fs-err: 3.2.2 -> 3.3.0
- futures-util: 0.3.31 -> 0.3.32
- num_threads: 0.1.6 -> 0.1.7
- quickcheck: 1.0.3 -> 1.1.0
- regex: 1.11.3 -> 1.12.3
- rustls: 0.23.35 -> 0.23.37
- rustls-pki-types: 1.12.0 -> 1.14.0
- slog: 2.7.0 -> 2.8.2
- tokio: 1.49.0 -> 1.50.0
- tower: 0.5.2 -> 0.5.3

Made-with: Cursor

Co-authored-by: Cursor Agent <agent@cursor.com>
2026-03-24 09:24:31 +01:00
Luis Cossío
5403ea68ab Chunked vectors with UniversalWrite storage (#8233)
* use CowMultiVector as return type from storages

* add advice to OpenOptions

* Implement ChunkedVectors with generic storage

* rename ChunkedVectors->VolatileChunkedVectors and ChunkedMmapVectors-> ChunkedVectors

* propagate everywhere

fix tests

* [auto] rename BytesRange -> ElementsRange

* [auto] rename BytesOffset -> ElementOffset

* coderabbit nits

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2026-02-27 12:47:15 -03:00
dependabot[bot]
18a7587d4b build(deps): bump rand_distr from 0.5.1 to 0.6.0 (#8148)
* build(deps): bump rand_distr from 0.5.1 to 0.6.0

Bumps [rand_distr](https://github.com/rust-random/rand_distr) from 0.5.1 to 0.6.0.
- [Release notes](https://github.com/rust-random/rand_distr/releases)
- [Changelog](https://github.com/rust-random/rand_distr/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand_distr/compare/0.5.1...0.6.0)

---
updated-dependencies:
- dependency-name: rand_distr
  dependency-version: 0.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Migrate main code base to rand 0.10

* Migrate tests

* Migrate benches

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: timvisee <tim@visee.me>
2026-02-25 14:15:04 +01:00
xzfc
4cabb7fd8e Merge io and memory into common (#8155)
* Unify parking_lot/arc_lock feature

* Move lib/common/{io,memory}/* -> lib/common/common/*

- Mmap-related items are grouped into `common::mmap` sub-module:
  - `memory/src/chunked_utils.rs`      -> `common/src/mmap/chunked.rs`
  - `memory/src/madvise.rs`            -> `common/src/mmap/advice.rs`
  - `memory/src/mmap_ops.rs`           -> `common/src/mmap/ops.rs`
  - `memory/src/mmap_type_readonly.rs` -> `common/src/mmap/mmap_readonly.rs`
  - `memory/src/mmap_type.rs`          -> `common/src/mmap/mmap_rw.rs`
- Filesystem-related items are grouped into `common::fs` sub-module:
  - `common/src/fs.rs`          -> `common/src/fs/sync.rs`
  - `io/src/file_operations.rs` -> `common/src/fs/ops.rs`
  - `io/src/move_files.rs`      -> `common/src/fs/move.rs`
  - `io/src/safe_delete.rs`     -> `common/src/fs/safe_delete.rs`
  - `memory/src/checkfs.rs`     -> `common/src/fs/check.rs`
  - `memory/src/fadvise.rs`     -> `common/src/fs/fadvise.rs`
- Rest is moved straight into `common`:
  - `io/src/storage_version.rs` -> `common/src/storage_version.rs`

The old `io` and `memory` are now hollow crates that re-export items
from `common`. These hollow crates will be removed in next commits.

* Replace uses of `io` and `memory` with new paths in `common`

Since `io` and `memory` are just re-exports of `common`, these
replacements are no-op.

* Remove `io` and `memory` crates
2026-02-17 10:58:59 +01:00
xzfc
6bced54ca1 Chore: promote dependencies to workspace level (#8061)
* Promote `env_logger` to workspace dependency

* Promote `anyhow` to workspace dependency

* Promote `rmp-serde` to workspace dependency

* Promote `tinyvec` to workspace dependency

* Promote `async-trait` to workspace dependency

* Promote `url` to workspace dependency

* Promote `self_cell` to workspace dependency

* Promote `cc` to workspace dependency

* Promote `bitpacking` to workspace dependency
2026-02-05 16:02:28 +01:00
Ivan Boldyrev
984a9e8bd1 Fix gridstore Option unsoundness (#8011)
* Implement `Optional<T>` type

Define a type with the same presumed layout as `Option<T>`, but with defined behavior.

* Make `transmute_*` functions unsafe

The functions `memory::mmap_ops::transmute_*` are inherently unsafe, but
are not marked as are.  Their usage is documented, but it is not always clear
if the code is correct.

* Add `CsrHeader` to resolve another unsoundness

Tuples have no defined layout.
2026-02-03 17:57:09 +07:00
Ivan Pleshkov
ec3ef1cb67 Use p square to find ranges (#7733)
* use p square to find ranges

* use sample size

* add stopper checks

* review remarks

* review remarks
2026-01-14 08:51:08 +01:00
Ivan Pleshkov
c14f83eff9 use enum for SQ query and meta (#7669)
fix CI

review remarks

review remarks

review remarks

review remarks

simplify encoding of internal vector

fix ci

fix ci

review remarks

review remarks
2025-12-17 22:35:14 +01:00
Tim Visée
64690cda53 Hotfix for Windows ARM64 builds, disable some Neon features (#7690)
* On Windows ARM64 builds, disable usage of neon

* Also disable optimized popcount on Windows ARM64

* fix quantization build

* revert changes in BQ

---------

Co-authored-by: Ivan Pleshkov <pleshkov.ivan@gmail.com>
2025-12-05 10:56:48 +01:00
Luis Cossío
d79cd9b99b activate fs-err features for nicer error messages (#7665)
* activate fs-err features for nicer error messages

* use in entire workspace
2025-12-02 10:40:36 -03:00
Luis Cossío
366ab07ba2 fix typo Uint8 -> Int8 (#7666) 2025-12-02 09:54:34 +03:00
Ivan Pleshkov
8df3dda006 Scalar quantization encoding parameter (#7602)
* scalar quantization encoding parameter

fix ci

remove method

review remarks

fix ci

* uint8 - int8
2025-12-01 12:03:36 +01:00
Luis Cossío
0c61bffb70 homogenize bench for aarch64 too (#7628) 2025-11-27 11:34:38 -03:00
Ivan Pleshkov
a2be9e7fff refactor sq score_bytes (#7613) 2025-11-27 10:49:33 +01:00
Ivan Pleshkov
c737d9d087 P-Square one pass quantile estimation method (#7520)
* p square one pass method

* are you happy fmt

* fix n=9 case

* marker struct

* refactor

* proper tests

* add bench

* better namings

* are you happy clippy

* are you happy clippy

* fix additional markers order

* use ArrayVec instead of SmallVec

* use orderer float to sort f64

* Update lib/quantization/src/p_square.rs

Co-authored-by: xzfc <5121426+xzfc@users.noreply.github.com>

* Update lib/quantization/src/p_square.rs

Co-authored-by: xzfc <5121426+xzfc@users.noreply.github.com>

* mispelling

* review remarks

* fix typo

* change float checks order

---------

Co-authored-by: xzfc <5121426+xzfc@users.noreply.github.com>
2025-11-21 20:21:32 +03:00
Ivan Pleshkov
793b261016 avx512 for binary quantization (#7052)
* avx512 for binary quantization

fix build

* change checks order
2025-10-29 13:26:55 +01:00
xzfc
a0d62330c7 Use fs-err (#7319) 2025-09-29 12:47:10 +00:00
Arnaud Gourlay
360d7bc26d Clippy 1.90 (#7253)
* Fix Clippy 1.90

* fmt
2025-09-15 20:12:11 +02:00
Ivan Pleshkov
2d1b92c16b Create and load for an appendable quantization (#7193)
* Create and load for an appendable quantization

remove feature flag

more todo

review remarks

review remarks

* fix after rebase

* Rename is_appendable to supports_appendable

---------

Co-authored-by: timvisee <tim@visee.me>
2025-09-01 15:49:09 +02:00
Ivan Pleshkov
b03853c33e Quantization storage builder for chunked mmap (#7174)
* Quantization storage builder for chunked mmap

* fix after rebase

* Update lib/segment/src/vector_storage/quantized/quantized_chunked_mmap_storage.rs

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-08-29 16:10:30 +02:00
Ivan Pleshkov
879da486af Remove quantization load from trait (#7113)
* remove quantization load

* refactor load

* fix fmt error

* fix clippy
2025-08-22 14:37:32 +02:00
Ivan Pleshkov
f3b61bbf4a Retrieve files list from quantization storage (#7095)
* Get files list from quantization

* fix ci
2025-08-20 14:15:09 +02:00
Ivan Pleshkov
3f75fae516 EncodedStorage upsert vector (#7048)
* EncodedStorage upsert vector
2025-08-18 17:39:23 +02:00
xzfc
acfdf02da8 Optional scorer methods via TBool (#6989)
* Add common::typelevel module

* Use common::typelevel for score_bytes

* Revert "Split FilteredScorer into FilteredScorer and FilteredQuantizedScorer"

This reverts commit ff3a93ee95.

* FilteredQuantizedScorer

* Extract `struct Filters` from `FilteredScorer` and `FilteredQuantizedScorer`

* Revert "QuantizedVectors::query_scorer_bytes"

This reverts commit 9dee824afd.

* Partial revert "Add QueryScorerBytes::score_bytes"

This reverts commit d80af4f698, but keeps
the QueryScorerBytes trait while removing implementations.

* Partial revert "Add EncodedVectorsBytes::score_point_vs_bytes"

This partially reverts commit c741e42f9a.
- trait `EncodedVectorsBytes` and its implementations: reverted/removed
- calls to `EncodedVectorsBytes::score_point_vs_bytes`: replaced with
  calls to `EncodedVectors::score_bytes`

* Remove unused method FilteredScorer::new_from_raw
2025-08-18 14:40:12 +00:00
Ivan Pleshkov
8961eeaf0a Remove quantization save functions (#7043)
* remove quantization save

* revert convert_binary_encoding fn

* review remarks

* review remark

* review remarks
2025-08-18 13:55:07 +02:00
Ivan Pleshkov
0d1b0ead53 Use PointOffsetType in quantization (#7058)
* Use PointOffsetType in quantization

* review remarks

* review remarks
2025-08-14 16:16:08 +02:00
Ivan Pleshkov
7eb562e891 Quantization flusher (#7046)
* quantization flusher

* review remarks
2025-08-13 12:57:16 +02:00
Ivan Pleshkov
1616806b8f BQ features without vector stats (#7009)
* bq all features without vector stats

* fix tests

* review suggestions

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-08-12 14:58:43 +02:00
Ivan Pleshkov
a3e457d387 Wrap quantization Vec<u8> in a separate structure (#7013)
* separate struct for vec u8 quantization storage

* cgf testing for test storage
2025-08-12 13:20:48 +02:00
xzfc
079ef6fb13 Implement GraphLinksFormat::CompressedWithVectors (#6982)
* Simplify graph_links tests

* Rstest-ify hnsw_index::tests::test_save_load

* Rename EncodedVectorsU8::{get_quantized_vector => get_quantized_vector_offset_and_code}

Reason: it was inconsistent with other implementations of
get_quantized_vector().

* Add QuantizedVectors::{get_quantized_vectors, get_quantized_vector_layout}

* Rename `links_map` to `for_each_link`

* pack_links: expose the updated `raw_links` order

* TestRawScorerProducer: support quantization

* Make GraphLinksSerializer::new return Result

* Rename links/compressed_links into `neighbors`

* Implement GraphLinksFormat::CompressedWithVectors

* GraphLayersWithVectors

* bitpacking: add packed_links_size

* Reorder neighbors: N__VVVVVVVcccccccccc -> Ncccccccccc__VVVVVVV
2025-08-11 17:28:43 +00:00
Tim Visée
1bba3891ec Fix clippy warnings for Rust 1.89 (#6997) 2025-08-07 14:34:52 +02:00
Ivan Pleshkov
766b527ac8 Appendable quantization storage (#6935)
* appendable qunatization storage

fmt

deprecate count in quantization config

fix arm tests build

qunatized storage vectors count

fix ci

are you happy clippy

fix compat tests

undo rename to `deprecated_count`

remove flusher

remove obsolete functions, don't use hardware counter in ram storage

are you happy clippy

fix gpu build

check ci when revert option

revert last commit

* debug ci

* log offsets

* log offsets

* fix compatibility tests

* deprecate count

* fix arm tests

* fix benches

* Update lib/quantization/src/encoded_vectors_binary.rs

Co-authored-by: xzfc <5121426+xzfc@users.noreply.github.com>

---------

Co-authored-by: xzfc <5121426+xzfc@users.noreply.github.com>
2025-08-06 13:51:01 +02:00
xzfc
83005cd2db QueryScorerBytes (#6945)
* Add EncodedVectorsBytes::score_point_vs_bytes

* Add QueryScorerBytes::score_bytes

* QuantizedVectors::query_scorer_bytes

* Split FilteredScorer into FilteredScorer and FilteredQuantizedScorer
2025-07-31 03:05:10 +00:00
Ivan Pleshkov
6521b0df7d bq scalar query benches (#6831)
* bq scalar query benches

* review remarks
2025-07-14 19:28:07 +02:00
Ivan Pleshkov
bac28164ed use vector statistics for scalar bq query (#6835)
* use vector statistics for scalar bq query

* fix minor error

* remove test_binary_scalar_internal test

* do NOT use special file for storing vector stats

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-07-11 10:15:28 +02:00
Arnaud Gourlay
b606c1be8c Fix HW vector io for scalar quantization (#6848) 2025-07-11 07:56:20 +02:00
Ivan Pleshkov
a38fd0a1e5 simplify 2bit encoding method (#6824) 2025-07-08 12:19:04 +02:00
Ivan Pleshkov
b414a402bb Merge pull request #6728
* # This is a combination of 7 commits.

* SameAsStorage default value

* fix coderabbit warnings

* neon for u8 bq

* sse for u8 bq

* fix windows build

* rename function

* add comments

* fmt

* fix arm build

* review remarks
2025-07-03 14:09:12 +02:00
Ivan Pleshkov
5895877577 Fix sq internal vector encoding (#6763)
* Fix SQ internal vector encoding

* add test

* clippy warning
2025-06-26 15:08:50 +02:00
Ivan Pleshkov
de54049e55 Don't encode quantization query while hnsw build (#6729)
* dont encode quantization query while hnsw build

* add comments

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-06-23 10:34:00 +02:00
Ivan Pleshkov
fe5becdadd Merge pull request #6663
* bq encodings

* are you happy clippy

* are you happy clippy

* are you happy clippy

* are you happy clippy

* gpu tests

* update models

* are you happy fmt

* move additional bits to the end

* fix tests

* Welford's Algorithm

* review remarks

* are you happy clippy

* remove debug println in test

* coderabit nitpicks

* remove unnecessary clone and partialeq

* Use f64 for Welford's Algorithm

* try fix ci

* revert cargo-nextest

* add debug assertions
2025-06-19 18:21:00 +02:00
xzfc
6717d38cc4 Replace some generic parameters with associated types (#6711)
* Make EncodedVectors::EncodedQuery associated type

* Make EncodedStorageBuilder::Storage associated type

* Make QueryScorer::TVector associated type

* Remove TVector from RawScorerImpl generic parameters
2025-06-17 07:32:22 +00:00
Arnaud Gourlay
1fb02a693c Fix vector_io_read for multivector recommendation (#6622)
* Fix vector_io_read for multivector recommendation

* fix

* cleanup

* single disposable

* do not use disposable hardware counter for quantized multivectors
2025-06-05 19:32:57 +02:00
Arnaud Gourlay
1e3017b304 Clippy 1.87 autofix (#6516)
* Clippy 1.87 autofix

* fmt
2025-05-12 15:51:34 +02:00
xzfc
9fedc65bc4 Clear disk cache after read (#6396)
* Move clear_disk_cache to memory::fadvise

* Add memory::fadvise::OneshotFile

* Use OneshotFile
2025-04-17 10:57:47 +02:00
Andrey Vasnetsov
0266508736 disk cache hygiene (#6323)
* wip: implement explicit populate and clear_cache functions for all components

* fmt

* implement clear and populate for vector storages

* fmt

* implement clear and populate for payload storage

* wip: implement explicit populate and clear_cache functions payload indexes

* implement explicit populate and clear_cache functions payload indexes

* fix clippy on CI

* only compile posix_fadvise on linux

* only compile posix_fadvise on linux

* implement explicit populate and clear_cache functions for quantized vectors

* fmt

* remove post-load prefault

* fix typo

* implement is-on-disk for payload indexes, implement clear on drop for segment, implement clear after segment build

* fmt

* also evict quantized vectors after optimization

* re-use and replace advise_dontneed
2025-04-09 10:54:30 +02:00
Arnaud Gourlay
33d062a3a7 Minor cleanups (#6291) 2025-04-01 13:01:10 +02:00
Andrey Vasnetsov
82af7aa481 vector-io-read measurement on query (#6197)
* remove mut getters from HardwareCounterCell, as mutability is not useful

* introduce vector-io multiplier

* remove RealCpuMeasurement structure

* set vector-io reads multipliers

* account vector reads in dense scorers

* fmt

* fix tests

* propagate hw_counter into posting list iterator

* fmt

* fix test

* wip: measure of sparse iterator

* fmt

* optimize skip_to

* minor refactoring

* keep current PointOffset in iterator to prevent unnecessary reads from memory

* adjust sparse search cpu cost - account for datatype

* fix test

* refactor search_context tests

* move tests into a module

* introduce more tests

* grammar

* review fixes

* fix clippy

* fix clippy again

* change disposable -> new
2025-03-24 13:15:04 +01:00
Jojii
e957d6f44a Cardinality estimation IO measurements (#6117)
* Cardinality estimation measurements

* Apply hw measurements to latest changes from dev

* Clippy

* Also measure cardinality estimation for geo index

* Make measured units 'bytes'

* Use PointOffsetType instead of u32 for size calculation

* fix memory cost for check_values_any in mmap index

* fix double counting for value reading in mmap, remove hw_counter from mmap hashmap

* fmt

* fix hw measurement for text index

* Remove non necessary lifetime annotations

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-03-14 11:05:38 +01:00