Skip to content

Commit

Permalink
Updating cagra build constraint (#2016)
Browse files Browse the repository at this point in the history
The C++ side will automatically reset this constraint to a valid setting, however this is leading to additional param settings being trained and searched unecessarily.

Authors:
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Divye Gala (https://github.com/divyegala)

URL: #2016
  • Loading branch information
cjnolet authored Nov 28, 2023
1 parent 88e9a55 commit 736a8bf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
DTYPE_SIZES = {"float": 4, "half": 2, "fp8": 1}


def raft_cagra_build_constraints(params, dims):
if "graph_degree" in params and "intermediate_graph_degree" in params:
return params["graph_degree"] <= params["intermediate_graph_degree"]
return True


def raft_ivf_pq_build_constraints(params, dims):
if "pq_dim" in params:
return params["pq_dim"] <= dims
Expand All @@ -36,8 +42,10 @@ def raft_ivf_pq_search_constraints(params, build_params, k, batch_size):


def raft_cagra_search_constraints(params, build_params, k, batch_size):
ret = True
if "itopk" in params:
return params["itopk"] >= k
ret = ret and params["itopk"] >= k
return ret


def hnswlib_search_constraints(params, build_params, k, batch_size):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: raft_cagra
constraints:
build: raft-ann-bench.constraints.raft_cagra_build_constraints
search: raft-ann-bench.constraints.raft_cagra_search_constraints
groups:
base:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
groundtruth_neighbors_file: wiki_all_1M/groundtruth.1M.neighbors.ibin
distance: euclidean

- name: wiki_all_10M,
- name: wiki_all_10M
dims: 768
base_file: wiki_all_10M/base.10M.fbin
query_file: wiki_all_10M/queries.fbin
Expand Down

0 comments on commit 736a8bf

Please sign in to comment.