11/*
2- * SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
2+ * SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved .
33 * SPDX-License-Identifier: Apache-2.0
44 */
55
@@ -66,7 +66,11 @@ struct cuvsHnswAceParams {
6666 size_t npartitions ;
6767 /**
6868 * Directory to store ACE build artifacts (e.g., KNN graph, optimized graph).
69- * Used when `use_disk` is true or when the graph does not fit in memory.
69+ * Used when `use_disk` is true or when the graph does not fit in memory. The
70+ * directory may already exist, but ACE's named artifacts and `hnsw_index.bin`
71+ * must not already exist. Simultaneous builds must use different directories.
72+ * On failure, ACE removes only its uncommitted CAGRA artifacts; a completed
73+ * CAGRA stage is retained if creating the HNSW index fails.
7074 */
7175 const char * build_dir ;
7276 /**
@@ -109,7 +113,7 @@ CUVS_EXPORT cuvsError_t cuvsHnswAceParamsDestroy(cuvsHnswAceParams_t params);
109113struct cuvsHnswIndexParams {
110114 /* hierarchy of the hnsw index */
111115 enum cuvsHnswHierarchy hierarchy ;
112- /** Size of the candidate list during hierarchy construction when hierarchy is `CPU` */
116+ /** Maximum candidate list size used during index construction. */
113117 int ef_construction ;
114118 /** Number of host threads to use to construct hierarchy when hierarchy is `CPU` or `GPU`.
115119 When the value is 0, the number of threads is automatically determined to the
@@ -119,15 +123,15 @@ struct cuvsHnswIndexParams {
119123 is parallelized with the help of CPU threads.
120124 */
121125 int num_threads ;
122- /** HNSW M parameter: number of bi-directional links per node (used when building with ACE).
123- * graph_degree = m * 2, intermediate_graph_degree = m * 3 .
126+ /** HNSW M parameter: number of bi-directional links per node. When the graph is built on the GPU,
127+ * this parameter is used to derive the internal CAGRA graph build parameters .
124128 */
125129 size_t M ;
126130 /** Distance type for the index. */
127131 cuvsDistanceType metric ;
128132 /**
129- * Optional: specify ACE parameters for building HNSW index using ACE algorithm .
130- * Set to nullptr for default behavior (from_cagra conversion) .
133+ * Optional ACE parameters for out-of-core graph construction .
134+ * Set to nullptr to select the graph build algorithm automatically .
131135 */
132136 cuvsHnswAceParams_t ace_params ;
133137};
@@ -285,22 +289,20 @@ CUVS_EXPORT cuvsError_t cuvsHnswFromCagraWithDataset(cuvsResources_t res,
285289 */
286290
287291/**
288- * @defgroup hnsw_c_index_build Build HNSW index using ACE algorithm
292+ * @defgroup hnsw_c_index_build Build an HNSW index
289293 * @{
290294 */
291295
292296/**
293- * @brief Build an HNSW index using ACE (Augmented Core Extraction) algorithm .
297+ * @brief Build an HNSW index from HNSW parameters .
294298 *
295- * ACE enables building HNSW indexes for datasets too large to fit in GPU memory by:
296- * 1. Partitioning the dataset using balanced k-means into core and augmented partitions
297- * 2. Building sub-indexes for each partition independently
298- * 3. Concatenating sub-graphs into a final unified index
299+ * The graph is built on the GPU and converted to an HNSW index that can be searched on the CPU.
300+ * The graph build algorithm is selected automatically unless explicit ACE parameters are provided.
299301 *
300302 * NOTE: This function requires CUDA to be available at runtime.
301303 *
302304 * @param[in] res cuvsResources_t opaque C handle
303- * @param[in] params cuvsHnswIndexParams_t with ACE parameters configured
305+ * @param[in] params cuvsHnswIndexParams_t with HNSW build parameters
304306 * @param[in] dataset DLManagedTensor* host dataset to build index from
305307 * @param[out] index cuvsHnswIndex_t to return the built HNSW index
306308 *
@@ -314,18 +316,10 @@ CUVS_EXPORT cuvsError_t cuvsHnswFromCagraWithDataset(cuvsResources_t res,
314316 * cuvsResources_t res;
315317 * cuvsResourcesCreate(&res);
316318 *
317- * // Create ACE parameters
318- * cuvsHnswAceParams_t ace_params;
319- * cuvsHnswAceParamsCreate(&ace_params);
320- * ace_params->npartitions = 4;
321- * ace_params->use_disk = true;
322- * ace_params->build_dir = "/tmp/hnsw_ace_build";
323- *
324319 * // Create index parameters
325320 * cuvsHnswIndexParams_t params;
326321 * cuvsHnswIndexParamsCreate(¶ms);
327322 * params->hierarchy = GPU;
328- * params->ace_params = ace_params;
329323 * params->M = 32;
330324 * params->ef_construction = 120;
331325 *
@@ -340,7 +334,6 @@ CUVS_EXPORT cuvsError_t cuvsHnswFromCagraWithDataset(cuvsResources_t res,
340334 * cuvsHnswBuild(res, params, &dataset, hnsw_index);
341335 *
342336 * // Clean up
343- * cuvsHnswAceParamsDestroy(ace_params);
344337 * cuvsHnswIndexParamsDestroy(params);
345338 * cuvsHnswIndexDestroy(hnsw_index);
346339 * cuvsResourcesDestroy(res);
0 commit comments