29 #ifndef HIPCUB_ROCPRIM_THREAD_SORT_HPP_
30 #define HIPCUB_ROCPRIM_THREAD_SORT_HPP_
32 #include "../../../config.hpp"
34 #include "../util_ptx.hpp"
35 #include "../util_type.hpp"
37 #include <rocprim/functional.hpp>
39 BEGIN_HIPCUB_NAMESPACE
43 HIPCUB_DEVICE __forceinline__
void Swap(T &lhs, T &rhs)
80 template <
typename KeyT,
84 HIPCUB_DEVICE __forceinline__
void
85 StableOddEvenSort(KeyT (&keys)[ITEMS_PER_THREAD],
86 ValueT (&items)[ITEMS_PER_THREAD],
89 constexpr
bool KEYS_ONLY = ::rocprim::Equals<ValueT, NullType>::VALUE;
92 for (
int i = 0; i < ITEMS_PER_THREAD; ++i)
95 for (
int j = 1 & i; j < ITEMS_PER_THREAD - 1; j += 2)
97 if (compare_op(keys[j + 1], keys[j]))
99 Swap(keys[j], keys[j + 1]);
102 Swap(items[j], items[j + 1]);