|
| template<typename H > |
| static __host__ __device__ uint64_t | hash64 (const H &key) |
| | Computes a 64-bit hash of the key.
|
| |
| static __host__ __device__ cuda::std::tuple< size_t, size_t, TagType, TagType > | getCandidateBucketsAndFPs (const KeyType &key, size_t numBuckets) |
| | Performs partial-key cuckoo hashing to find the fingerprint and both bucket indices for a given key.
|
| |
| static __host__ __device__ size_t | getAlternateBucket (size_t bucket, TagType fp, size_t numBuckets) |
| | Computes the alternate bucket index using XOR.
|
| |
| static size_t | calculateNumBuckets (size_t capacity) |
| | The number of buckets is enforced to be a power of two in order to allow for efficient modulo on the bucket indices with XOR-based hashing.
|
| |
template<typename KeyType, typename TagType, size_t bitsPerTag, size_t bucketSize>
struct cuckoogpu::XorAltBucketPolicy< KeyType, TagType, bitsPerTag, bucketSize >
Default XOR-based hashing strategy for cuckoo filters.
This uses the traditional partial-key cuckoo hashing with XOR operation to compute alternate bucket indices.
Definition at line 17 of file bucket_policies.cuh.
template<typename KeyType , typename TagType , size_t bitsPerTag, size_t bucketSize>
| static __host__ __device__ cuda::std::tuple< size_t, size_t, TagType, TagType > cuckoogpu::XorAltBucketPolicy< KeyType, TagType, bitsPerTag, bucketSize >::getCandidateBucketsAndFPs |
( |
const KeyType & |
key, |
|
|
size_t |
numBuckets |
|
) |
| |
|
inlinestatic |
Performs partial-key cuckoo hashing to find the fingerprint and both bucket indices for a given key.
We derive the fingerprint and bucket indices from different parts of the key's hash to greatly reduce the number of collisions. The fingerprint value 0 is reserved to indicate an empty slot, so we use 1 if the computed fingerprint is 0.
- Parameters
-
| key | Key to hash |
| numBuckets | Number of buckets in the filter |
- Returns
- A tuple of (bucket1, bucket2, fingerprintForBucket1, fingerprintForBucket2)
Definition at line 48 of file bucket_policies.cuh.
48 {
49 const uint64_t h =
hash64(key);
50
51
52 const uint32_t h_fp = h >> 32;
53 const uint32_t masked = h_fp &
fpMask;
54
55 const auto fp = TagType(masked == 0 ? 1 : masked);
56
57
58 const uint32_t h_bucket = h & 0xFFFFFFFF;
59 const size_t i1 = h_bucket & (numBuckets - 1);
61
62 return {i1, i2, fp, fp};
63 }
static constexpr size_t fpMask
static __host__ __device__ size_t getAlternateBucket(size_t bucket, TagType fp, size_t numBuckets)
Computes the alternate bucket index using XOR.