Skip to content

Commit

Permalink
Fix a bug where bitwise compare should be used to compare sentinels
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Dec 18, 2023
1 parent c22a30d commit 1547a3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/cuco/detail/static_map/static_map.inl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include <cuco/cuda_stream_ref.hpp>
#include <cuco/detail/bitwise_compare.cuh>
#include <cuco/detail/static_map/functors.cuh>
#include <cuco/detail/static_map/kernels.cuh>
#include <cuco/detail/utility/cuda.hpp>
Expand Down Expand Up @@ -564,7 +565,7 @@ auto static_map<Key, T, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Stora
Operators...) const noexcept
{
static_assert(sizeof...(Operators), "No operators specified");
return this->empty_key_sentinel() == this->erased_key_sentinel()
return cuco::detail::bitwise_compare(this->empty_key_sentinel(), this->erased_key_sentinel())
? ref_type<Operators...>{cuco::empty_key<key_type>(this->empty_key_sentinel()),
cuco::empty_value<mapped_type>(this->empty_value_sentinel()),
impl_->key_eq(),
Expand Down
3 changes: 2 additions & 1 deletion include/cuco/detail/static_set/static_set.inl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include <cuco/cuda_stream_ref.hpp>
#include <cuco/detail/bitwise_compare.cuh>
#include <cuco/detail/static_set/functors.cuh>
#include <cuco/detail/static_set/kernels.cuh>
#include <cuco/detail/utility/cuda.hpp>
Expand Down Expand Up @@ -467,7 +468,7 @@ auto static_set<Key, Extent, Scope, KeyEqual, ProbingScheme, Allocator, Storage>
Operators...) const noexcept
{
static_assert(sizeof...(Operators), "No operators specified");
return this->empty_key_sentinel() == this->erased_key_sentinel()
return cuco::detail::bitwise_compare(this->empty_key_sentinel(), this->erased_key_sentinel())
? ref_type<Operators...>{cuco::empty_key<key_type>(this->empty_key_sentinel()),
impl_->key_eq(),
impl_->probing_scheme(),
Expand Down

0 comments on commit 1547a3e

Please sign in to comment.