Skip to content

Native serialization for Vamana index#285

Merged
razdoburdin merged 9 commits intointel:dev/razdoburdin_streamingfrom
razdoburdin:streaming/vamana
Mar 13, 2026
Merged

Native serialization for Vamana index#285
razdoburdin merged 9 commits intointel:dev/razdoburdin_streamingfrom
razdoburdin:streaming/vamana

Conversation

@razdoburdin
Copy link
Contributor

This PR introduce native serialization for Vamana index.

Main changes are:

  1. New overload of svs::index::vamana::auto_assemble required for direct deserialization accepts lazy loaders and call them in a flexible order to cover legacy serilized models.
  2. save_table method is renamed to metadata to avoid confusions, as far as it doesn't save anything.
  3. Some minor refactoring to streamline the logic.
  4. Serialization for MutableVamana is also implemented to avoid compilation errors. Deserialization and related tests for MutableVamana are expected later.

@razdoburdin razdoburdin requested review from rfsaliev and removed request for ahuber21, ibhati, mihaic and yuejiaointel March 11, 2026 09:37
@razdoburdin razdoburdin marked this pull request as draft March 11, 2026 09:37
@razdoburdin razdoburdin marked this pull request as ready for review March 11, 2026 13:38
@razdoburdin
Copy link
Contributor Author

CI failure isn't related to the PR's content.
image

Copy link
Member

@rfsaliev rfsaliev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments/questions


lib::begin_serialization(os);
// Config
lib::save_to_stream(parameters.save(), os);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to rename VamanaIndexParameters::save() to metadata() as well?
Or implement the infrastructure code for save_to_stream() similar to save_to_disk() then call just
lib::save_to_stream(parameters, os)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +974 to +992
if constexpr (requires {
T::load(
std::declval<const ContextFreeLoadTable&>(),
std::declval<Args&&>()...
);
}) {
// Object is loadable from it's toml::table
return lib::load(
loader, detail::read_metadata(deserializer, stream), SVS_FWD(args)...
);
} else {
return lib::load(
loader,
detail::read_metadata(deserializer, stream),
deserializer,
stream,
SVS_FWD(args)...
);
}
Copy link
Member

@rfsaliev rfsaliev Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got some doubts how this condition looks like.
Doesn't it make sense to define 2 specializations of load_from_stream using newly defined concept ContextFreeLoadable which requires T::load(...?
...
I would also look for possibility of modifying/extending LoadContext infrastructure and related classes to store the {deserializer, stream} information in a context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created 2 specializations for load_from_stream

The existing infrastructure for LoadContext/SaveContext doesn't take the data order into account. Organizing of the input/output stream is made by DirectoryArchiver. But for native streaming we want to avoid (or at least minimize) creating of temporary buffers, that means that we have to control the read/write order. This is the reason I have chosen not to reuse this logic in native streaming.

@razdoburdin razdoburdin requested a review from rfsaliev March 13, 2026 14:04
@razdoburdin razdoburdin merged commit 620ac9f into intel:dev/razdoburdin_streaming Mar 13, 2026
16 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants