12 #include "MathOperators.cuh"
13 #include "WarpShuffles.cuh"
15 namespace faiss {
namespace gpu {
18 template <
typename K,
typename V>
20 constexpr __device__
inline Pair() {
23 constexpr __device__
inline Pair(K key, V value)
27 __device__
inline bool
32 __device__
inline bool
34 return !operator==(rhs);
37 __device__
inline bool
38 operator<(const Pair<K, V>& rhs)
const {
43 __device__
inline bool
53 template <
typename T,
typename U>
56 int width = kWarpSize) {
57 return Pair<T, U>(shfl_up(pair.k, delta, width),
58 shfl_up(pair.v, delta, width));
61 template <
typename T,
typename U>
62 inline __device__ Pair<T, U> shfl_xor(
const Pair<T, U>& pair,
64 int width = kWarpSize) {
65 return Pair<T, U>(shfl_xor(pair.k, laneMask, width),
66 shfl_xor(pair.v, laneMask, width));
A simple pair type for CUDA device usage.