Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cuco::arrow_filter_policy to accept a custom implementation of xxhash_64 #642

Merged
8 changes: 6 additions & 2 deletions include/cuco/bloom_filter_policies.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <cuco/detail/bloom_filter/arrow_filter_policy.cuh>
#include <cuco/detail/bloom_filter/default_filter_policy_impl.cuh>
#include <cuco/hash_functions.cuh>

#include <cstdint>

Expand All @@ -28,9 +29,12 @@ namespace cuco {
* fingerprint.
*
* @tparam Key The type of the values to generate a fingerprint for.
* @tparam XXHash64 Custom (64 bit) XXHash hasher to generate a key's fingerprint.
* By default, cuco::xxhash_64 hasher will be used.
*
*/
template <class Key>
using arrow_filter_policy = detail::arrow_filter_policy<Key>;
template <class Key, class XXHash64 = cuco::xxhash_64<Key>>
using arrow_filter_policy = detail::arrow_filter_policy<Key, XXHash64>;

/**
* @brief The default policy that defines how a Blocked Bloom Filter generates and stores a key's
Expand Down
7 changes: 4 additions & 3 deletions include/cuco/detail/bloom_filter/arrow_filter_policy.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ namespace cuco::detail {
* @endcode
*
* @tparam Key The type of the values to generate a fingerprint for.
* @tparam XXHash64 64-bit XXHash hasher implementation for fingerprint generation.
*/
template <class Key>
template <class Key, class XXHash64>
class arrow_filter_policy {
public:
using hasher = cuco::xxhash_64<Key>; ///< xxhash_64 hasher for Arrow bloom filter policy
using word_type = std::uint32_t; ///< uint32_t for Arrow bloom filter policy
using hasher = XXHash64; ///< 64-bit XXHash hasher for Arrow bloom filter policy
using word_type = std::uint32_t; ///< uint32_t for Arrow bloom filter policy
using hash_argument_type = typename hasher::argument_type; ///< Hash function input type
using hash_result_type = decltype(std::declval<hasher>()(
std::declval<hash_argument_type>())); ///< hash function output type
Expand Down
4 changes: 2 additions & 2 deletions tests/bloom_filter/unique_sequence_test.cu
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ void test_unique_sequence(Filter& filter, size_type num_keys)
{
using Key = typename Filter::key_type;

// Generate keys
thrust::device_vector<Key> keys(num_keys);

thrust::sequence(thrust::device, keys.begin(), keys.end());

thrust::device_vector<bool> contained(num_keys, false);
Expand Down Expand Up @@ -119,4 +119,4 @@ TEMPLATE_TEST_CASE_SIG("bloom_filter arrow policy tests",
auto filter = filter_type{1000};

test_unique_sequence(filter, num_keys);
}
}
Loading