Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
PointKernel committed Nov 26, 2024
1 parent 70e2497 commit 95fe1f6
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions cpp/include/cudf/hashing/detail/xxhash_64.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct XXHash_64 {
template <typename T>
__device__ constexpr result_type compute(T const& key) const
{
return this->_impl.compute_hash(reinterpret_cast<cuda::std::byte const*>(&key), sizeof(T));
return this->compute_bytes(reinterpret_cast<cuda::std::byte const*>(&key), sizeof(T));
}

cuco::xxhash_64<Key> _impl;
Expand All @@ -52,54 +52,49 @@ struct XXHash_64 {
template <>
XXHash_64<bool>::result_type __device__ inline XXHash_64<bool>::operator()(bool const& key) const
{
return this->compute_hash(reinterpret_cast<cuda::std::byte const*>(&key), sizeof(key));
return this->compute(static_cast<uint8_t>(key));
}

template <>
XXHash_64<float>::result_type __device__ inline XXHash_64<float>::operator()(float const& key) const
{
return cuco::xxhash_64<float>::operator()(normalize_nans(key));
return this->compute(normalize_nans(key));
}

template <>
XXHash_64<double>::result_type __device__ inline XXHash_64<double>::operator()(
double const& key) const
{
return cuco::xxhash_64<double>::operator()(normalize_nans(key));
return this->compute(normalize_nans(key));
}

template <>
XXHash_64<cudf::string_view>::result_type
__device__ inline XXHash_64<cudf::string_view>::operator()(cudf::string_view const& key) const
{
return this->compute_hash(reinterpret_cast<cuda::std::byte const*>(key.data()), key.size_bytes());
return this->compute_bytes(reinterpret_cast<cuda::std::byte const*>(key.data()),
key.size_bytes());
}

template <>
XXHash_64<numeric::decimal32>::result_type
__device__ inline XXHash_64<numeric::decimal32>::operator()(numeric::decimal32 const& key) const
{
auto const val = key.value();
auto const len = sizeof(val);
return this->compute_hash(reinterpret_cast<cuda::std::byte const*>(&val), len);
return this->compute(key.value());
}

template <>
XXHash_64<numeric::decimal64>::result_type
__device__ inline XXHash_64<numeric::decimal64>::operator()(numeric::decimal64 const& key) const
{
auto const val = key.value();
auto const len = sizeof(val);
return this->compute_hash(reinterpret_cast<cuda::std::byte const*>(&val), len);
return this->compute(key.value());
}

template <>
XXHash_64<numeric::decimal128>::result_type
__device__ inline XXHash_64<numeric::decimal128>::operator()(numeric::decimal128 const& key) const
{
auto const val = key.value();
auto const len = sizeof(val);
return this->compute_hash(reinterpret_cast<cuda::std::byte const*>(&val), len);
return this->compute(key.value());
}

} // namespace cudf::hashing::detail

0 comments on commit 95fe1f6

Please sign in to comment.