Skip to content
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

Remove static checks for serialization size #1997

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions cpp/include/raft/neighbors/detail/cagra/cagra_serialize.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@ namespace raft::neighbors::cagra::detail {

constexpr int serialization_version = 3;

// NB: we wrap this check in a struct, so that the updated RealSize is easy to see in the error
// message.
template <size_t RealSize, size_t ExpectedSize>
struct check_index_layout {
static_assert(RealSize == ExpectedSize,
"The size of the index struct has changed since the last update; "
"paste in the new size and consider updating the serialization logic");
};

constexpr size_t expected_size = 200;
template struct check_index_layout<sizeof(index<double, std::uint64_t>), expected_size>;

/**
* Save the index to file.
*
Expand Down
13 changes: 1 addition & 12 deletions cpp/include/raft/neighbors/detail/ivf_flat_serialize.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,13 @@

namespace raft::neighbors::ivf_flat::detail {

// Serialization version 3
// Serialization version
// No backward compatibility yet; that is, can't add additional fields without breaking
// backward compatibility.
// TODO(hcho3) Implement next-gen serializer for IVF that allows for expansion in a backward
// compatible fashion.
constexpr int serialization_version = 4;

// NB: we wrap this check in a struct, so that the updated RealSize is easy to see in the error
// message.
template <size_t RealSize, size_t ExpectedSize>
struct check_index_layout {
static_assert(RealSize == ExpectedSize,
"The size of the index struct has changed since the last update; "
"paste in the new size and consider updating the serialization logic");
};

template struct check_index_layout<sizeof(index<double, std::uint64_t>), 328>;

/**
* Save the index to file.
*
Expand Down
12 changes: 0 additions & 12 deletions cpp/include/raft/neighbors/detail/ivf_pq_serialize.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ namespace raft::neighbors::ivf_pq::detail {
// compatible fashion.
constexpr int kSerializationVersion = 3;

// NB: we wrap this check in a struct, so that the updated RealSize is easy to see in the error
// message.
template <size_t RealSize, size_t ExpectedSize>
struct check_index_layout {
static_assert(RealSize == ExpectedSize,
"The size of the index struct has changed since the last update; "
"paste in the new size and consider updating the serialization logic");
};

// TODO: Recompute this and come back to it.
template struct check_index_layout<sizeof(index<std::uint64_t>), 480>;

/**
* Write the index to an output stream
*
Expand Down