Repository navigation
Remove AsyncRawScorer - #8685
Conversation
…eryScorer::score_stored_batch`
...into `ImmutableDenseVectors`/`ChunkedVectors`
…h_in_batch_async` Enable io_uring-specialized scoring on Linux
…tch_async` Enable io_uring-specialized scoring on Linux
...to use `ImmutableDenseVectors::for_each_in_batch` instead of `read_vectors_async`
| })) | ||
| } | ||
|
|
||
| fn type_id() -> any::TypeId; |
There was a problem hiding this comment.
I had to add a simple runtime-detection of storage-type...
There was a problem hiding this comment.
I'd rather use enum instead of any::TypeId.
fn kind() -> UniversalKind;enum UniversalKind {
Mmap,
#[cfg(…)]
IoUring,
S3,
}Or even this if we want to call some specialized method:
fn downcast(&self) -> UniversalImplRef<'_>;enum UniversalImplRef<'a> {
Mmap(&'a UniversalMmapFile),
...
}There was a problem hiding this comment.
Yeah, I guess UniversalKind would be better. I initially wanted to do this check directly in for_each_in_batch, but that requires 'static, so I went with this without reconsidering.
I'll fix this before merging.
| #[cfg(target_os = "linux")] | ||
| if S::type_id() == std::any::TypeId::of::<common::universal_io::IoUringFile>() { | ||
| return self.for_each_in_batch_async(keys, f); | ||
| } |
There was a problem hiding this comment.
...so that I can select a "specialized" implementation here.
But with other changes in this PR, hot-path is moved right after this check, so performance impact is non-existent.
My idea, is once all scorers are refactored, we can move this micro-batching inside MmapFile::read_batch, and then we can get rid of runtime check.
But currently, pretty much every scorer is using this micro-batching on the level "above" read_batch call, so adding another layer of micro-batching in read_batch would degrade mmap perf, and refactoring every scorer at once to remove micro-batching would be too extensive. 🙄
| #[cfg(target_os = "linux")] | ||
| if S::type_id() == std::any::TypeId::of::<common::universal_io::IoUringFile>() { | ||
| return self.for_each_in_batch_async(keys, f); | ||
| } |
This comment was marked as resolved.
This comment was marked as resolved.
…ueries Change to `UniversalRead::kind` that returns `UniversalKind` enum
…h_in_batch_async` Use `UniversalRead::kind` instead of `type_id`
…tch_async` Use `UniversalRead::kind` instead of `type_id`
* Merge `scorer_mmap` and `vector_search` benchmarks * Move micro-batching logic from `RawScorerImpl::score_points` into `QueryScorer::score_stored_batch` * Propagate micro-batching logic from dense scorers... ...into `ImmutableDenseVectors`/`ChunkedVectors` * Implement io_uring-specialized `ImmutableDenseVectors::for_each_in_batch_async` * Implement io_uring-specialized `ChunkedVectors::for_each_in_batch_async` * Add `UniversalRead::type_id` method for runtime storage-type queries * fixup! Implement io_uring-specialized `ImmutableDenseVectors::for_each_in_batch_async` Enable io_uring-specialized scoring on Linux * fixup! Implement io_uring-specialized `ChunkedVectors::for_each_in_batch_async` Enable io_uring-specialized scoring on Linux * Refactor `DenseVectorStorageImpl::read_vectors`... ...to use `ImmutableDenseVectors::for_each_in_batch` instead of `read_vectors_async` * Remove `AsyncRawScorer` * fixup! Propagate micro-batching logic from dense scorers... Fix bugs * fixup! Propagate micro-batching logic from dense scorers... * fixup! Merge `scorer_mmap` and `vector_search` benchmarks Fix clippy 🙄 * fixup! Add `UniversalRead::type_id` method for runtime storage-type queries Change to `UniversalRead::kind` that returns `UniversalKind` enum * fixup! Implement io_uring-specialized `ImmutableDenseVectors::for_each_in_batch_async` Use `UniversalRead::kind` instead of `type_id` * fixup! Implement io_uring-specialized `ChunkedVectors::for_each_in_batch_async` Use `UniversalRead::kind` instead of `type_id` * review: rename point_id -> point_offset to match the type [skip-ci] --------- Co-authored-by: generall <[email protected]>
This PR refactors
ImmutableDenseVectorsandDenseVectorStorageImpl, so that defaultRawScorerImplcorrectly uses io_uring, and we can get rid ofAsyncRawScorerImpl.I've tested all changes against
scorer_mmap/vector_searchbenchmark, no noticeable impact on performance as far as I can tell.All Submissions:
devbranch. Did you create your branch fromdev?New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --workspace --all-featurescommand?Changes to Core Features: