From ffa2c561b6e6c02004563e4e0580107914d5ff64 Mon Sep 17 00:00:00 2001 From: Cai Yudong Date: Mon, 18 Nov 2024 15:32:02 +0800 Subject: [PATCH] Update benchmark for RAFT Signed-off-by: Cai Yudong --- benchmark/benchmark_base.h | 10 +- benchmark/hdf5/benchmark_binary.cpp | 6 +- benchmark/hdf5/benchmark_binary_range.cpp | 6 +- benchmark/hdf5/benchmark_float.cpp | 143 ++++++++-- benchmark/hdf5/benchmark_float_bitset.cpp | 17 +- benchmark/hdf5/benchmark_float_qps.cpp | 250 +++++++++++++++--- benchmark/hdf5/benchmark_float_range.cpp | 22 +- .../hdf5/benchmark_float_range_bitset.cpp | 17 +- benchmark/hdf5/benchmark_knowhere.h | 3 +- benchmark/hdf5/ref_logs/Makefile | 29 +- include/knowhere/comp/index_param.h | 10 + 11 files changed, 416 insertions(+), 97 deletions(-) diff --git a/benchmark/benchmark_base.h b/benchmark/benchmark_base.h index 0c0592db1..38a7ceddc 100644 --- a/benchmark/benchmark_base.h +++ b/benchmark/benchmark_base.h @@ -19,10 +19,10 @@ #include #include -#define CALC_TIME_SPAN(X) \ - double t_start = elapsed(); \ - X; \ - double t_diff = elapsed() - t_start; +#define CALC_TIME_SPAN(X) \ + T1_ = elapsed(); \ + X; \ + TDIFF_ = elapsed() - T1_; class Benchmark_base { public: @@ -211,7 +211,7 @@ class Benchmark_base { } protected: - double T0_; + double T0_, T1_, TDIFF_; std::string metric_type_; int32_t dim_; void* xb_ = nullptr; diff --git a/benchmark/hdf5/benchmark_binary.cpp b/benchmark/hdf5/benchmark_binary.cpp index 8ee4ce787..777bdb0fd 100644 --- a/benchmark/hdf5/benchmark_binary.cpp +++ b/benchmark/hdf5/benchmark_binary.cpp @@ -33,7 +33,7 @@ class Benchmark_binary : public Benchmark_knowhere, public ::testing::Test { CALC_TIME_SPAN(auto result = index_.value().Search(ds_ptr, conf, nullptr)); auto ids = result.value()->GetIds(); float recall = CalcRecall(ids, nq, k); - printf(" nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", nq, k, t_diff, recall); + printf(" nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", nq, k, TDIFF_, recall); std::fflush(stdout); } } @@ -58,7 +58,7 @@ class Benchmark_binary : public Benchmark_knowhere, public ::testing::Test { CALC_TIME_SPAN(auto result = index_.value().Search(ds_ptr, conf, nullptr)); auto ids = result.value()->GetIds(); float recall = CalcRecall(ids, nq, k); - printf(" nprobe = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", nprobe, nq, k, t_diff, + printf(" nprobe = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", nprobe, nq, k, TDIFF_, recall); std::fflush(stdout); } @@ -86,7 +86,7 @@ class Benchmark_binary : public Benchmark_knowhere, public ::testing::Test { CALC_TIME_SPAN(auto result = index_.value().Search(ds_ptr, conf, nullptr)); auto ids = result.value()->GetIds(); float recall = CalcRecall(ids, nq, k); - printf(" ef = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", ef, nq, k, t_diff, recall); + printf(" ef = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", ef, nq, k, TDIFF_, recall); std::fflush(stdout); } } diff --git a/benchmark/hdf5/benchmark_binary_range.cpp b/benchmark/hdf5/benchmark_binary_range.cpp index f2c97bce5..f1d3de576 100644 --- a/benchmark/hdf5/benchmark_binary_range.cpp +++ b/benchmark/hdf5/benchmark_binary_range.cpp @@ -36,7 +36,7 @@ class Benchmark_binary_range : public Benchmark_knowhere, public ::testing::Test CheckDistance(metric_type_, ids, distances, lims, nq); float recall = CalcRecall(ids, lims, nq); float accuracy = CalcAccuracy(ids, lims, nq); - printf(" nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f\n", nq, t_diff, recall, accuracy); + printf(" nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f\n", nq, TDIFF_, recall, accuracy); std::fflush(stdout); } printf("================================================================================\n"); @@ -61,7 +61,7 @@ class Benchmark_binary_range : public Benchmark_knowhere, public ::testing::Test auto lims = result.value()->GetLims(); float recall = CalcRecall(ids, lims, nq); float accuracy = CalcAccuracy(ids, lims, nq); - printf(" nprobe = %4d, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f\n", nprobe, nq, t_diff, recall, + printf(" nprobe = %4d, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f\n", nprobe, nq, TDIFF_, recall, accuracy); std::fflush(stdout); } @@ -89,7 +89,7 @@ class Benchmark_binary_range : public Benchmark_knowhere, public ::testing::Test auto lims = result.value()->GetLims(); float recall = CalcRecall(ids, lims, nq); float accuracy = CalcAccuracy(ids, lims, nq); - printf(" ef = %4d, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f\n", ef, nq, t_diff, recall, + printf(" ef = %4d, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f\n", ef, nq, TDIFF_, recall, accuracy); std::fflush(stdout); } diff --git a/benchmark/hdf5/benchmark_float.cpp b/benchmark/hdf5/benchmark_float.cpp index 52e2690c2..c40b6a096 100644 --- a/benchmark/hdf5/benchmark_float.cpp +++ b/benchmark/hdf5/benchmark_float.cpp @@ -36,7 +36,7 @@ class Benchmark_float : public Benchmark_knowhere, public ::testing::Test { CALC_TIME_SPAN(auto result = index_.value().Search(query, conf, nullptr)); auto ids = result.value()->GetIds(); float recall = CalcRecall(ids, nq, k); - printf(" nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", nq, k, t_diff, recall); + printf(" nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", nq, k, TDIFF_, recall); std::fflush(stdout); } } @@ -63,7 +63,7 @@ class Benchmark_float : public Benchmark_knowhere, public ::testing::Test { CALC_TIME_SPAN(auto result = index_.value().Search(query, conf, nullptr)); auto ids = result.value()->GetIds(); float recall = CalcRecall(ids, nq, k); - printf(" nprobe = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", nprobe, nq, k, t_diff, + printf(" nprobe = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", nprobe, nq, k, TDIFF_, recall); std::fflush(stdout); } @@ -93,7 +93,7 @@ class Benchmark_float : public Benchmark_knowhere, public ::testing::Test { CALC_TIME_SPAN(auto result = index_.value().Search(query, conf, nullptr)); auto ids = result.value()->GetIds(); float recall = CalcRecall(ids, nq, k); - printf(" ef = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", ef, nq, k, t_diff, recall); + printf(" ef = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", ef, nq, k, TDIFF_, recall); std::fflush(stdout); } } @@ -121,7 +121,36 @@ class Benchmark_float : public Benchmark_knowhere, public ::testing::Test { auto ids = result.value()->GetIds(); float recall = CalcRecall(ids, nq, k); printf(" search_list_size = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", - search_list_size, nq, k, t_diff, recall); + search_list_size, nq, k, TDIFF_, recall); + std::fflush(stdout); + } + } + } + printf("================================================================================\n"); + printf("[%.3f s] Test '%s/%s' done\n\n", get_time_diff(), ann_test_name_.c_str(), index_type_.c_str()); + } +#endif + +#ifdef KNOWHERE_WITH_RAFT + template + void + test_raft_cagra(const knowhere::Json& cfg) { + auto conf = cfg; + + printf("\n[%0.3f s] %s | %s \n", get_time_diff(), ann_test_name_.c_str(), index_type_.c_str()); + printf("================================================================================\n"); + for (auto itopk_size : ITOPK_SIZEs_) { + conf[knowhere::indexparam::ITOPK_SIZE] = itopk_size; + for (auto nq : NQs_) { + auto ds_ptr = knowhere::GenDataSet(nq, dim_, xq_); + auto query = knowhere::ConvertToDataTypeIfNeeded(ds_ptr); + for (auto k : TOPKs_) { + conf[knowhere::meta::TOPK] = k; + CALC_TIME_SPAN(auto result = index_.value().Search(query, conf, nullptr)); + auto ids = result.value()->GetIds(); + float recall = CalcRecall(ids, nq, k); + printf(" itopk_size = %4d, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", itopk_size, nq, k, + TDIFF_, recall); std::fflush(stdout); } } @@ -144,6 +173,10 @@ class Benchmark_float : public Benchmark_knowhere, public ::testing::Test { knowhere::KnowhereConfig::SetBuildThreadPoolSize(default_build_thread_num); knowhere::KnowhereConfig::SetSearchThreadPoolSize(default_search_thread_num); printf("faiss::distance_compute_blas_threshold: %ld\n", knowhere::KnowhereConfig::GetBlasThreshold()); + +#ifdef KNOWHERE_WITH_RAFT + knowhere::KnowhereConfig::SetRaftMemPool(); +#endif } void @@ -170,6 +203,10 @@ class Benchmark_float : public Benchmark_knowhere, public ::testing::Test { // DISKANN index params const std::vector SEARCH_LISTs_ = {100, 200, 400}; + + // RAFT cagra index params + const std::vector GRAPH_DEGREEs_ = {8, 16, 32}; + const std::vector ITOPK_SIZEs_ = {128, 192, 256}; }; TEST_F(Benchmark_float, TEST_IDMAP) { @@ -190,11 +227,7 @@ TEST_F(Benchmark_float, TEST_IDMAP) { } TEST_F(Benchmark_float, TEST_IVF_FLAT) { -#ifdef KNOWHERE_WITH_RAFT - index_type_ = knowhere::IndexEnum::INDEX_RAFT_IVFFLAT; -#else index_type_ = knowhere::IndexEnum::INDEX_FAISS_IVFFLAT; -#endif #define TEST_IVF(T, X) \ index_file_name = get_index_name(X); \ @@ -234,11 +267,7 @@ TEST_F(Benchmark_float, TEST_IVF_SQ8) { } TEST_F(Benchmark_float, TEST_IVF_PQ) { -#ifdef KNOWHERE_WITH_RAFT - index_type_ = knowhere::IndexEnum::INDEX_RAFT_IVFPQ; -#else index_type_ = knowhere::IndexEnum::INDEX_FAISS_IVFPQ; -#endif #define TEST_IVF(T, X) \ index_file_name = get_index_name(X); \ @@ -290,13 +319,13 @@ TEST_F(Benchmark_float, TEST_DISKANN) { knowhere::Json conf = cfg_; - conf["index_prefix"] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); - conf["data_path"] = kRawDataPath; - conf["max_degree"] = 56; - conf["pq_code_budget_gb"] = sizeof(float) * dim_ * nb_ * 0.125 / (1024 * 1024 * 1024); - conf["build_dram_budget_gb"] = 32.0; - conf["search_cache_budget_gb"] = 0; - conf["beamwidth"] = 8; + conf[knowhere::meta::INDEX_PREFIX] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); + conf[knowhere::meta::DATA_PATH] = kRawDataPath; + conf[knowhere::indexparam::MAX_DEGREE] = 56; + conf[knowhere::indexparam::PQ_CODE_BUDGET_GB] = sizeof(float) * dim_ * nb_ * 0.125 / (1024 * 1024 * 1024); + conf[knowhere::indexparam::BUILD_DRAM_BUDGET_GB] = 32.0; + conf[knowhere::indexparam::SEARCH_CACHE_BUDGET_GB] = 0; + conf[knowhere::indexparam::BEAMWIDTH] = 8; fs::create_directory(kDir); fs::create_directory(kL2IndexDir); @@ -320,3 +349,79 @@ TEST_F(Benchmark_float, TEST_DISKANN) { test_diskann(conf); } #endif + +#ifdef KNOWHERE_WITH_RAFT +TEST_F(Benchmark_float, TEST_RAFT_BRUTE_FORCE) { + index_type_ = knowhere::IndexEnum::INDEX_RAFT_BRUTEFORCE; + +#define TEST_RAFT_BF(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_idmap(conf); + + std::string index_file_name; + knowhere::Json conf = cfg_; + std::vector params = {}; + + TEST_RAFT_BF(knowhere::fp32, params); +} + +TEST_F(Benchmark_float, TEST_RAFT_IVF_FLAT) { + index_type_ = knowhere::IndexEnum::INDEX_RAFT_IVFFLAT; + +#define TEST_RAFT_IVF(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_ivf(conf); + + std::string index_file_name; + knowhere::Json conf = cfg_; + for (auto nlist : NLISTs_) { + conf[knowhere::indexparam::NLIST] = nlist; + std::vector params = {nlist}; + + TEST_RAFT_IVF(knowhere::fp32, params); + } +} + +TEST_F(Benchmark_float, TEST_RAFT_IVF_PQ) { + index_type_ = knowhere::IndexEnum::INDEX_RAFT_IVFPQ; + +#define TEST_RAFT_IVF(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_ivf(conf); + + std::string index_file_name; + knowhere::Json conf = cfg_; + conf[knowhere::indexparam::NBITS] = NBITS_; + for (auto m : Ms_) { + conf[knowhere::indexparam::M] = m; + for (auto nlist : NLISTs_) { + conf[knowhere::indexparam::NLIST] = nlist; + std::vector params = {nlist, m}; + + TEST_RAFT_IVF(knowhere::fp32, params); + } + } +} + +TEST_F(Benchmark_float, TEST_RAFT_CAGRA) { + index_type_ = knowhere::IndexEnum::INDEX_RAFT_CAGRA; + +#define TEST_RAFT_CAGRA(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_raft_cagra(conf); + + std::string index_file_name; + knowhere::Json conf = cfg_; + + for (auto graph_degree : GRAPH_DEGREEs_) { + conf[knowhere::indexparam::GRAPH_DEGREE] = graph_degree; + conf[knowhere::indexparam::INTERMEDIATE_GRAPH_DEGREE] = graph_degree; + std::vector params = {graph_degree}; + TEST_RAFT_CAGRA(knowhere::fp32, params); + } +} +#endif diff --git a/benchmark/hdf5/benchmark_float_bitset.cpp b/benchmark/hdf5/benchmark_float_bitset.cpp index 0ab64f2ab..aab8a6731 100644 --- a/benchmark/hdf5/benchmark_float_bitset.cpp +++ b/benchmark/hdf5/benchmark_float_bitset.cpp @@ -50,7 +50,7 @@ class Benchmark_float_bitset : public Benchmark_knowhere, public ::testing::Test CALC_TIME_SPAN(auto result = index_.value().Search(query, conf, bitset)); auto ids = result.value()->GetIds(); float recall = CalcRecall(g_ids, ids, nq, k); - printf(" bitset_per = %3d%%, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", per, nq, k, t_diff, + printf(" bitset_per = %3d%%, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", per, nq, k, TDIFF_, recall); std::fflush(stdout); } @@ -81,7 +81,7 @@ class Benchmark_float_bitset : public Benchmark_knowhere, public ::testing::Test CALC_TIME_SPAN(auto result = index_.value().Search(query, conf, bitset)); auto ids = result.value()->GetIds(); float recall = CalcRecall(g_ids, ids, nq, k); - printf(" bitset_per = %3d%%, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", per, nq, k, t_diff, + printf(" bitset_per = %3d%%, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", per, nq, k, TDIFF_, recall); std::fflush(stdout); } @@ -112,7 +112,7 @@ class Benchmark_float_bitset : public Benchmark_knowhere, public ::testing::Test CALC_TIME_SPAN(auto result = index_.value().Search(query, conf, bitset)); auto ids = result.value()->GetIds(); float recall = CalcRecall(g_ids, ids, nq, k); - printf(" bitset_per = %3d%%, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", per, nq, k, t_diff, + printf(" bitset_per = %3d%%, nq = %4d, k = %4d, elapse = %6.3fs, R@ = %.4f\n", per, nq, k, TDIFF_, recall); std::fflush(stdout); } @@ -246,10 +246,13 @@ TEST_F(Benchmark_float_bitset, TEST_DISKANN) { knowhere::Json conf = cfg_; - conf["index_prefix"] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); - conf["data_path"] = kRawDataPath; - conf["pq_code_budget_gb"] = sizeof(float) * kDim * kNumRows * 0.125 / (1024 * 1024 * 1024); - conf["build_dram_budget_gb"] = 32.0; + conf[knowhere::meta::INDEX_PREFIX] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); + conf[knowhere::meta::DATA_PATH] = kRawDataPath; + conf[knowhere::indexparam::MAX_DEGREE] = 56; + conf[knowhere::indexparam::PQ_CODE_BUDGET_GB] = sizeof(float) * kDim * kNumRows * 0.125 / (1024 * 1024 * 1024); + conf[knowhere::indexparam::BUILD_DRAM_BUDGET_GB] = 32.0; + conf[knowhere::indexparam::SEARCH_CACHE_BUDGET_GB] = 0; + conf[knowhere::indexparam::BEAMWIDTH] = 8; fs::create_directory(kDir); fs::create_directory(kL2IndexDir); diff --git a/benchmark/hdf5/benchmark_float_qps.cpp b/benchmark/hdf5/benchmark_float_qps.cpp index fa3300db4..36edba115 100644 --- a/benchmark/hdf5/benchmark_float_qps.cpp +++ b/benchmark/hdf5/benchmark_float_qps.cpp @@ -17,12 +17,33 @@ #include "benchmark_knowhere.h" #include "knowhere/comp/index_param.h" #include "knowhere/comp/knowhere_config.h" +#include "knowhere/comp/local_file_manager.h" #include "knowhere/dataset.h" const int32_t GPU_DEVICE_ID = 0; class Benchmark_float_qps : public Benchmark_knowhere, public ::testing::Test { public: + template + void + test_idmap(const knowhere::Json& cfg) { + auto conf = cfg; + + float expected_recall = 1.0f; + conf[knowhere::meta::TOPK] = topk_; + + printf("\n[%0.3f s] %s | %s | k=%d, R@=%.4f\n", get_time_diff(), ann_test_name_.c_str(), index_type_.c_str(), + topk_, expected_recall); + printf("================================================================================\n"); + for (auto thread_num : THREAD_NUMs_) { + CALC_TIME_SPAN(task(conf, thread_num, nq_)); + printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, TDIFF_, nq_ / TDIFF_); + std::fflush(stdout); + } + printf("================================================================================\n"); + printf("[%.3f s] Test '%s/%s' done\n\n", get_time_diff(), ann_test_name_.c_str(), index_type_.c_str()); + } + template void test_ivf(const knowhere::Json& cfg) { @@ -67,7 +88,7 @@ class Benchmark_float_qps : public Benchmark_knowhere, public ::testing::Test { printf("================================================================================\n"); for (auto thread_num : THREAD_NUMs_) { CALC_TIME_SPAN(task(conf, thread_num, nq_)); - printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, t_diff, nq_ / t_diff); + printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, TDIFF_, nq_ / TDIFF_); std::fflush(stdout); } printf("================================================================================\n"); @@ -75,8 +96,9 @@ class Benchmark_float_qps : public Benchmark_knowhere, public ::testing::Test { } } + template void - test_cagra(const knowhere::Json& cfg) { + test_raft_cagra(const knowhere::Json& cfg) { auto conf = cfg; auto find_smallest_max_iters = [&](float expected_recall) -> int32_t { @@ -92,10 +114,8 @@ class Benchmark_float_qps : public Benchmark_knowhere, public ::testing::Test { auto result = index_.value().Search(ds_ptr, conf, nullptr); recall = CalcRecall(result.value()->GetIds(), nq_, topk_); - printf( - "[%0.3f s] iterate CAGRA param for recall %.4f: max_iterations=%d, k=%d, " - "R@=%.4f\n", - get_time_diff(), expected_recall, max_iterations, topk_, recall); + printf("[%0.3f s] iterate CAGRA param for recall %.4f: max_iterations=%d, k=%d, R@=%.4f\n", + get_time_diff(), expected_recall, max_iterations, topk_, recall); std::fflush(stdout); if (std::abs(recall - expected_recall) <= 0.0001) { return max_iterations; @@ -114,14 +134,12 @@ class Benchmark_float_qps : public Benchmark_knowhere, public ::testing::Test { conf[knowhere::meta::TOPK] = topk_; conf[knowhere::indexparam::MAX_ITERATIONS] = find_smallest_max_iters(expected_recall); - printf( - "\n[%0.3f s] %s | %s | k=%d, " - "R@=%.4f\n", - get_time_diff(), ann_test_name_.c_str(), index_type_.c_str(), topk_, expected_recall); + printf("\n[%0.3f s] %s | %s | k=%d, R@=%.4f\n", get_time_diff(), ann_test_name_.c_str(), + index_type_.c_str(), topk_, expected_recall); printf("================================================================================\n"); for (auto thread_num : THREAD_NUMs_) { - CALC_TIME_SPAN(task(conf, thread_num, nq_)); - printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, t_diff, nq_ / t_diff); + CALC_TIME_SPAN(task(conf, thread_num, nq_)); + printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, TDIFF_, nq_ / TDIFF_); std::fflush(stdout); } printf("================================================================================\n"); @@ -174,7 +192,7 @@ class Benchmark_float_qps : public Benchmark_knowhere, public ::testing::Test { printf("================================================================================\n"); for (auto thread_num : THREAD_NUMs_) { CALC_TIME_SPAN(task(conf, thread_num, nq_)); - printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, t_diff, nq_ / t_diff); + printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, TDIFF_, nq_ / TDIFF_); std::fflush(stdout); } printf("================================================================================\n"); @@ -232,7 +250,59 @@ class Benchmark_float_qps : public Benchmark_knowhere, public ::testing::Test { printf("================================================================================\n"); for (auto thread_num : THREAD_NUMs_) { CALC_TIME_SPAN(task(conf, thread_num, nq_)); - printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, t_diff, nq_ / t_diff); + printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, TDIFF_, nq_ / TDIFF_); + std::fflush(stdout); + } + printf("================================================================================\n"); + printf("[%.3f s] Test '%s/%s' done\n\n", get_time_diff(), ann_test_name_.c_str(), index_type_.c_str()); + } + } + + template + void + test_diskann(const knowhere::Json& cfg) { + auto conf = cfg; + + auto find_smallest_search_list_size = [&](float expected_recall) -> int32_t { + conf[knowhere::meta::TOPK] = topk_; + auto ds_ptr = knowhere::GenDataSet(nq_, dim_, xq_); + auto query = knowhere::ConvertToDataTypeIfNeeded(ds_ptr); + + int32_t left = topk_, right = 512, search_list_size; + float recall; + while (left <= right) { + search_list_size = left + (right - left) / 2; + conf[knowhere::indexparam::SEARCH_LIST_SIZE] = search_list_size; + + auto result = index_.value().Search(ds_ptr, conf, nullptr); + recall = CalcRecall(result.value()->GetIds(), nq_, topk_); + printf( + "[%0.3f s] iterate DISKANN param for expected recall %.4f: search_list_size=%4d, k=%d, R@=%.4f\n", + get_time_diff(), expected_recall, search_list_size, topk_, recall); + std::fflush(stdout); + if (std::abs(recall - expected_recall) <= 0.0001) { + return search_list_size; + } + if (recall < expected_recall) { + left = search_list_size + 1; + } else { + right = search_list_size - 1; + } + } + return left; + }; + + for (auto expected_recall : EXPECTED_RECALLs_) { + auto search_list_size = find_smallest_search_list_size(expected_recall); + conf[knowhere::indexparam::SEARCH_LIST_SIZE] = search_list_size; + conf[knowhere::meta::TOPK] = topk_; + + printf("\n[%0.3f s] %s | %s | search_list_size=%d, k=%d, R@=%.4f\n", get_time_diff(), + ann_test_name_.c_str(), index_type_.c_str(), search_list_size, topk_, expected_recall); + printf("================================================================================\n"); + for (auto thread_num : THREAD_NUMs_) { + CALC_TIME_SPAN(task(conf, thread_num, nq_)); + printf(" thread_num = %2d, elapse = %6.3fs, VPS = %.3f\n", thread_num, TDIFF_, nq_ / TDIFF_); std::fflush(stdout); } printf("================================================================================\n"); @@ -319,17 +389,29 @@ class Benchmark_float_qps : public Benchmark_knowhere, public ::testing::Test { const std::vector SCANN_WITH_RAW_DATA = {true}; // CAGRA index params - const std::vector GRAPH_DEGREE_ = {32, 64}; + const std::vector GRAPH_DEGREEs_ = {8, 16, 32}; + const std::vector ITOPK_SIZEs_ = {128, 192, 256}; }; +TEST_F(Benchmark_float_qps, TEST_IDMAP) { + index_type_ = knowhere::IndexEnum::INDEX_FAISS_IDMAP; + +#define TEST_IDMAP(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_idmap(conf); + + std::string index_file_name; + knowhere::Json conf = cfg_; + std::vector params = {}; + + TEST_IDMAP(knowhere::fp32, params); + TEST_IDMAP(knowhere::fp16, params); + TEST_IDMAP(knowhere::bf16, params); +} + TEST_F(Benchmark_float_qps, TEST_IVF_FLAT) { -#ifdef KNOWHERE_WITH_GPU - index_type_ = knowhere::IndexEnum::INDEX_FAISS_GPU_IVFFLAT; -#elif KNOWHERE_WITH_RAFT - index_type_ = knowhere::IndexEnum::INDEX_RAFT_IVFFLAT; -#else index_type_ = knowhere::IndexEnum::INDEX_FAISS_IVFFLAT; -#endif #define TEST_IVF(T, X) \ index_file_name = get_index_name(X); \ @@ -349,11 +431,7 @@ TEST_F(Benchmark_float_qps, TEST_IVF_FLAT) { } TEST_F(Benchmark_float_qps, TEST_IVF_SQ8) { -#ifdef KNOWHERE_WITH_GPU - index_type_ = knowhere::IndexEnum::INDEX_FAISS_GPU_IVFSQ8; -#else index_type_ = knowhere::IndexEnum::INDEX_FAISS_IVFSQ8; -#endif #define TEST_IVF(T, X) \ index_file_name = get_index_name(X); \ @@ -373,13 +451,7 @@ TEST_F(Benchmark_float_qps, TEST_IVF_SQ8) { } TEST_F(Benchmark_float_qps, TEST_IVF_PQ) { -#ifdef KNOWHERE_WITH_GPU - index_type_ = knowhere::IndexEnum::INDEX_FAISS_GPU_IVFPQ; -#elif KNOWHERE_WITH_RAFT - index_type_ = knowhere::IndexEnum::INDEX_RAFT_IVFPQ; -#else index_type_ = knowhere::IndexEnum::INDEX_FAISS_IVFPQ; -#endif #define TEST_IVF(T, X) \ index_file_name = get_index_name(X); \ @@ -454,15 +526,115 @@ TEST_F(Benchmark_float_qps, TEST_SCANN) { } } -TEST_F(Benchmark_float_qps, TEST_CAGRA) { +#ifdef KNOWHERE_WITH_DISKANN +TEST_F(Benchmark_float_qps, TEST_DISKANN) { + index_type_ = knowhere::IndexEnum::INDEX_DISKANN; + + knowhere::Json conf = cfg_; + + conf[knowhere::meta::INDEX_PREFIX] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); + conf[knowhere::meta::DATA_PATH] = kRawDataPath; + conf[knowhere::indexparam::MAX_DEGREE] = 56; + conf[knowhere::indexparam::PQ_CODE_BUDGET_GB] = sizeof(float) * dim_ * nb_ * 0.125 / (1024 * 1024 * 1024); + conf[knowhere::indexparam::BUILD_DRAM_BUDGET_GB] = 32.0; + conf[knowhere::indexparam::SEARCH_CACHE_BUDGET_GB] = 0; + conf[knowhere::indexparam::BEAMWIDTH] = 8; + + fs::create_directory(kDir); + fs::create_directory(kL2IndexDir); + fs::create_directory(kIPIndexDir); + + WriteRawDataToDisk(kRawDataPath, (const float*)xb_, (const uint32_t)nb_, (const uint32_t)dim_); + + std::shared_ptr file_manager = std::make_shared(); + auto diskann_index_pack = knowhere::Pack(file_manager); + + index_ = knowhere::IndexFactory::Instance().Create( + index_type_, knowhere::Version::GetCurrentVersion().VersionNumber(), diskann_index_pack); + printf("[%.3f s] Building all on %d vectors\n", get_time_diff(), nb_); + knowhere::DataSetPtr ds_ptr = nullptr; + index_.value().Build(ds_ptr, conf); + + knowhere::BinarySet binset; + index_.value().Serialize(binset); + index_.value().Deserialize(binset, conf); + + test_diskann(conf); +} +#endif + +#ifdef KNOWHERE_WITH_RAFT +TEST_F(Benchmark_float_qps, TEST_RAFT_BRUTE_FORCE) { + index_type_ = knowhere::IndexEnum::INDEX_RAFT_BRUTEFORCE; + +#define TEST_RAFT_BF(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_idmap(conf); + + std::string index_file_name; + knowhere::Json conf = cfg_; + std::vector params = {}; + + TEST_RAFT_BF(knowhere::fp32, params); +} + +TEST_F(Benchmark_float_qps, TEST_RAFT_IVF_FLAT) { + index_type_ = knowhere::IndexEnum::INDEX_RAFT_IVFFLAT; + +#define TEST_RAFT_IVF(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_ivf(conf); + + std::string index_file_name; + knowhere::Json conf = cfg_; + for (auto nlist : NLISTs_) { + conf[knowhere::indexparam::NLIST] = nlist; + std::vector params = {nlist}; + + TEST_RAFT_IVF(knowhere::fp32, params); + } +} + +TEST_F(Benchmark_float_qps, TEST_RAFT_IVF_PQ) { + index_type_ = knowhere::IndexEnum::INDEX_RAFT_IVFPQ; + +#define TEST_RAFT_IVF(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_ivf(conf); + + std::string index_file_name; + knowhere::Json conf = cfg_; + conf[knowhere::indexparam::NBITS] = NBITS_; + for (auto m : Ms_) { + conf[knowhere::indexparam::M] = m; + for (auto nlist : NLISTs_) { + conf[knowhere::indexparam::NLIST] = nlist; + std::vector params = {nlist, m}; + + TEST_RAFT_IVF(knowhere::fp32, params); + } + } +} + +TEST_F(Benchmark_float_qps, TEST_RAFT_CAGRA) { index_type_ = knowhere::IndexEnum::INDEX_RAFT_CAGRA; + +#define TEST_RAFT_CAGRA(T, X) \ + index_file_name = get_index_name(X); \ + create_index(index_file_name, conf); \ + test_raft_cagra(conf); + + std::string index_file_name; knowhere::Json conf = cfg_; - for (auto gd : GRAPH_DEGREE_) { - conf[knowhere::indexparam::GRAPH_DEGREE] = gd; - conf[knowhere::indexparam::INTERMEDIATE_GRAPH_DEGREE] = gd; - conf[knowhere::indexparam::MAX_ITERATIONS] = 64; - std::string index_file_name = get_index_name({gd}); - create_index(index_file_name, conf); - test_cagra(conf); + + for (auto graph_degree : GRAPH_DEGREEs_) { + conf[knowhere::indexparam::GRAPH_DEGREE] = graph_degree; + conf[knowhere::indexparam::INTERMEDIATE_GRAPH_DEGREE] = graph_degree; + std::vector params = {graph_degree}; + TEST_RAFT_CAGRA(knowhere::fp32, params); } } +#endif diff --git a/benchmark/hdf5/benchmark_float_range.cpp b/benchmark/hdf5/benchmark_float_range.cpp index 1ec62a333..b2c86a37d 100644 --- a/benchmark/hdf5/benchmark_float_range.cpp +++ b/benchmark/hdf5/benchmark_float_range.cpp @@ -39,7 +39,7 @@ class Benchmark_float_range : public Benchmark_knowhere, public ::testing::Test CheckDistance(metric_type_, ids, distances, lims, nq); float recall = CalcRecall(ids, lims, nq); float accuracy = CalcAccuracy(ids, lims, nq); - printf(" nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", nq, t_diff, recall, accuracy, + printf(" nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", nq, TDIFF_, recall, accuracy, lims[nq] / (float)nq); std::fflush(stdout); } @@ -68,7 +68,7 @@ class Benchmark_float_range : public Benchmark_knowhere, public ::testing::Test float recall = CalcRecall(ids, lims, nq); float accuracy = CalcAccuracy(ids, lims, nq); printf(" nprobe = %4d, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", nprobe, nq, - t_diff, recall, accuracy, lims[nq] / (float)nq); + TDIFF_, recall, accuracy, lims[nq] / (float)nq); std::fflush(stdout); } } @@ -97,7 +97,7 @@ class Benchmark_float_range : public Benchmark_knowhere, public ::testing::Test auto lims = result.value()->GetLims(); float recall = CalcRecall(ids, lims, nq); float accuracy = CalcAccuracy(ids, lims, nq); - printf(" ef = %4d, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", ef, nq, t_diff, + printf(" ef = %4d, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", ef, nq, TDIFF_, recall, accuracy, lims[nq] / (float)nq); std::fflush(stdout); } @@ -127,7 +127,7 @@ class Benchmark_float_range : public Benchmark_knowhere, public ::testing::Test float recall = CalcRecall(ids, lims, nq); float accuracy = CalcAccuracy(ids, lims, nq); printf(" search_list_size = %4d, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", - search_list_size, nq, t_diff, recall, accuracy, lims[nq] / (float)nq); + search_list_size, nq, TDIFF_, recall, accuracy, lims[nq] / (float)nq); std::fflush(stdout); } } @@ -333,13 +333,13 @@ TEST_F(Benchmark_float_range, TEST_DISKANN) { knowhere::Json conf = cfg_; - conf["index_prefix"] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); - conf["data_path"] = kRawDataPath; - conf["max_degree"] = 56; - conf["pq_code_budget_gb"] = sizeof(float) * dim_ * nb_ * 0.125 / (1024 * 1024 * 1024); - conf["build_dram_budget_gb"] = 32.0; - conf["search_cache_budget_gb"] = 0; - conf["beamwidth"] = 8; + conf[knowhere::meta::INDEX_PREFIX] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); + conf[knowhere::meta::DATA_PATH] = kRawDataPath; + conf[knowhere::indexparam::MAX_DEGREE] = 56; + conf[knowhere::indexparam::PQ_CODE_BUDGET_GB] = sizeof(float) * dim_ * nb_ * 0.125 / (1024 * 1024 * 1024); + conf[knowhere::indexparam::BUILD_DRAM_BUDGET_GB] = 32.0; + conf[knowhere::indexparam::SEARCH_CACHE_BUDGET_GB] = 0; + conf[knowhere::indexparam::BEAMWIDTH] = 8; fs::create_directory(kDir); fs::create_directory(kL2IndexDir); diff --git a/benchmark/hdf5/benchmark_float_range_bitset.cpp b/benchmark/hdf5/benchmark_float_range_bitset.cpp index 6a6216ec9..00673f2fb 100644 --- a/benchmark/hdf5/benchmark_float_range_bitset.cpp +++ b/benchmark/hdf5/benchmark_float_range_bitset.cpp @@ -54,7 +54,7 @@ class Benchmark_float_range_bitset : public Benchmark_knowhere, public ::testing float recall = CalcRecall(g_ids, g_lims, ids, lims, nq); float accuracy = CalcAccuracy(g_ids, g_lims, ids, lims, nq); printf(" bitset_per = %3d%%, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", per, nq, - t_diff, recall, accuracy, lims[nq] / (float)nq); + TDIFF_, recall, accuracy, lims[nq] / (float)nq); std::fflush(stdout); } } @@ -87,7 +87,7 @@ class Benchmark_float_range_bitset : public Benchmark_knowhere, public ::testing float recall = CalcRecall(g_ids, g_lims, ids, lims, nq); float accuracy = CalcAccuracy(g_ids, g_lims, ids, lims, nq); printf(" bitset_per = %3d%%, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", per, nq, - t_diff, recall, accuracy, lims[nq] / (float)nq); + TDIFF_, recall, accuracy, lims[nq] / (float)nq); std::fflush(stdout); } } @@ -120,7 +120,7 @@ class Benchmark_float_range_bitset : public Benchmark_knowhere, public ::testing float recall = CalcRecall(g_ids, g_lims, ids, lims, nq); float accuracy = CalcAccuracy(g_ids, g_lims, ids, lims, nq); printf(" bitset_per = %3d%%, nq = %4d, elapse = %6.3fs, R@ = %.4f, A@ = %.4f, L@ = %.2f\n", per, nq, - t_diff, recall, accuracy, lims[nq] / (float)nq); + TDIFF_, recall, accuracy, lims[nq] / (float)nq); std::fflush(stdout); } } @@ -245,10 +245,13 @@ TEST_F(Benchmark_float_range_bitset, TEST_DISKANN) { knowhere::Json conf = cfg_; - conf["index_prefix"] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); - conf["data_path"] = kRawDataPath; - conf["pq_code_budget_gb"] = sizeof(float) * kDim * kNumRows * 0.125 / (1024 * 1024 * 1024); - conf["build_dram_budget_gb"] = 32.0; + conf[knowhere::meta::INDEX_PREFIX] = (metric_type_ == knowhere::metric::L2 ? kL2IndexPrefix : kIPIndexPrefix); + conf[knowhere::meta::DATA_PATH] = kRawDataPath; + conf[knowhere::indexparam::MAX_DEGREE] = 56; + conf[knowhere::indexparam::PQ_CODE_BUDGET_GB] = sizeof(float) * kDim * kNumRows * 0.125 / (1024 * 1024 * 1024); + conf[knowhere::indexparam::BUILD_DRAM_BUDGET_GB] = 32.0; + conf[knowhere::indexparam::SEARCH_CACHE_BUDGET_GB] = 0; + conf[knowhere::indexparam::BEAMWIDTH] = 8; fs::create_directory(kDir); fs::create_directory(kL2IndexDir); diff --git a/benchmark/hdf5/benchmark_knowhere.h b/benchmark/hdf5/benchmark_knowhere.h index adb17fa72..25331b5d0 100644 --- a/benchmark/hdf5/benchmark_knowhere.h +++ b/benchmark/hdf5/benchmark_knowhere.h @@ -140,10 +140,11 @@ class Benchmark_knowhere : public Benchmark_hdf5 { default_ds_ptr->GetRows()); auto base = knowhere::ConvertToDataTypeIfNeeded(default_ds_ptr); - index.value().Build(base, conf); + CALC_TIME_SPAN(index.value().Build(base, conf)); printf("[%.3f s] Writing %sindex file: %s\n", get_time_diff(), additional_name_s.c_str(), index_file_name.c_str()); + printf("Build index %s time: %.3fs \n", index.value().Type().c_str(), TDIFF_); write_index(index.value(), index_file_name, conf); } diff --git a/benchmark/hdf5/ref_logs/Makefile b/benchmark/hdf5/ref_logs/Makefile index 1b94f4d78..202266c27 100644 --- a/benchmark/hdf5/ref_logs/Makefile +++ b/benchmark/hdf5/ref_logs/Makefile @@ -23,7 +23,7 @@ test_binary_range_hnsw: ################################################################################################### # Test Knowhere float index test_float: test_float_idmap test_float_ivf_flat test_float_ivf_sq8 test_float_ivf_pq test_float_hnsw test_float_diskann -test_float_gpu: test_float_ivf_flat test_float_ivf_pq +test_float_raft: test_float_raft_brute_force test_float_raft_ivf_flat test_float_raft_ivf_pq test_float_raft_cagra test_float_ivf: test_float_ivf_flat test_float_ivf_pq test_float_idmap: @@ -39,6 +39,15 @@ test_float_hnsw: test_float_diskann: ./benchmark_float --gtest_filter="Benchmark_float.TEST_DISKANN" | tee test_float_diskann.log +test_float_raft_brute_force: + ./benchmark_float --gtest_filter="Benchmark_float.TEST_RAFT_BRUTE_FORCE" | tee test_float_raft_brute_force.log +test_float_raft_ivf_flat: + ./benchmark_float --gtest_filter="Benchmark_float.TEST_RAFT_IVF_FLAT" | tee test_float_raft_ivf_flat.log +test_float_raft_ivf_pq: + ./benchmark_float --gtest_filter="Benchmark_float.TEST_RAFT_IVF_PQ" | tee test_float_raft_ivf_pq.log +test_float_raft_cagra: + ./benchmark_float --gtest_filter="Benchmark_float.TEST_RAFT_CAGRA" | tee test_float_raft_cagra.log + ################################################################################################### # Test Knowhere float index bitset test_float_bitset: test_float_bitset_ivf_flat test_float_bitset_ivf_sq8 test_float_bitset_ivf_pq test_float_bitset_hnsw test_float_bitset_diskann @@ -104,14 +113,30 @@ test_float_range_multi_hnsw: ################################################################################################### # Test Knowhere float index qps -test_float_qps: test_float_qps_ivf_flat test_float_qps_ivf_sq8 test_float_qps_hnsw +test_float_qps: test_float_qps_idmap test_float_qps_ivf_flat test_float_qps_ivf_sq8 test_float_qps_ivf_pq test_float_qps_hnsw test_float_qps_scann +test_float_qps_raft: test_float_qps_raft_brute_force test_float_qps_raft_ivf_flat test_float_qps_raft_ivf_pq test_float_qps_raft_cagra +test_float_qps_idmap: + ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_IDMAP" | tee test_float_qps_idmap.log test_float_qps_ivf_flat: ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_IVF_FLAT" | tee test_float_qps_ivf_flat.log test_float_qps_ivf_sq8: ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_IVF_SQ8" | tee test_float_qps_ivf_sq8.log +test_float_qps_ivf_pq: + ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_IVF_PQ" | tee test_float_qps_ivf_pq.log test_float_qps_hnsw: ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_HNSW" | tee test_float_qps_hnsw.log +test_float_qps_scann: + ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_SCANN" | tee test_float_qps_scann.log + +test_float_qps_raft_brute_force: + ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_RAFT_BRUTE_FORCE" | tee test_float_qps_raft_brute_force.log +test_float_qps_raft_ivf_flat: + ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_RAFT_IVF_FLAT" | tee test_float_qps_raft_ivf_flat.log +test_float_qps_raft_ivf_pq: + ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_RAFT_IVF_PQ" | tee test_float_qps_raft_ivf_pq.log +test_float_qps_raft_cagra: + ./benchmark_float_qps --gtest_filter="Benchmark_float_qps.TEST_RAFT_CAGRA" | tee test_float_qps_raft_cagra.log ################################################################################################### # Test Knowhere float index range qps diff --git a/include/knowhere/comp/index_param.h b/include/knowhere/comp/index_param.h index 1452fc2d9..7f126d8a0 100644 --- a/include/knowhere/comp/index_param.h +++ b/include/knowhere/comp/index_param.h @@ -118,9 +118,11 @@ constexpr const char* WITH_RAW_DATA = "with_raw_data"; constexpr const char* ENSURE_TOPK_FULL = "ensure_topk_full"; constexpr const char* CODE_SIZE = "code_size"; constexpr const char* RAW_DATA_STORE_PREFIX = "raw_data_store_prefix"; + // RAFT Params constexpr const char* REFINE_RATIO = "refine_ratio"; constexpr const char* CACHE_DATASET_ON_DEVICE = "cache_dataset_on_device"; + // RAFT-specific IVF Params constexpr const char* KMEANS_N_ITERS = "kmeans_n_iters"; constexpr const char* KMEANS_TRAINSET_FRACTION = "kmeans_trainset_fraction"; @@ -156,6 +158,14 @@ constexpr const char* HNSW_M = "M"; constexpr const char* EF = "ef"; constexpr const char* OVERVIEW_LEVELS = "overview_levels"; +// DISKANN Params +constexpr const char* MAX_DEGREE = "max_degree"; +constexpr const char* PQ_CODE_BUDGET_GB = "pq_code_budget_gb"; +constexpr const char* BUILD_DRAM_BUDGET_GB = "build_dram_budget_gb"; +constexpr const char* BEAMWIDTH = "beamwidth"; +constexpr const char* SEARCH_CACHE_BUDGET_GB = "search_cache_budget_gb"; +constexpr const char* SEARCH_LIST_SIZE = "search_list_size"; + // FAISS additional Params constexpr const char* SQ_TYPE = "sq_type"; // for IVF_SQ and HNSW_SQ constexpr const char* PRQ_NUM = "nrq"; // for PRQ, number of redisual quantizers