Skip to content

Commit

Permalink
Apply sentinel namespace to static_multimap
Browse files Browse the repository at this point in the history
  • Loading branch information
m3g4d1v3r committed May 26, 2022
1 parent 9d2e198 commit 360d8af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions include/cuco/detail/static_multimap/static_multimap.inl
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ template <typename Key,
class ProbeSequence>
static_multimap<Key, Value, Scope, Allocator, ProbeSequence>::static_multimap(
std::size_t capacity,
Key empty_key_sentinel,
Value empty_value_sentinel,
sentinel::empty_key<Key> empty_key_sentinel,
sentinel::empty_value<Value> empty_value_sentinel,
cudaStream_t stream,
Allocator const& alloc)
: capacity_{cuco::detail::get_valid_capacity<cg_size(), vector_width(), uses_vector_load()>(
capacity)},
empty_key_sentinel_{empty_key_sentinel},
empty_value_sentinel_{empty_value_sentinel},
empty_key_sentinel_{empty_key_sentinel.value},
empty_value_sentinel_{empty_value_sentinel.value},
counter_allocator_{alloc},
slot_allocator_{alloc},
delete_counter_{counter_allocator_},
Expand All @@ -53,7 +53,7 @@ static_multimap<Key, Value, Scope, Allocator, ProbeSequence>::static_multimap(
auto const grid_size = (get_capacity() + stride * block_size - 1) / (stride * block_size);

detail::initialize<atomic_key_type, atomic_mapped_type><<<grid_size, block_size, 0, stream>>>(
slots_.get(), empty_key_sentinel, empty_value_sentinel, get_capacity());
slots_.get(), empty_key_sentinel_, empty_value_sentinel_, get_capacity());
}

template <typename Key,
Expand Down
19 changes: 10 additions & 9 deletions include/cuco/static_multimap.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <cuco/detail/prime.hpp>
#include <cuco/detail/static_multimap/kernels.cuh>
#include <cuco/probe_sequences.cuh>
#include <cuco/sentinel.cuh>
#include <cuco/traits.hpp>

#include <thrust/functional.h>
Expand Down Expand Up @@ -223,8 +224,8 @@ class static_multimap {
* @param alloc Allocator used for allocating device storage
*/
static_multimap(std::size_t capacity,
Key empty_key_sentinel,
Value empty_value_sentinel,
sentinel::empty_key<Key> empty_key_sentinel,
sentinel::empty_value<Value> empty_value_sentinel,
cudaStream_t stream = 0,
Allocator const& alloc = Allocator{});

Expand Down Expand Up @@ -576,9 +577,9 @@ class static_multimap {

__host__ __device__ device_view_base(pair_atomic_type* slots,
std::size_t capacity,
Key empty_key_sentinel,
Value empty_value_sentinel) noexcept
: impl_{slots, capacity, empty_key_sentinel, empty_value_sentinel}
sentinel::empty_key<Key> empty_key_sentinel,
sentinel::empty_value<Value> empty_value_sentinel) noexcept
: impl_{slots, capacity, empty_key_sentinel.value, empty_value_sentinel.value}
{
}

Expand Down Expand Up @@ -677,8 +678,8 @@ class static_multimap {
*/
__host__ __device__ device_mutable_view(pair_atomic_type* slots,
std::size_t capacity,
Key empty_key_sentinel,
Value empty_value_sentinel) noexcept
sentinel::empty_key<Key> empty_key_sentinel,
sentinel::empty_value<Value> empty_value_sentinel) noexcept
: view_base_type{slots, capacity, empty_key_sentinel, empty_value_sentinel}
{
}
Expand Down Expand Up @@ -728,8 +729,8 @@ class static_multimap {
*/
__host__ __device__ device_view(pair_atomic_type* slots,
std::size_t capacity,
Key empty_key_sentinel,
Value empty_value_sentinel) noexcept
sentinel::empty_key<Key> empty_key_sentinel,
sentinel::empty_value<Value> empty_value_sentinel) noexcept
: view_base_type{slots, capacity, empty_key_sentinel, empty_value_sentinel}
{
}
Expand Down

0 comments on commit 360d8af

Please sign in to comment.