Skip to content

Commit

Permalink
Deprecate window in implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Dec 13, 2024
1 parent 0fa4911 commit 606b826
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 123 deletions.
6 changes: 0 additions & 6 deletions include/cuco/bucket_storage.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ namespace cuco {
template <typename T, int32_t BucketSize>
using bucket = detail::bucket<T, BucketSize>;

/// Alias for bucket
template <typename T, int32_t BucketSize>
using window = bucket<T, BucketSize>;

/**
* @brief Non-owning array of buckets storage reference type.
*
Expand All @@ -56,7 +52,6 @@ class bucket_storage_ref : public detail::bucket_storage_base<T, BucketSize, Ext
using size_type = typename base_type::size_type; ///< Storage size type
using value_type = typename base_type::value_type; ///< Slot type
using bucket_type = typename base_type::bucket_type; ///< Slot bucket type
using window_type = bucket_type; ///< Slot bucket type

using base_type::capacity;
using base_type::num_buckets;
Expand Down Expand Up @@ -147,7 +142,6 @@ class bucket_storage : public detail::bucket_storage_base<T, BucketSize, Extent>
using size_type = typename base_type::size_type; ///< Storage size type
using value_type = typename base_type::value_type; ///< Slot type
using bucket_type = typename base_type::bucket_type; ///< Slot bucket type
using window_type = bucket_type; ///< Slot bucket type

using base_type::capacity;
using base_type::num_buckets;
Expand Down
30 changes: 0 additions & 30 deletions include/cuco/detail/extent/extent.inl
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,12 @@ template <int32_t CGSize, int32_t BucketSize, typename SizeType, std::size_t N>
}
}

template <int32_t CGSize, int32_t BucketSize, typename SizeType, std::size_t N>
[[nodiscard]] auto constexpr make_window_extent(extent<SizeType, N> ext)
{
return make_bucket_extent<CGSize, BucketSize, SizeType, N>(ext);
}

template <int32_t CGSize, int32_t BucketSize, typename SizeType>
[[nodiscard]] auto constexpr make_bucket_extent(SizeType size)
{
return make_bucket_extent<CGSize, BucketSize, SizeType, dynamic_extent>(extent<SizeType>{size});
}

template <int32_t CGSize, int32_t BucketSize, typename SizeType>
[[nodiscard]] auto constexpr make_window_extent(SizeType size)
{
return make_bucket_extent<CGSize, BucketSize, SizeType, dynamic_extent>(extent<SizeType>{size});
}

template <typename ProbingScheme, typename Storage, typename SizeType, std::size_t N>
[[nodiscard]] auto constexpr make_bucket_extent(extent<SizeType, N> ext)
{
Expand Down Expand Up @@ -167,15 +155,6 @@ template <typename Container, typename SizeType, std::size_t N>
N>(ext);
}

template <typename Container, typename SizeType, std::size_t N>
[[nodiscard]] auto constexpr make_window_extent(extent<SizeType, N> ext)
{
return make_bucket_extent<typename Container::probing_scheme_type,
typename Container::storage_ref_type,
SizeType,
N>(ext);
}

template <typename Container, typename SizeType>
[[nodiscard]] auto constexpr make_bucket_extent(SizeType size)
{
Expand All @@ -185,15 +164,6 @@ template <typename Container, typename SizeType>
dynamic_extent>(extent<SizeType>{size});
}

template <typename Container, typename SizeType>
[[nodiscard]] auto constexpr make_window_extent(SizeType size)
{
return make_bucket_extent<typename Container::probing_scheme_type,
typename Container::storage_ref_type,
SizeType,
dynamic_extent>(extent<SizeType, dynamic_extent>{size});
}

namespace detail {

template <typename...>
Expand Down
76 changes: 0 additions & 76 deletions include/cuco/extent.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ struct extent<SizeType, dynamic_extent> {
template <typename SizeType, std::size_t N = dynamic_extent>
struct bucket_extent;

/// Alias for bucket_extent
template <typename SizeType, std::size_t N = dynamic_extent>
using window_extent = bucket_extent<SizeType, N>;

/**
* @brief Computes valid bucket extent based on given parameters.
*
Expand All @@ -112,25 +108,6 @@ using window_extent = bucket_extent<SizeType, N>;
template <int32_t CGSize, int32_t BucketSize, typename SizeType, std::size_t N>
[[nodiscard]] auto constexpr make_bucket_extent(extent<SizeType, N> ext);

/**
* @brief Computes valid bucket extent based on given parameters.
*
* @deprecated Use the equivalent `make_bucket_extent` instead.
*
* @tparam CGSize Number of elements handled per CG
* @tparam BucketSize Number of elements handled per Bucket
* @tparam SizeType Size type
* @tparam N Extent
*
* @param ext The input extent
*
* @throw If the input extent is invalid
*
* @return Resulting valid extent
*/
template <int32_t CGSize, int32_t BucketSize, typename SizeType, std::size_t N>
[[nodiscard]] auto constexpr make_window_extent(extent<SizeType, N> ext);

/**
* @brief Computes valid bucket extent/capacity based on given parameters.
*
Expand All @@ -153,24 +130,6 @@ template <int32_t CGSize, int32_t BucketSize, typename SizeType, std::size_t N>
template <int32_t CGSize, int32_t BucketSize, typename SizeType>
[[nodiscard]] auto constexpr make_bucket_extent(SizeType size);

/**
* @brief Computes valid bucket extent/capacity based on given parameters.
*
* @deprecated Use the equivalent `make_bucket_extent` instead.
*
* @tparam CGSize Number of elements handled per CG
* @tparam BucketSize Number of elements handled per Bucket
* @tparam SizeType Size type
*
* @param size The input size
*
* @throw If the input size is invalid
*
* @return Resulting valid extent
*/
template <int32_t CGSize, int32_t BucketSize, typename SizeType>
[[nodiscard]] auto constexpr make_window_extent(SizeType size);

template <typename ProbingScheme, typename Storage, typename SizeType, std::size_t N>
[[nodiscard]] auto constexpr make_bucket_extent(cuco::extent<SizeType, N> ext);

Expand Down Expand Up @@ -199,24 +158,6 @@ template <typename ProbingScheme, typename Storage, typename SizeType>
template <typename Container, typename SizeType, std::size_t N>
[[nodiscard]] auto constexpr make_bucket_extent(extent<SizeType, N> ext);

/**
* @brief Computes a valid bucket extent/capacity for a given container type.
*
* @deprecated Use the equivalent `make_bucket_extent` instead.
*
* @tparam Container Container type to compute the extent for
* @tparam SizeType Size type
* @tparam N Extent
*
* @param ext The input extent
*
* @throw If the input extent is invalid
*
* @return Resulting valid `bucket extent`
*/
template <typename Container, typename SizeType, std::size_t N>
[[nodiscard]] auto constexpr make_window_extent(extent<SizeType, N> ext);

/**
* @brief Computes a valid capacity for a given container type.
*
Expand All @@ -238,23 +179,6 @@ template <typename Container, typename SizeType, std::size_t N>
template <typename Container, typename SizeType>
[[nodiscard]] auto constexpr make_bucket_extent(SizeType size);

/**
* @brief Computes a valid capacity for a given container type.
*
* @deprecated Use the equivalent `make_bucket_extent` instead.
*
* @tparam Container Container type to compute the extent for
* @tparam SizeType Size type
*
* @param size The input size
*
* @throw If the input size is invalid
*
* @return Resulting valid extent
*/
template <typename Container, typename SizeType>
[[nodiscard]] auto constexpr make_window_extent(SizeType size);

} // namespace cuco

#include <cuco/detail/extent/extent.inl>
1 change: 0 additions & 1 deletion include/cuco/static_map_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class static_map_ref
using hasher = typename probing_scheme_type::hasher; ///< Hash function type
using storage_ref_type = StorageRef; ///< Type of storage ref
using bucket_type = typename storage_ref_type::bucket_type; ///< Bucket type
using window_type = bucket_type; ///< Bucket type
using value_type = typename storage_ref_type::value_type; ///< Storage element type
using extent_type = typename storage_ref_type::extent_type; ///< Extent type
using size_type = typename storage_ref_type::size_type; ///< Probing scheme size type
Expand Down
1 change: 0 additions & 1 deletion include/cuco/static_multimap_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class static_multimap_ref
using hasher = typename probing_scheme_type::hasher; ///< Hash function type
using storage_ref_type = StorageRef; ///< Type of storage ref
using bucket_type = typename storage_ref_type::bucket_type; ///< Bucket type
using window_type = bucket_type; ///< Bucket type
using value_type = typename storage_ref_type::value_type; ///< Storage element type
using extent_type = typename storage_ref_type::extent_type; ///< Extent type
using size_type = typename storage_ref_type::size_type; ///< Probing scheme size type
Expand Down
1 change: 0 additions & 1 deletion include/cuco/static_multiset_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class static_multiset_ref
using hasher = typename probing_scheme_type::hasher; ///< Hash function type
using storage_ref_type = StorageRef; ///< Type of storage ref
using bucket_type = typename storage_ref_type::bucket_type; ///< Bucket type
using window_type = bucket_type; ///< Bucket type
using value_type = typename storage_ref_type::value_type; ///< Storage element type
using extent_type = typename storage_ref_type::extent_type; ///< Extent type
using size_type = typename storage_ref_type::size_type; ///< Probing scheme size type
Expand Down
1 change: 0 additions & 1 deletion include/cuco/static_set_ref.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class static_set_ref
using hasher = typename probing_scheme_type::hasher; ///< Hash function type
using storage_ref_type = StorageRef; ///< Type of storage ref
using bucket_type = typename storage_ref_type::bucket_type; ///< Bucket type
using window_type = bucket_type; ///< Bucket type
using value_type = typename storage_ref_type::value_type; ///< Storage element type
using extent_type = typename storage_ref_type::extent_type; ///< Extent type
using size_type = typename storage_ref_type::size_type; ///< Probing scheme size type
Expand Down
4 changes: 2 additions & 2 deletions tests/static_map/insert_or_apply_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void test_insert_or_apply_shmem(Map& map, size_type num_keys, size_type num_uniq
cuco::storage<1>>;

using shared_map_ref_type = typename shared_map_type::ref_type<>;
auto constexpr window_extent = cuco::make_window_extent<shared_map_ref_type>(extent_type{});
auto constexpr bucket_extent = cuco::make_bucket_extent<shared_map_ref_type>(extent_type{});

// Insert pairs
auto pairs_begin = thrust::make_transform_iterator(
Expand All @@ -122,7 +122,7 @@ void test_insert_or_apply_shmem(Map& map, size_type num_keys, size_type num_uniq
init,
cuco::reduce::plus{},
map.ref(cuco::op::insert_or_apply),
window_extent);
bucket_extent);

REQUIRE(map.size() == num_unique_keys);

Expand Down
6 changes: 3 additions & 3 deletions tests/utility/extent_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TEMPLATE_TEST_CASE_SIG(
SizeType constexpr num = 1234;
SizeType constexpr gold_reference = 314; // 157 x 2
auto constexpr cg_size = 2;
auto constexpr window_size = 4;
auto constexpr bucket_size = 4;

SECTION("Static extent must be evaluated at compile time.")
{
Expand All @@ -43,14 +43,14 @@ TEMPLATE_TEST_CASE_SIG(
SECTION("Compute static valid extent at compile time.")
{
auto constexpr size = cuco::extent<SizeType, num>{};
auto constexpr res = cuco::make_window_extent<cg_size, window_size>(size);
auto constexpr res = cuco::make_bucket_extent<cg_size, bucket_size>(size);
STATIC_REQUIRE(gold_reference == res.value());
}

SECTION("Compute dynamic valid extent at run time.")
{
auto const size = cuco::extent<SizeType>{num};
auto const res = cuco::make_window_extent<cg_size, window_size>(size);
auto const res = cuco::make_bucket_extent<cg_size, bucket_size>(size);
REQUIRE(gold_reference == res.value());
}
}
4 changes: 2 additions & 2 deletions tests/utility/probing_scheme_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ __global__ void generate_cg_probing_sequence(Key key,
TEMPLATE_TEST_CASE_SIG(
"utility probing_scheme tests",
"",
((typename Key, cuco::test::probe_sequence Probe, int32_t WindowSize), Key, Probe, WindowSize),
((typename Key, cuco::test::probe_sequence Probe, int32_t BucketSize), Key, Probe, BucketSize),
(int32_t, cuco::test::probe_sequence::double_hashing, 1),
(int32_t, cuco::test::probe_sequence::double_hashing, 2),
(int64_t, cuco::test::probe_sequence::double_hashing, 1),
Expand All @@ -89,7 +89,7 @@ TEMPLATE_TEST_CASE_SIG(
(int64_t, cuco::test::probe_sequence::linear_probing, 1),
(int64_t, cuco::test::probe_sequence::linear_probing, 2))
{
auto const upper_bound = cuco::make_window_extent<1, WindowSize>(cuco::extent<std::size_t>{10});
auto const upper_bound = cuco::make_bucket_extent<1, BucketSize>(cuco::extent<std::size_t>{10});
constexpr size_t seq_length{8};
constexpr Key key{42};

Expand Down

0 comments on commit 606b826

Please sign in to comment.