From 550f3c91917ddda1b1fba55b5f6206153092c1d3 Mon Sep 17 00:00:00 2001 From: Srinivas Yadav Singanaboina Date: Wed, 31 Jul 2024 21:33:31 +0000 Subject: [PATCH] resolve minor nits --- include/cuco/detail/static_map/static_map.inl | 2 +- .../cuco/detail/static_map/static_map_ref.inl | 5 +++-- include/cuco/utility/reduction_functors.cuh | 2 ++ tests/static_map/insert_or_apply_test.cu | 16 ++++++++-------- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/include/cuco/detail/static_map/static_map.inl b/include/cuco/detail/static_map/static_map.inl index d577a35ad..3f9ec4fc7 100644 --- a/include/cuco/detail/static_map/static_map.inl +++ b/include/cuco/detail/static_map/static_map.inl @@ -315,7 +315,7 @@ template void static_map:: 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(); } diff --git a/include/cuco/detail/static_map/static_map_ref.inl b/include/cuco/detail/static_map/static_map_ref.inl index 365e5f902..02e2db183 100644 --- a/include/cuco/detail/static_map/static_map_ref.inl +++ b/include/cuco/detail/static_map/static_map_ref.inl @@ -16,6 +16,7 @@ #pragma once +#include #include #include @@ -703,7 +704,7 @@ class operator_impl< { ref_type& ref_ = static_cast(*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(value, op); } else { ref_.insert_or_apply_impl(value, op); @@ -734,7 +735,7 @@ class operator_impl< { ref_type& ref_ = static_cast(*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(group, value, op); } else { ref_.insert_or_apply_impl(group, value, op); diff --git a/include/cuco/utility/reduction_functors.cuh b/include/cuco/utility/reduction_functors.cuh index 241507531..eaf6b03a0 100644 --- a/include/cuco/utility/reduction_functors.cuh +++ b/include/cuco/utility/reduction_functors.cuh @@ -15,6 +15,8 @@ */ #pragma once +#include + namespace cuco::reduce { /** diff --git a/tests/static_map/insert_or_apply_test.cu b/tests/static_map/insert_or_apply_test.cu index 07b9d386d..76140226a 100644 --- a/tests/static_map/insert_or_apply_test.cu +++ b/tests/static_map/insert_or_apply_test.cu @@ -113,22 +113,22 @@ TEMPLATE_TEST_CASE_SIG( SECTION("sentinel equals init; has_init = true") { auto map = map_type{num_keys, cuco::empty_key{-1}, cuco::empty_value{0}}; - test_insert_or_apply(map, num_keys, num_unique_keys, Key(0)); + test_insert_or_apply(map, num_keys, num_unique_keys, static_cast(0)); } SECTION("sentinel equals init; has_init = false") { auto map = map_type{num_keys, cuco::empty_key{-1}, cuco::empty_value{0}}; - test_insert_or_apply(map, num_keys, num_unique_keys, Key(0)); + test_insert_or_apply(map, num_keys, num_unique_keys, static_cast(0)); } SECTION("sentinel not equals init; has_init = true") { auto map = map_type{num_keys, cuco::empty_key{-1}, cuco::empty_value{0}}; - test_insert_or_apply(map, num_keys, num_unique_keys, Key(-1)); + test_insert_or_apply(map, num_keys, num_unique_keys, static_cast(-1)); } SECTION("sentinel not equals init; has_init = false") { auto map = map_type{num_keys, cuco::empty_key{-1}, cuco::empty_value{0}}; - test_insert_or_apply(map, num_keys, num_unique_keys, Key(-1)); + test_insert_or_apply(map, num_keys, num_unique_keys, static_cast(-1)); } } @@ -151,21 +151,21 @@ TEMPLATE_TEST_CASE_SIG( SECTION("sentinel equals init; has_init = true") { auto map = map_type{num_keys, cuco::empty_key{-1}, cuco::empty_value{0}}; - test_insert_or_apply(map, num_keys, num_keys, Key(0)); + test_insert_or_apply(map, num_keys, num_keys, static_cast(0)); } SECTION("sentinel equals init; has_init = false") { auto map = map_type{num_keys, cuco::empty_key{-1}, cuco::empty_value{0}}; - test_insert_or_apply(map, num_keys, num_keys, Key(0)); + test_insert_or_apply(map, num_keys, num_keys, static_cast(0)); } SECTION("sentinel not equals init; has_init = true") { auto map = map_type{num_keys, cuco::empty_key{-1}, cuco::empty_value{0}}; - test_insert_or_apply(map, num_keys, num_keys, Key(-1)); + test_insert_or_apply(map, num_keys, num_keys, static_cast(-1)); } SECTION("sentinel not equals init; has_init = false") { auto map = map_type{num_keys, cuco::empty_key{-1}, cuco::empty_value{0}}; - test_insert_or_apply(map, num_keys, num_keys, Key(-1)); + test_insert_or_apply(map, num_keys, num_keys, static_cast(-1)); } } \ No newline at end of file