13 #include "MathOperators.cuh"
14 #include "WarpShuffles.cuh"
16 namespace faiss {
namespace gpu {
19 template <
typename K,
typename V>
21 constexpr __device__
inline Pair() {
24 constexpr __device__
inline Pair(K key, V value)
28 __device__
inline bool
33 __device__
inline bool
35 return !operator==(rhs);
38 __device__
inline bool
39 operator<(const Pair<K, V>& rhs)
const {
44 __device__
inline bool
54 template <
typename T,
typename U>
57 int width = kWarpSize) {
58 return Pair<T, U>(shfl_up(pair.k, delta, width),
59 shfl_up(pair.v, delta, width));
62 template <
typename T,
typename U>
63 inline __device__ Pair<T, U> shfl_xor(
const Pair<T, U>& pair,
65 int width = kWarpSize) {
66 return Pair<T, U>(shfl_xor(pair.k, laneMask, width),
67 shfl_xor(pair.v, laneMask, width));
A simple pair type for CUDA device usage.