Bit-Packed Slot Arrays for the Word-RAM Quotient Filter #
This file defines the compact bit-packed memory layout and extraction/update laws for the two-stage quotient filter:
- Generic power-of-2 bit-packed array (
slotPackShift,packedWords,extractPacked,writePackedMem): For2 ^ bslots ofd-bit entries (0 < d,2 * d ≤ w), each word packs2 ^ pentries wherep = slotPackShift b d w = min b (Nat.log 2 (w / (2 * d))). Becausep ≤ band2 ^ p * d ≤ w / 2 < w, the array occupiespackedWords b d w = 2 ^ (b - p) ≤ 4 * (2 ^ b * d) / w + 1words, no entry ever crosses a word boundary, and every intermediate bit-shift mask fits strictly inside aw-bit word. - Quotient-filter memory layout and total state extraction (
extractFilterState,space_le): PacksReducedKWise(5-wise quotient hash seed and bit-packed table), the1-word remainder seedγ : RemSeed w₀, three1-bit slot arrays (isFull,isOcc,isRunStart), and onef-bit remainder array (remAt,f = remBits w₀ k = min w₀ (k + 1)) intospace w w₀ n k ≤ 640 * ((n * k + w - 1) / w + 1)words. - Slot modular arithmetic and memory layout offsets (
add_and_eq_probeSlot_val,add_sub_and_eq_backSlot_val,remSeedOff,fullOff,occOff,runOff,remOff): Relates bitwise slot masks toprobeSlot/backSlotand base-relative offsets to physical array addresses.
Section 1: Generic power-of-2 bit-packed slot array arithmetic #
Log₂ of the number of d-bit entries packed per w-bit word in a 2 ^ b-slot array:
min b (Nat.log 2 (w / (2 * d))).
Number of w-bit words 2 ^ (b - slotPackShift b d w) used by a 2 ^ b-slot packed array of
d-bit entries.
Whenever 0 < d and 2 * d ≤ w, the total bits 2 ^ (slotPackShift b d w) * d used per word
is at most w / 2 (and hence strictly less than w).
Word-count upper bound: whenever 0 < d and 2 * d ≤ w, packedWords b d w is at most
4 * (2 ^ b * d) / w + 1.
Section 2: Quotient-filter memory layout, space_le, and extractFilterState #
Address base + ReducedKWise.space w w₀ (quotBits w₀ n) (quotBits w₀ n) 5 storing the
multiply-shift remainder seed γ : RemSeed w₀.
Base address of the isFull 1-bit packed array (packedWords (quotBits w₀ n) 1 w words).
Base address of the isOcc 1-bit packed array (packedWords (quotBits w₀ n) 1 w words).
Base address of the isRunStart 1-bit packed array (packedWords (quotBits w₀ n) 1 w words).
Base address of the remAt remBits w₀ k-bit packed array
(packedWords (quotBits w₀ n) (remBits w₀ k) w words).
Total contiguous memory footprint space w w₀ n k of the two-stage quotient filter in words.
Compact space bound: for all n ≥ 1, k ≥ 1, 0 < w₀, 2 * w₀ ≤ w, and
quotBits w₀ n ≤ w, the total Word-RAM footprint space w w₀ n k is at most
640 * ((n * k + w - 1) / w + 1) words.
Extract the full seed (θ, γ) : FilterSeed w₀ n from memory at base.
Extract the pure FilterState (quotBits w₀ n) (remBits w₀ k) from the 4 bit-packed slot arrays
in mem.
Each slot-array write changes its own field; the other three arrays are disjoint from it.
Section 3: Slot modular arithmetic and memory layout offsets #
Offset of remSeedAddr from base.
Offset of fullBase from base.
Offset of occBase from base.
Offset of runBase from base.
Offset of remBase from base.