Skip to content

Commit 20e0712

Browse files
committed
Expose pointer to underlying storage
1 parent 4e642f8 commit 20e0712

File tree

9 files changed

+91
-2
lines changed

9 files changed

+91
-2
lines changed

include/cuco/detail/open_addressing/open_addressing_impl.cuh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,13 @@ class open_addressing_impl {
10861086
*/
10871087
[[nodiscard]] constexpr auto capacity() const noexcept { return storage_.capacity(); }
10881088

1089+
/**
1090+
* @brief Gets a pointer to the underlying slot storage.
1091+
*
1092+
* @return Pointer to the underlying slot storage
1093+
*/
1094+
[[nodiscard]] __host__ value_type* data() const { return storage_.data(); }
1095+
10891096
/**
10901097
* @brief Gets the sentinel value used to represent an empty key slot.
10911098
*

include/cuco/detail/static_map/static_map.inl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,20 @@ static_map<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::
798798
return impl_->capacity();
799799
}
800800

801+
template <class Key,
802+
class T,
803+
class Extent,
804+
cuda::thread_scope Scope,
805+
class KeyEqual,
806+
class ProbingScheme,
807+
class Allocator,
808+
class Storage>
809+
__host__ auto static_map<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::data()
810+
const -> value_type*
811+
{
812+
return impl_->data();
813+
}
814+
801815
template <class Key,
802816
class T,
803817
class Extent,

include/cuco/detail/static_multimap/static_multimap.inl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,21 @@ static_multimap<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Stora
618618
return impl_->capacity();
619619
}
620620

621+
template <class Key,
622+
class T,
623+
class Extent,
624+
cuda::thread_scope Scope,
625+
class KeyEqual,
626+
class ProbingScheme,
627+
class Allocator,
628+
class Storage>
629+
__host__ auto
630+
static_multimap<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::data() const
631+
-> value_type*
632+
{
633+
return impl_->data();
634+
}
635+
621636
template <class Key,
622637
class T,
623638
class Extent,

include/cuco/detail/static_multiset/static_multiset.inl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,20 @@ static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>
657657
return impl_->capacity();
658658
}
659659

660+
template <class Key,
661+
class Extent,
662+
cuda::thread_scope Scope,
663+
class KeyEqual,
664+
class ProbingScheme,
665+
class Allocator,
666+
class Storage>
667+
__host__ auto
668+
static_multiset<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::data() const
669+
-> value_type*
670+
{
671+
return impl_->data();
672+
}
673+
660674
template <class Key,
661675
class Extent,
662676
cuda::thread_scope Scope,

include/cuco/detail/static_set/static_set.inl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,19 @@ static_set<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::cap
621621
return impl_->capacity();
622622
}
623623

624+
template <class Key,
625+
class Extent,
626+
cuda::thread_scope Scope,
627+
class KeyEqual,
628+
class ProbingScheme,
629+
class Allocator,
630+
class Storage>
631+
__host__ auto static_set<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::data()
632+
const -> value_type*
633+
{
634+
return impl_->data();
635+
}
636+
624637
template <class Key,
625638
class Extent,
626639
cuda::thread_scope Scope,

include/cuco/static_map.cuh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,13 @@ class static_map {
11161116
*/
11171117
[[nodiscard]] constexpr auto capacity() const noexcept;
11181118

1119+
/**
1120+
* @brief Gets a pointer to the underlying slot storage.
1121+
*
1122+
* @return Pointer to the underlying slot storage
1123+
*/
1124+
[[nodiscard]] __host__ value_type* data() const;
1125+
11191126
/**
11201127
* @brief Gets the sentinel value used to represent an empty key slot.
11211128
*

include/cuco/static_multimap.cuh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,13 @@ class static_multimap {
863863
*/
864864
[[nodiscard]] constexpr auto capacity() const noexcept;
865865

866+
/**
867+
* @brief Gets a pointer to the underlying slot storage.
868+
*
869+
* @return Pointer to the underlying slot storage
870+
*/
871+
[[nodiscard]] __host__ value_type* data() const;
872+
866873
/**
867874
* @brief Gets the sentinel value used to represent an empty key slot.
868875
*

include/cuco/static_multiset.cuh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class static_multiset {
101101
using storage_ref_type = typename impl_type::storage_ref_type;
102102
using probing_scheme_type = typename impl_type::probing_scheme_type; ///< Probing scheme type
103103
using hasher = typename probing_scheme_type::hasher; ///< Hash function type
104-
105104
template <typename... Operators>
106105
using ref_type = cuco::static_multiset_ref<key_type,
107106
thread_scope,
@@ -962,6 +961,13 @@ class static_multiset {
962961
*/
963962
[[nodiscard]] constexpr auto capacity() const noexcept;
964963

964+
/**
965+
* @brief Gets a pointer to the underlying slot storage.
966+
*
967+
* @return Pointer to the underlying slot storage
968+
*/
969+
[[nodiscard]] __host__ value_type* data() const;
970+
965971
/**
966972
* @brief Gets the sentinel value used to represent an empty key slot.
967973
*

include/cuco/static_set.cuh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class static_set {
106106
using storage_ref_type = typename impl_type::storage_ref_type;
107107
using probing_scheme_type = typename impl_type::probing_scheme_type; ///< Probing scheme type
108108
using hasher = typename probing_scheme_type::hasher; ///< Hash function type
109-
110109
template <typename... Operators>
111110
using ref_type = cuco::static_set_ref<key_type,
112111
thread_scope,
@@ -934,6 +933,13 @@ class static_set {
934933
*/
935934
[[nodiscard]] constexpr auto capacity() const noexcept;
936935

936+
/**
937+
* @brief Gets a pointer to the underlying slot storage.
938+
*
939+
* @return Pointer to the underlying slot storage
940+
*/
941+
[[nodiscard]] __host__ value_type* data() const;
942+
937943
/**
938944
* @brief Gets the sentinel value used to represent an empty key slot.
939945
*

0 commit comments

Comments
 (0)