Skip to content

Commit

Permalink
Expose storage_ref and probing_scheme in all container refs (#572)
Browse files Browse the repository at this point in the history
This PR exposes `storage_ref` and `probing_scheme` in all container
refs.

---------

Co-authored-by: Yunsong Wang <[email protected]>
  • Loading branch information
srinivasyadav18 and PointKernel authored Aug 7, 2024
1 parent d625fca commit 115656e
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 0 deletions.
28 changes: 28 additions & 0 deletions include/cuco/detail/static_map/static_map_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,34 @@ static_map_ref<Key, T, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>
return impl_.capacity();
}

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

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

template <typename Key,
typename T,
cuda::thread_scope Scope,
Expand Down
28 changes: 28 additions & 0 deletions include/cuco/detail/static_multimap/static_multimap_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,34 @@ static_multimap_ref<Key, T, Scope, KeyEqual, ProbingScheme, StorageRef, Operator
return impl_.capacity();
}

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

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

template <typename Key,
typename T,
cuda::thread_scope Scope,
Expand Down
26 changes: 26 additions & 0 deletions include/cuco/detail/static_multiset/static_multiset_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,32 @@ static_multiset_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators..
return impl_.capacity();
}

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

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

template <typename Key,
cuda::thread_scope Scope,
typename KeyEqual,
Expand Down
26 changes: 26 additions & 0 deletions include/cuco/detail/static_set/static_set_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,32 @@ static_set_ref<Key, Scope, KeyEqual, ProbingScheme, StorageRef, Operators...>::c
return impl_.capacity();
}

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

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

template <typename Key,
cuda::thread_scope Scope,
typename KeyEqual,
Expand Down
14 changes: 14 additions & 0 deletions include/cuco/static_map_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@ class static_map_ref
*/
[[nodiscard]] __host__ __device__ constexpr iterator end() noexcept;

/**
* @brief Gets the non-owning storage ref.
*
* @return The non-owning storage ref of the container
*/
[[nodiscard]] __host__ __device__ constexpr auto storage_ref() const noexcept;

/**
* @brief Gets the probing scheme.
*
* @return The probing scheme used for the container
*/
[[nodiscard]] __host__ __device__ constexpr auto probing_scheme() const noexcept;

/**
* @brief Creates a reference with new operators from the current object.
*
Expand Down
14 changes: 14 additions & 0 deletions include/cuco/static_multimap_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ class static_multimap_ref
*/
[[nodiscard]] __host__ __device__ constexpr iterator end() noexcept;

/**
* @brief Gets the non-owning storage ref.
*
* @return The non-owning storage ref of the container
*/
[[nodiscard]] __host__ __device__ constexpr auto storage_ref() const noexcept;

/**
* @brief Gets the probing scheme.
*
* @return The probing scheme used for the container
*/
[[nodiscard]] __host__ __device__ constexpr auto probing_scheme() const noexcept;

/**
* @brief Creates a reference with new operators from the current object.
*
Expand Down
14 changes: 14 additions & 0 deletions include/cuco/static_multiset_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,20 @@ class static_multiset_ref
*/
[[nodiscard]] __host__ __device__ constexpr iterator end() noexcept;

/**
* @brief Gets the non-owning storage ref.
*
* @return The non-owning storage ref of the container
*/
[[nodiscard]] __host__ __device__ constexpr auto storage_ref() const noexcept;

/**
* @brief Gets the probing scheme.
*
* @return The probing scheme used for the container
*/
[[nodiscard]] __host__ __device__ constexpr auto probing_scheme() const noexcept;

/**
* @brief Creates a reference with new operators from the current object.
*
Expand Down
14 changes: 14 additions & 0 deletions include/cuco/static_set_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,20 @@ class static_set_ref
*/
[[nodiscard]] __host__ __device__ constexpr iterator end() noexcept;

/**
* @brief Gets the non-owning storage ref.
*
* @return The non-owning storage ref of the container
*/
[[nodiscard]] __host__ __device__ constexpr auto storage_ref() const noexcept;

/**
* @brief Gets the probing scheme.
*
* @return The probing scheme used for the container
*/
[[nodiscard]] __host__ __device__ constexpr auto probing_scheme() const noexcept;

/**
* @brief Creates a reference with new operators from the current object.
*
Expand Down

0 comments on commit 115656e

Please sign in to comment.