Skip to content

Commit

Permalink
More namespace qualifying.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjnolet committed Nov 21, 2023
1 parent 80e874b commit 0453e13
Show file tree
Hide file tree
Showing 22 changed files with 123 additions and 114 deletions.
4 changes: 3 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ if(BUILD_MICRO_BENCH OR BUILD_ANN_BENCH)
rapids_cpm_gbench()
endif()

include(cmake/thirdparty/get_cutlass.cmake)

# ##################################################################################################
# * cuvs ---------------------------------------------------------------------

Expand Down Expand Up @@ -368,7 +370,7 @@ target_include_directories(

if(NOT BUILD_CPU_ONLY)
# Keep cuVS as lightweight as possible. Only CUDA libs and rmm should be used in global target.
target_link_libraries(cuvs PUBLIC raft::raft)
target_link_libraries(cuvs PUBLIC raft::raft nvidia::cutlass::cutlass)
endif()

# Endian detection
Expand Down
10 changes: 5 additions & 5 deletions cpp/cmake/thirdparty/get_cutlass.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function(find_and_configure_cutlass)
CACHE BOOL "Enable only the header library"
)
set(CUTLASS_NAMESPACE
"raft_cutlass"
"cuvs_cutlass"
CACHE STRING "Top level namespace of CUTLASS"
)
set(CUTLASS_ENABLE_CUBLAS
Expand Down Expand Up @@ -61,21 +61,21 @@ function(find_and_configure_cutlass)
# We generate the cutlass-config files when we built cutlass locally, so always do
# `find_dependency`
rapids_export_package(
BUILD NvidiaCutlass raft-exports GLOBAL_TARGETS nvidia::cutlass::cutlass
BUILD NvidiaCutlass cuvs-exports GLOBAL_TARGETS nvidia::cutlass::cutlass
)
rapids_export_package(
INSTALL NvidiaCutlass raft-exports GLOBAL_TARGETS nvidia::cutlass::cutlass
INSTALL NvidiaCutlass cuvs-exports GLOBAL_TARGETS nvidia::cutlass::cutlass
)

# Tell cmake where it can find the generated NvidiaCutlass-config.cmake we wrote.
include("${rapids-cmake-dir}/export/find_package_root.cmake")
rapids_export_find_package_root(
INSTALL NvidiaCutlass [=[${CMAKE_CURRENT_LIST_DIR}/../]=]
EXPORT_SET raft-exports
EXPORT_SET cuvs-exports
)
rapids_export_find_package_root(
BUILD NvidiaCutlass [=[${CMAKE_CURRENT_LIST_DIR}]=]
EXPORT_SET raft-exports
EXPORT_SET cuvs-exports
)
endfunction()

Expand Down
8 changes: 4 additions & 4 deletions cpp/cmake/thirdparty/get_faiss.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ function(find_and_configure_faiss)
endif()

# We generate the faiss-config files when we built faiss locally, so always do `find_dependency`
rapids_export_package(BUILD OpenMP raft-ann-bench-exports) # faiss uses openMP but doesn't export a need for it
rapids_export_package(BUILD faiss raft-ann-bench-exports GLOBAL_TARGETS ${RAFT_FAISS_GLOBAL_TARGETS} ${RAFT_FAISS_EXPORT_GLOBAL_TARGETS})
rapids_export_package(INSTALL faiss raft-ann-bench-exports GLOBAL_TARGETS ${RAFT_FAISS_GLOBAL_TARGETS} ${RAFT_FAISS_EXPORT_GLOBAL_TARGETS})
rapids_export_package(BUILD OpenMP cuvs-ann-bench-exports) # faiss uses openMP but doesn't export a need for it
rapids_export_package(BUILD faiss cuvs-ann-bench-exports GLOBAL_TARGETS ${RAFT_FAISS_GLOBAL_TARGETS} ${RAFT_FAISS_EXPORT_GLOBAL_TARGETS})
rapids_export_package(INSTALL faiss cuvs-ann-bench-exports GLOBAL_TARGETS ${RAFT_FAISS_GLOBAL_TARGETS} ${RAFT_FAISS_EXPORT_GLOBAL_TARGETS})

# Tell cmake where it can find the generated faiss-config.cmake we wrote.
include("${rapids-cmake-dir}/export/find_package_root.cmake")
rapids_export_find_package_root(BUILD faiss [=[${CMAKE_CURRENT_LIST_DIR}]=]
EXPORT_SET raft-ann-bench-exports)
EXPORT_SET cuvs-ann-bench-exports)
endfunction()

if(NOT RAFT_FAISS_GIT_TAG)
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/get_ggnn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ endfunction()

# Change pinned tag here to test a commit in CI
# To use a different RAFT locally, set the CMake variable
# CPM_raft_SOURCE=/path/to/local/raft
# CPM_cuvs_SOURCE=/path/to/local/cuvs
find_and_configure_ggnn(VERSION 0.5
FORK cgtuebingen
PINNED_TAG release_0.5
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_glog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ function(find_and_configure_glog)

rapids_cpm_find(glog ${PKG_VERSION}
GLOBAL_TARGETS glog::glog
BUILD_EXPORT_SET raft-exports
INSTALL_EXPORT_SET raft-exports
BUILD_EXPORT_SET cuvs-exports
INSTALL_EXPORT_SET cuvs-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/${PKG_FORK}/glog.git
GIT_TAG ${PKG_PINNED_TAG}
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmake/thirdparty/get_hnswlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ endfunction()

# Change pinned tag here to test a commit in CI
# To use a different RAFT locally, set the CMake variable
# CPM_raft_SOURCE=/path/to/local/raft
# CPM_cuvs_SOURCE=/path/to/local/cuvs
find_and_configure_hnswlib(VERSION 0.6.2
FORK nmslib
PINNED_TAG v0.6.2
Expand Down
6 changes: 3 additions & 3 deletions cpp/cmake/thirdparty/get_nlohmann_json.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ function(find_and_configure_nlohmann_json)

rapids_cpm_find(nlohmann_json ${PKG_VERSION}
GLOBAL_TARGETS nlohmann_json::nlohmann_json
BUILD_EXPORT_SET raft-bench-ann-exports
INSTALL_EXPORT_SET raft-bench-ann-exports
BUILD_EXPORT_SET cuvs-bench-exports
INSTALL_EXPORT_SET cuvs-bench-exports
CPM_ARGS
GIT_REPOSITORY https://github.com/${PKG_FORK}/json.git
GIT_TAG ${PKG_PINNED_TAG}
Expand All @@ -32,7 +32,7 @@ endfunction()

# Change pinned tag here to test a commit in CI
# To use a different RAFT locally, set the CMake variable
# CPM_raft_SOURCE=/path/to/local/raft
# CPM_cuvs_SOURCE=/path/to/local/cuvs
find_and_configure_nlohmann_json(VERSION 3.11.2
FORK nlohmann
PINNED_TAG v3.11.2
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_raft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function(find_and_configure_raft)
#-----------------------------------------------------
rapids_cpm_find(raft ${PKG_VERSION}
GLOBAL_TARGETS raft::raft
BUILD_EXPORT_SET raft-template-exports
INSTALL_EXPORT_SET raft-template-exports
BUILD_EXPORT_SET cuvs-template-exports
INSTALL_EXPORT_SET cuvs-template-exports
COMPONENTS ${RAFT_COMPONENTS}
CPM_ARGS
GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git
Expand Down
4 changes: 2 additions & 2 deletions cpp/cmake/thirdparty/get_rmm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

function(find_and_configure_rmm)
include(${rapids-cmake-dir}/cpm/rmm.cmake)
rapids_cpm_rmm(BUILD_EXPORT_SET raft-exports
INSTALL_EXPORT_SET raft-exports)
rapids_cpm_rmm(BUILD_EXPORT_SET cuvs-exports
INSTALL_EXPORT_SET cuvs-exports)
endfunction()

find_and_configure_rmm()
6 changes: 3 additions & 3 deletions cpp/cmake/thirdparty/get_thrust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
function(find_and_configure_thrust)
include(${rapids-cmake-dir}/cpm/thrust.cmake)

rapids_cpm_thrust( NAMESPACE raft
BUILD_EXPORT_SET raft-exports
INSTALL_EXPORT_SET raft-exports)
rapids_cpm_thrust( NAMESPACE cuvs
BUILD_EXPORT_SET cuvs-exports
INSTALL_EXPORT_SET cuvs-exports)
endfunction()

find_and_configure_thrust()
4 changes: 2 additions & 2 deletions cpp/include/cuvs/distance/distance-inl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ void distance(raft::resources const& handle,
RAFT_EXPECTS(x.is_exhaustive(), "Input x must be contiguous.");
RAFT_EXPECTS(y.is_exhaustive(), "Input y must be contiguous.");

constexpr auto is_rowmajor = std::is_same_v<layout, layout_c_contiguous>;
constexpr auto is_rowmajor = std::is_same_v<layout, raft::layout_c_contiguous>;

distance<DistT, DataT, AccT, OutT, IdxT>(handle,
x.data_handle(),
Expand Down Expand Up @@ -454,7 +454,7 @@ void pairwise_distance(raft::resources const& handle,
RAFT_EXPECTS(y.is_exhaustive(), "Input y must be contiguous.");
RAFT_EXPECTS(dist.is_exhaustive(), "Output must be contiguous.");

constexpr auto rowmajor = std::is_same_v<layout, layout_c_contiguous>;
constexpr auto rowmajor = std::is_same_v<layout, raft::layout_c_contiguous>;

auto stream = raft::resource::get_cuda_stream(handle);
rmm::device_uvector<char> workspace(0, stream);
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cuvs/neighbors/brute_force-inl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ index<T> build(
{
// certain distance metrics can benefit by pre-calculating the norms for the index dataset
// which lets us avoid calculating these at query time
std::optional<device_vector<T, int64_t>> norms;
std::optional<raft::device_vector<T, int64_t>> norms;
if (metric == cuvs::distance::DistanceType::L2Expanded ||
metric == cuvs::distance::DistanceType::L2SqrtExpanded ||
metric == cuvs::distance::DistanceType::CosineExpanded) {
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/cuvs/neighbors/brute_force_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct index : ann::index {
{
if (norms_) { norms_view_ = raft::make_const_mdspan(norms_.value().view()); }
update_dataset(res, dataset);
resource::sync_stream(res);
raft::resource::sync_stream(res);
}

/** Construct a brute force index from dataset
Expand All @@ -121,7 +121,7 @@ struct index : ann::index {
T metric_arg = 0.0)
: ann::index(),
metric_(metric),
dataset_(make_device_matrix<T, int64_t>(res, 0, 0)),
dataset_(raft::make_device_matrix<T, int64_t>(res, 0, 0)),
dataset_view_(dataset_view),
norms_view_(norms_view),
metric_arg_(metric_arg)
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cuvs/neighbors/detail/cagra/search_plan.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct search_plan_impl : public search_plan_impl_base {
uint32_t topk)
: search_plan_impl_base(params, dim, graph_degree, topk),
hashmap(0, raft::resource::get_cuda_stream(res)),
num_executed_iterations(0, resource::get_cuda_stream(res)),
num_executed_iterations(0, raft::resource::get_cuda_stream(res)),
dev_seed(0, raft::resource::get_cuda_stream(res)),
num_seeds(0)
{
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/cuvs/neighbors/detail/faiss_select/Select.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ struct BlockSelect {
warpSortAnyRegisters<K, V, NumThreadQ, !Dir, Comp>(threadK, threadV);

constexpr int kNumWarpQRegisters = NumWarpQ / raft::WarpSize;
K raft::warpKRegisters[kNumWarpQRegisters];
K warpKRegisters[kNumWarpQRegisters];
V warpVRegisters[kNumWarpQRegisters];

#pragma unroll
Expand All @@ -200,18 +200,18 @@ struct BlockSelect {
warpVRegisters[i] = warpV[i * raft::WarpSize + laneId];
}

warpFence();
raft::warpFence();

// The warp queue is already sorted, and now that we've sorted the
// per-thread queue, merge both sorted lists together, producing
// one sorted list
warpMergeAnyRegisters<K, V, kNumWarpQRegisters, NumThreadQ, !Dir, Comp, false>(
raft::warpKRegisters, warpVRegisters, threadK, threadV);
warpKRegisters, warpVRegisters, threadK, threadV);

// Write back out the warp queue
#pragma unroll
for (int i = 0; i < kNumWarpQRegisters; ++i) {
warpK[i * raft::WarpSize + laneId] = raft::warpKRegisters[i];
warpK[i * raft::WarpSize + laneId] = warpKRegisters[i];
warpV[i * raft::WarpSize + laneId] = warpVRegisters[i];
}

Expand Down
Loading

0 comments on commit 0453e13

Please sign in to comment.