14 #include "MathOperators.cuh"
15 #include "WarpShuffles.cuh"
17 namespace faiss {
namespace gpu {
20 template <
typename K,
typename V>
22 constexpr __device__
inline Pair() {
25 constexpr __device__
inline Pair(K key, V value)
29 __device__
inline bool
34 __device__
inline bool
36 return !operator==(rhs);
39 __device__
inline bool
40 operator<(const Pair<K, V>& rhs)
const {
45 __device__
inline bool
55 template <
typename T,
typename U>
58 int width = kWarpSize) {
59 return Pair<T, U>(shfl_up(pair.k, delta, width),
60 shfl_up(pair.v, delta, width));
63 template <
typename T,
typename U>
64 inline __device__ Pair<T, U> shfl_xor(
const Pair<T, U>& pair,
66 int width = kWarpSize) {
67 return Pair<T, U>(shfl_xor(pair.k, laneMask, width),
68 shfl_xor(pair.v, laneMask, width));
A simple pair type for CUDA device usage.