-
Notifications
You must be signed in to change notification settings - Fork 35
Make index blocksize flexible #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hi!
Instead I would propose to setup block size in a
|
rfsaliev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also read my standalone comment to the PR as well.
|
Thanks for comments. I have modified the PR, according to your request:
|
rfsaliev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGFM
just few comments/suggestions
|
@razdoburdin could you give an example how this is used in a comment or the PR description? |
I have updated the PR description |
|
@razdoburdin it makes sense, the missing symbol is svs::runtime::v0::DynamicVamanaIndex::build(svs::runtime::v0::DynamicVamanaIndex**, unsigned long, svs::runtime::v0::MetricType, svs::runtime::v0::StorageKind, svs::runtime::v0::VamanaIndex::BuildParams const&, svs::runtime::v0::VamanaIndex::SearchParams const&)This is the function you modified and added a new parameter. It has a default value, but I guess for ABI compatibility it is required to do this instead static Status build(
DynamicVamanaIndex** index,
size_t dim,
MetricType metric,
StorageKind storage_kind,
const VamanaIndex::BuildParams& params = {},
const VamanaIndex::SearchParams& default_search_params = {},
const VamanaIndex::DynamicIndexParams& dynamic_index_params = {}
) noexcept;
static Status build(
DynamicVamanaIndex** index,
size_t dim,
MetricType metric,
StorageKind storage_kind,
const VamanaIndex::BuildParams& params = {},
const VamanaIndex::SearchParams& default_search_params = {}
) noexcept {
build(index, dim, metric, storage_kind, params, default_search_params, {});
} |
but the code with this overload wouldn't compile :( |
|
Right, we'd have to remove the default arguments and replicate the original ABI. |
As a workaround, for ABI compatibility I would declare: static Status build(
DynamicVamanaIndex** index,
size_t dim,
MetricType metric,
StorageKind storage_kind,
const VamanaIndex::BuildParams& params = {},
const VamanaIndex::SearchParams& default_search_params = {}
) noexcept;
static Status build(
DynamicVamanaIndex** index,
size_t dim,
MetricType metric,
StorageKind storage_kind,
const VamanaIndex::BuildParams& params,
const VamanaIndex::SearchParams& default_search_params,
const VamanaIndex::DynamicIndexParams& dynamic_index_params
) noexcept;The first declaration is for ABI compatibility. Implementation code should look like: // ABI backward compatibility
static Status build(
DynamicVamanaIndex** index,
size_t dim,
MetricType metric,
StorageKind storage_kind,
const VamanaIndex::BuildParams& params,
const VamanaIndex::SearchParams& default_search_params
) noexcept {
build(index, dim, metric, storage_kind, params, default_search_params, VamanaIndex::DynamicIndexParams{});
}
// Real implementation with new parameter
static Status build(
DynamicVamanaIndex** index,
size_t dim,
MetricType metric,
StorageKind storage_kind,
const VamanaIndex::BuildParams& params,
const VamanaIndex::SearchParams& default_search_params,
const VamanaIndex::DynamicIndexParams& dynamic_index_params
) noexcept {
// Full implementation
}
|
rfsaliev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGFM
ahuber21
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Follow-up request: Could you please experiment with rss_increase in runtime_test.cpp? The function rss_threshold() accepts a parameter allocator_block_size. Could you add new test cases where you have a small blocksize value and see if the tests still pass? And then please add them in a new PR.
This PR adds ability to set custom index blocksize
Reopening of #235
The new parameter structure for build method of
DynamicVamanaIndexandDynamicVamanaIndexLeanVecis introduced.Example of building a LeanVec index with block_size = 2^12