Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a4d82e1
Initial multi-warp greedy search optimization
bkarsin Apr 30, 2026
05cc8cc
Add fp16 support for Vamana build/serialize
bkarsin May 1, 2026
5bb5e6c
Fix recall issue with multi-warp optimization
bkarsin May 14, 2026
3dca1b0
Speed up fp16 vamana build with promoted query vectors and optimized …
bkarsin Jun 9, 2026
02b5638
perf(vamana): P1_cache_candidate_vector — Cache the accepted candidat…
bkarsin Jun 11, 2026
9ec9b99
perf(vamana): O1_parallel_scan_buffer_pool — Replace single-thread pr…
bkarsin Jun 11, 2026
696d3d2
perf(vamana): N3_multiwarp_robust_prune — Parallelize RobustPrune occ…
bkarsin Jun 13, 2026
24f2ed7
perf(vamana): N7_reuse_search_distances_in_prune — Reuse GreedySearch…
bkarsin Jun 13, 2026
bbe3d50
perf(vamana): M3_fp16_query_smem_occupancy — Store the cached query c…
bkarsin Jun 16, 2026
eeca286
perf(vamana): M5_prune_single_warp_merge — Do the RobustPrune merge o…
bkarsin Jun 16, 2026
4348e3e
perf(vamana): M6_prune_warps_tuning — Sweep RobustPrune warps-per-blo…
bkarsin Jun 16, 2026
4a0c179
Clean up and remove dead code
bkarsin Jun 24, 2026
cb91c99
pre-commit fixes
bkarsin Jun 24, 2026
2dc5fa9
Fix bug with odd dimension data for some cases
bkarsin Jun 24, 2026
a9b8a8d
Merge branch 'NVIDIA:main' into vamana-build-opt
bkarsin Jun 24, 2026
5da19e0
Merge branch 'main' into vamana-build-opt
cjnolet Jul 15, 2026
c055c60
Merge branch 'main' into vamana-build-opt
bkarsin Jul 17, 2026
df13b42
pre-commit fix
bkarsin Jul 17, 2026
adf1827
Merge branch 'main' into vamana-build-opt
cjnolet Jul 22, 2026
e008a09
Fix launch bounds for older arch builds
bkarsin Jul 22, 2026
350ed89
Add fp16 tests
bkarsin Jul 22, 2026
74caba9
Merge branch 'main' into vamana-build-opt
bkarsin Jul 22, 2026
b8238f3
Add missing test file
bkarsin Jul 22, 2026
70164ef
Change distribution of fp16 vamana unit tests
bkarsin Jul 24, 2026
840860e
Replace hard-coded warp sizes with raft::warp and remove unused code
bkarsin Jul 25, 2026
71bf588
Switch to raft::copy and pre-commit check
bkarsin Jul 25, 2026
9cbd829
Merge branch 'main' into vamana-build-opt
bkarsin Jul 25, 2026
f269c3b
Fix bug with raft::copy
bkarsin Jul 25, 2026
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
13 changes: 12 additions & 1 deletion c/src/neighbors/vamana.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

#include <cstdint>
#include <cuda_fp16.h>
#include <dlpack/dlpack.h>

#include <raft/core/error.hpp>
Expand Down Expand Up @@ -82,6 +83,8 @@ extern "C" cuvsError_t cuvsVamanaIndexDestroy(cuvsVamanaIndex_t index_c_ptr)
if (index.addr != 0) {
if (index.dtype.code == kDLFloat && index.dtype.bits == 32) {
delete reinterpret_cast<cuvs::neighbors::vamana::index<float, uint32_t>*>(index.addr);
} else if (index.dtype.code == kDLFloat && index.dtype.bits == 16) {
delete reinterpret_cast<cuvs::neighbors::vamana::index<half, uint32_t>*>(index.addr);
} else if (index.dtype.code == kDLInt && index.dtype.bits == 8) {
delete reinterpret_cast<cuvs::neighbors::vamana::index<int8_t, uint32_t>*>(index.addr);
} else if (index.dtype.code == kDLUInt && index.dtype.bits == 8) {
Expand All @@ -100,6 +103,10 @@ extern "C" cuvsError_t cuvsVamanaIndexGetDims(cuvsVamanaIndex_t index, int* dim)
auto index_ptr =
reinterpret_cast<cuvs::neighbors::vamana::index<float, uint32_t>*>(index->addr);
*dim = index_ptr->dim();
} else if (index->dtype.code == kDLFloat && index->dtype.bits == 16) {
auto index_ptr =
reinterpret_cast<cuvs::neighbors::vamana::index<half, uint32_t>*>(index->addr);
*dim = index_ptr->dim();
} else if (index->dtype.code == kDLInt && index->dtype.bits == 8) {
auto index_ptr =
reinterpret_cast<cuvs::neighbors::vamana::index<int8_t, uint32_t>*>(index->addr);
Expand All @@ -123,6 +130,8 @@ extern "C" cuvsError_t cuvsVamanaBuild(cuvsResources_t res,

if (dataset.dtype.code == kDLFloat && dataset.dtype.bits == 32) {
index->addr = reinterpret_cast<uintptr_t>(_build<float>(res, params, dataset_tensor));
} else if (dataset.dtype.code == kDLFloat && dataset.dtype.bits == 16) {
index->addr = reinterpret_cast<uintptr_t>(_build<half>(res, params, dataset_tensor));
} else if (dataset.dtype.code == kDLInt && dataset.dtype.bits == 8) {
index->addr = reinterpret_cast<uintptr_t>(_build<int8_t>(res, params, dataset_tensor));
} else if (dataset.dtype.code == kDLUInt && dataset.dtype.bits == 8) {
Expand All @@ -143,6 +152,8 @@ extern "C" cuvsError_t cuvsVamanaSerialize(cuvsResources_t res,
return cuvs::core::translate_exceptions([=] {
if (index->dtype.code == kDLFloat && index->dtype.bits == 32) {
_serialize<float>(res, filename, index, include_dataset);
} else if (index->dtype.code == kDLFloat && index->dtype.bits == 16) {
_serialize<half>(res, filename, index, include_dataset);
} else if (index->dtype.code == kDLInt && index->dtype.bits == 8) {
_serialize<int8_t>(res, filename, index, include_dataset);
} else if (index->dtype.code == kDLUInt && index->dtype.bits == 8) {
Expand Down
2 changes: 2 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1412,10 +1412,12 @@ if(NOT BUILD_CPU_ONLY)
src/neighbors/tiered_index.cu
src/neighbors/sparse_brute_force.cu
src/neighbors/vamana_build_float.cu
src/neighbors/vamana_build_half.cu
src/neighbors/vamana_build_uint8.cu
src/neighbors/vamana_build_int8.cu
src/neighbors/vamana_codebooks_float.cu
src/neighbors/vamana_serialize_float.cu
src/neighbors/vamana_serialize_half.cu
src/neighbors/vamana_serialize_uint8.cu
src/neighbors/vamana_serialize_int8.cu
src/preprocessing/quantize/scalar.cu
Expand Down
19 changes: 18 additions & 1 deletion cpp/include/cuvs/neighbors/vamana.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include "common.hpp"
#include <cuda_fp16.h>
#include <cuvs/distance/distance.hpp>
#include <cuvs/neighbors/common.hpp>
#include <raft/core/device_mdspan.hpp>
Expand Down Expand Up @@ -344,6 +345,16 @@ auto build(raft::resources const& res,
raft::host_matrix_view<const float, int64_t, raft::row_major> dataset)
-> cuvs::neighbors::vamana::index<float, uint32_t>;

auto build(raft::resources const& res,
const cuvs::neighbors::vamana::index_params& params,
raft::device_matrix_view<const half, int64_t, raft::row_major> dataset)
-> cuvs::neighbors::vamana::index<half, uint32_t>;

auto build(raft::resources const& res,
const cuvs::neighbors::vamana::index_params& params,
raft::host_matrix_view<const half, int64_t, raft::row_major> dataset)
-> cuvs::neighbors::vamana::index<half, uint32_t>;

/**
* @brief Build the index from the dataset for efficient DiskANN search.
*
Expand Down Expand Up @@ -520,6 +531,12 @@ void serialize(raft::resources const& handle,
bool include_dataset = true,
bool sector_aligned = false);

void serialize(raft::resources const& handle,
const std::string& file_prefix,
const cuvs::neighbors::vamana::index<half, uint32_t>& index,
bool include_dataset = true,
bool sector_aligned = false);

/**
* Save the index to file.
*
Expand Down
Loading
Loading