Skip to content
Merged
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
6 changes: 5 additions & 1 deletion cpp/src/neighbors/detail/cagra/compute_distance_vpq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ struct vpq_descriptor_spec : public instance_spec<DataT, IndexT, DistanceT> {
if (dataset.pq_bits() != PqBits) { return -1.0; }
if (dataset.pq_len() != PqLen) { return -1.0; }
// Otherwise, favor the closest dataset dimensionality.
return 1.0 / (0.1 + std::abs(double(dataset.dim()) - double(DatasetBlockDim)));
constexpr std::uint32_t preferred_load_elmes_per_thread =
16; /*magic number that is good based on experiments.*/
return 1.0 / (0.1 + std::abs(double(dataset.dim()) - double(DatasetBlockDim))) * TeamSize +
1.0 / (0.1 + std::abs(double(dataset.dim()) / TeamSize / PqLen -
preferred_load_elmes_per_thread));
}

private:
Expand Down