Skip to content

Commit

Permalink
Expose hash_function in static_multiset classes
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Aug 25, 2024
1 parent bd06155 commit 942ef5f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/cuco/detail/static_multiset/static_multiset.inl
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,20 @@ constexpr static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator
return impl_->key_eq();
}

template <class Key,
class Extent,
cuda::thread_scope Scope,
class KeyEqual,
class ProbingScheme,
class Allocator,
class Storage>
constexpr static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::hasher
static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::hash_function()
const noexcept
{
return impl_->hash_function();
}

template <class Key,
class Extent,
cuda::thread_scope Scope,
Expand Down
18 changes: 18 additions & 0 deletions include/cuco/detail/static_multiset/static_multiset_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ static_multiset_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators..
return this->impl_.key_eq();
}

template <typename Key,
cuda::thread_scope Scope,
typename KeyEqual,
typename ProbingScheme,
typename StorageRef,
typename... Operators>
__host__ __device__ constexpr static_multiset_ref<Key,
Scope,
KeyEqual,
ProbingScheme,
StorageRef,
Operators...>::hasher
static_multiset_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::hash_function()
const noexcept
{
return this->impl_.hash_function();
}

template <typename Key,
cuda::thread_scope Scope,
typename KeyEqual,
Expand Down
8 changes: 8 additions & 0 deletions include/cuco/static_multiset.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class static_multiset {
/// Non-owning window storage ref type
using storage_ref_type = typename impl_type::storage_ref_type;
using probing_scheme_type = typename impl_type::probing_scheme_type; ///< Probing scheme type
using hasher = typename probing_scheme_type::hasher; ///< Hash function type

template <typename... Operators>
using ref_type = cuco::static_multiset_ref<key_type,
Expand Down Expand Up @@ -577,6 +578,13 @@ class static_multiset {
*/
[[nodiscard]] constexpr key_equal key_eq() const noexcept;

/**
* @brief Gets the function(s) used to hash keys
*
* @return The function(s) used to hash keys
*/
[[nodiscard]] constexpr hasher hash_function() const noexcept;

/**
* @brief Get device ref with operators.
*
Expand Down
8 changes: 8 additions & 0 deletions include/cuco/static_multiset_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class static_multiset_ref
public:
using key_type = Key; ///< Key Type
using probing_scheme_type = ProbingScheme; ///< Type of probing scheme
using hasher = typename probing_scheme_type::hasher; ///< Hash function type
using storage_ref_type = StorageRef; ///< Type of storage ref
using window_type = typename storage_ref_type::window_type; ///< Window type
using value_type = typename storage_ref_type::value_type; ///< Storage element type
Expand Down Expand Up @@ -169,6 +170,13 @@ class static_multiset_ref
*/
[[nodiscard]] __host__ __device__ constexpr key_equal key_eq() const noexcept;

/**
* @brief Gets the function(s) used to hash keys
*
* @return The function(s) used to hash keys
*/
[[nodiscard]] __host__ __device__ constexpr hasher hash_function() const noexcept;

/**
* @brief Returns a const_iterator to one past the last slot.
*
Expand Down

0 comments on commit 942ef5f

Please sign in to comment.