forked from rapidsai/raft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove faiss dependency from fused_l2_knn.cuh, selection_faiss.cuh, b…
…all_cover.cuh and haversine_distance.cuh (rapidsai#1108) Remove the dependency on faiss from the fused_l2_knn.cuh, selection_faiss.cuh, ball_cover.cuh and haversine_distance.cuh headers. This takes a copy of the faiss BlockSelect/WarpSelect device code for top-k selection, and updates to use raft primitives for things like reductions, KeyValuePair, warp shuffling etc. Authors: - Ben Frederickson (https://github.com/benfred) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Corey J. Nolet (https://github.com/cjnolet) - Ray Douglass (https://github.com/raydouglass) URL: rapidsai#1108
- Loading branch information
Showing
16 changed files
with
1,216 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
cpp/include/raft/spatial/knn/detail/faiss_select/Comparators.cuh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file thirdparty/LICENSES/LICENSE.faiss | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <cuda.h> | ||
#include <cuda_fp16.h> | ||
|
||
namespace raft::spatial::knn::detail::faiss_select { | ||
|
||
template <typename T> | ||
struct Comparator { | ||
__device__ static inline bool lt(T a, T b) { return a < b; } | ||
|
||
__device__ static inline bool gt(T a, T b) { return a > b; } | ||
}; | ||
|
||
template <> | ||
struct Comparator<half> { | ||
__device__ static inline bool lt(half a, half b) { return __hlt(a, b); } | ||
|
||
__device__ static inline bool gt(half a, half b) { return __hgt(a, b); } | ||
}; | ||
|
||
} // namespace raft::spatial::knn::detail::faiss_select |
Oops, something went wrong.