Skip to content
Open
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
11 changes: 9 additions & 2 deletions cpp/bench/ann/src/cuvs/cuvs_ann_bench_param_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ void parse_build_param(const nlohmann::json& conf, cuvs::neighbors::cagra::index
params.graph_build_params)) {
params.graph_build_params = cuvs::neighbors::graph_build_params::ace_params{};
}
} else if (conf.at("graph_build_algo") == "ITERATIVE_SEARCH") {
if (!std::holds_alternative<cuvs::neighbors::graph_build_params::iterative_search_params>(
params.graph_build_params)) {
params.graph_build_params = cuvs::neighbors::graph_build_params::iterative_search_params{};
}
}
}

Expand All @@ -291,16 +296,18 @@ void parse_build_param(const nlohmann::json& conf, cuvs::neighbors::cagra::index
nlohmann::json nn_descent_conf = collect_conf_with_prefix(conf, "nn_descent_");
nlohmann::json ace_conf = collect_conf_with_prefix(conf, "ace_");
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also collect iterative search params here and then check for that collected conf below in the monostate if condition?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will also require changes to collect_conf_with_prefix


// When graph_build_algo is not specified, leave graph_build_params as monostate so the
// CAGRA build uses AUTO selection (NN_DESCENT or IVF_PQ based on dataset/heuristics).
// Only infer from algo-specific config keys when present.
if (std::holds_alternative<std::monostate>(params.graph_build_params)) {
if (!ivf_pq_build_conf.empty() || !ivf_pq_search_conf.empty()) {
params.graph_build_params = cuvs::neighbors::graph_build_params::ivf_pq_params{};
} else if (!nn_descent_conf.empty()) {
params.graph_build_params = cuvs::neighbors::graph_build_params::nn_descent_params{};
} else if (!ace_conf.empty()) {
params.graph_build_params = cuvs::neighbors::graph_build_params::ace_params{};
} else {
params.graph_build_params = cuvs::neighbors::graph_build_params::iterative_search_params{};
}
// else: leave as monostate → AUTO in cagra_build.cuh
}

// Apply build-algo-specific parameters
Expand Down