Skip to content

Commit

Permalink
Remove static checks for index size.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice committed Nov 15, 2023
1 parent 54f55b7 commit 9a65de2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 38 deletions.
14 changes: 1 addition & 13 deletions cpp/include/raft/neighbors/detail/cagra/cagra_serialize.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,7 @@

namespace raft::neighbors::cagra::detail {

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");
};

constexpr size_t expected_size = 216;
template struct check_index_layout<sizeof(index<double, std::uint64_t>), expected_size>;
constexpr int serialization_version = 3;

/**
* 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 @@ -34,18 +34,7 @@ namespace raft::neighbors::ivf_flat::detail {
// backward compatibility.
// TODO(hcho3) Implement next-gen serializer for IVF that allows for expansion in a backward
// compatible fashion.
constexpr int serialization_version = 5;

// 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>), 368>;
constexpr int serialization_version = 4;

/**
* Save the index to file.
Expand Down
14 changes: 1 addition & 13 deletions cpp/include/raft/neighbors/detail/ivf_pq_serialize.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,7 @@ namespace raft::neighbors::ivf_pq::detail {
// backward compatibility.
// TODO(hcho3) Implement next-gen serializer for IVF that allows for expansion in a backward
// compatible fashion.
constexpr int kSerializationVersion = 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");
};

// TODO: Recompute this and come back to it.
template struct check_index_layout<sizeof(index<std::uint64_t>), 536>;
constexpr int kSerializationVersion = 3;

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

0 comments on commit 9a65de2

Please sign in to comment.