15 #include "MathOperators.cuh"
16 #include "WarpShuffles.cuh"
18 namespace faiss {
namespace gpu {
21 template <
typename K,
typename V>
23 constexpr __device__
inline Pair() {
26 constexpr __device__
inline Pair(K key, V value)
30 __device__
inline bool
35 __device__
inline bool
37 return !operator==(rhs);
40 __device__
inline bool
41 operator<(const Pair<K, V>& rhs)
const {
46 __device__
inline bool
56 template <
typename T,
typename U>
59 int width = kWarpSize) {
60 return Pair<T, U>(shfl_up(pair.k, delta, width),
61 shfl_up(pair.v, delta, width));
64 template <
typename T,
typename U>
65 inline __device__ Pair<T, U> shfl_xor(
const Pair<T, U>& pair,
67 int width = kWarpSize) {
68 return Pair<T, U>(shfl_xor(pair.k, laneMask, width),
69 shfl_xor(pair.v, laneMask, width));
A simple pair type for CUDA device usage.