Skip to content

Commit

Permalink
resolve minor nits
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasyadav18 committed Jul 31, 2024
1 parent 6ca8195 commit 550f3c9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/cuco/detail/static_map/static_map.inl
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ template <typename InputIt, typename Init, typename Op>
void static_map<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>::
insert_or_apply(InputIt first, InputIt last, Init init, Op op, cuda::stream_ref stream)
{
return this->insert_or_apply_async(first, last, init, op, stream);
this->insert_or_apply_async(first, last, init, op, stream);
stream.wait();
}

Expand Down
5 changes: 3 additions & 2 deletions include/cuco/detail/static_map/static_map_ref.inl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#pragma once

#include <cuco/detail/bitwise_compare.cuh>
#include <cuco/detail/equal_wrapper.cuh>
#include <cuco/operator.hpp>

Expand Down Expand Up @@ -703,7 +704,7 @@ class operator_impl<
{
ref_type& ref_ = static_cast<ref_type&>(*this);
// if init equals sentinel value, then we can just `apply` op instead of write
if (init == ref_.empty_value_sentinel()) {
if (cuco::detail::bitwise_compare(init, ref_.empty_value_sentinel())) {
ref_.insert_or_apply_impl<true>(value, op);
} else {
ref_.insert_or_apply_impl<false>(value, op);
Expand Down Expand Up @@ -734,7 +735,7 @@ class operator_impl<
{
ref_type& ref_ = static_cast<ref_type&>(*this);
// if init equals sentinel value, then we can just `apply` op instead of write
if (init == ref_.empty_value_sentinel()) {
if (cuco::detail::bitwise_compare(init, ref_.empty_value_sentinel())) {
ref_.insert_or_apply_impl<true>(group, value, op);
} else {
ref_.insert_or_apply_impl<false>(group, value, op);
Expand Down
2 changes: 2 additions & 0 deletions include/cuco/utility/reduction_functors.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
#pragma once

#include <cuda/atomic>

namespace cuco::reduce {

/**
Expand Down
16 changes: 8 additions & 8 deletions tests/static_map/insert_or_apply_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,22 @@ TEMPLATE_TEST_CASE_SIG(
SECTION("sentinel equals init; has_init = true")
{
auto map = map_type{num_keys, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{0}};
test_insert_or_apply<true>(map, num_keys, num_unique_keys, Key(0));
test_insert_or_apply<true>(map, num_keys, num_unique_keys, static_cast<Value>(0));
}
SECTION("sentinel equals init; has_init = false")
{
auto map = map_type{num_keys, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{0}};
test_insert_or_apply<false>(map, num_keys, num_unique_keys, Key(0));
test_insert_or_apply<false>(map, num_keys, num_unique_keys, static_cast<Value>(0));
}
SECTION("sentinel not equals init; has_init = true")
{
auto map = map_type{num_keys, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{0}};
test_insert_or_apply<true>(map, num_keys, num_unique_keys, Key(-1));
test_insert_or_apply<true>(map, num_keys, num_unique_keys, static_cast<Value>(-1));
}
SECTION("sentinel not equals init; has_init = false")
{
auto map = map_type{num_keys, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{0}};
test_insert_or_apply<false>(map, num_keys, num_unique_keys, Key(-1));
test_insert_or_apply<false>(map, num_keys, num_unique_keys, static_cast<Value>(-1));
}
}

Expand All @@ -151,21 +151,21 @@ TEMPLATE_TEST_CASE_SIG(
SECTION("sentinel equals init; has_init = true")
{
auto map = map_type{num_keys, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{0}};
test_insert_or_apply<true>(map, num_keys, num_keys, Key(0));
test_insert_or_apply<true>(map, num_keys, num_keys, static_cast<Value>(0));
}
SECTION("sentinel equals init; has_init = false")
{
auto map = map_type{num_keys, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{0}};
test_insert_or_apply<false>(map, num_keys, num_keys, Key(0));
test_insert_or_apply<false>(map, num_keys, num_keys, static_cast<Value>(0));
}
SECTION("sentinel not equals init; has_init = true")
{
auto map = map_type{num_keys, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{0}};
test_insert_or_apply<true>(map, num_keys, num_keys, Key(-1));
test_insert_or_apply<true>(map, num_keys, num_keys, static_cast<Value>(-1));
}
SECTION("sentinel not equals init; has_init = false")
{
auto map = map_type{num_keys, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{0}};
test_insert_or_apply<false>(map, num_keys, num_keys, Key(-1));
test_insert_or_apply<false>(map, num_keys, num_keys, static_cast<Value>(-1));
}
}

0 comments on commit 550f3c9

Please sign in to comment.