Offset-based alternate bucket policy from "Smaller and More Flexible Cuckoo Filters" by Schmitz, Zentgraf, and Rahmann.
More...
|
| template<typename H > |
| static __host__ __device__ uint64_t | hash64 (const H &key) |
| | Computes a 64-bit hash of the key.
|
| |
| static __host__ __device__ TagType | getPureFingerprint (TagType fp) |
| | Extracts the pure fingerprint (without choice bit).
|
| |
| static __host__ __device__ TagType | getChoiceBit (TagType fp) |
| | Extracts the choice bit (0 or 1).
|
| |
| static __host__ __device__ TagType | setChoiceBit (TagType fp, TagType choice) |
| | Sets the choice bit in a fingerprint.
|
| |
| static __host__ __device__ size_t | computeOffset (TagType pureFp, size_t numBuckets) |
| | Computes a non-zero offset from a fingerprint (uses pure fp).
|
| |
| static __host__ __device__ cuda::std::tuple< size_t, size_t, TagType, TagType > | getCandidateBucketsAndFPs (const KeyType &key, size_t numBuckets) |
| | Computes the primary and alternate 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 asymmetric offset.
|
| |
| static __host__ __device__ cuda::std::tuple< size_t, TagType > | getAlternateBucketWithNewFp (size_t bucket, TagType fp, size_t numBuckets) |
| | Computes alternate bucket AND updated fingerprint for eviction.
|
| |
| static size_t | calculateNumBuckets (size_t capacity) |
| | Calculates number of buckets without requiring power of two.
|
| |
template<typename KeyType, typename TagType, size_t bitsPerTag, size_t bucketSize>
struct cuckoogpu::OffsetAltBucketPolicy< KeyType, TagType, bitsPerTag, bucketSize >
Offset-based alternate bucket policy from "Smaller and More Flexible Cuckoo Filters" by Schmitz, Zentgraf, and Rahmann.
Uses an asymmetric offset with a choice bit:
- b' = (b + offset(fp)) mod numBuckets (when choice=0, primary bucket)
- b = (b' - offset(fp)) mod numBuckets (when choice=1, alternate bucket)
The choice bit is stored in the MSB of the fingerprint:
- Lower (bitsPerTag-1) bits: actual fingerprint
- MSB: choice bit (0 = primary, 1 = alternate)
This allows non-power-of-two bucket counts with proper symmetry.
Definition at line 201 of file bucket_policies.cuh.
template<typename KeyType , typename TagType , size_t bitsPerTag, size_t bucketSize>
| static __host__ __device__ cuda::std::tuple< size_t, TagType > cuckoogpu::OffsetAltBucketPolicy< KeyType, TagType, bitsPerTag, bucketSize >::getAlternateBucketWithNewFp |
( |
size_t |
bucket, |
|
|
TagType |
fp, |
|
|
size_t |
numBuckets |
|
) |
| |
|
inlinestatic |
Computes alternate bucket AND updated fingerprint for eviction.
Returns what the alternate bucket would be AND what the new fp would be (with flipped choice bit). This is used during eviction when we need both.
- Parameters
-
| bucket | Current bucket index. |
| fp | Fingerprint (with choice bit). |
| numBuckets | Total number of buckets. |
- Returns
- Tuple of (alternate bucket index, new fingerprint with flipped choice bit).
Definition at line 329 of file bucket_policies.cuh.
329 {
333
334 size_t alt;
335 if (choice == 0) {
336 alt = (bucket + offset) % numBuckets;
337 } else {
338 alt = (bucket + numBuckets - offset) % numBuckets;
339 }
340
342 return {alt, newFp};
343 }
static __host__ __device__ TagType setChoiceBit(TagType fp, TagType choice)
Sets the choice bit in a fingerprint.