Real-Time Parallel Hashing on the GPU
Paper · 2009 · Dan A. Alcantara, Andrei Sharf, Fatemeh Abbasinejad et al.
Summary
A hash table connects a key to the information stored under it: a spatial coordinate to an occupied cell, for instance, or an image signature to the places where it occurs. The challenge addressed by “Real-Time Parallel Hashing on the GPU” is to build and query these structures efficiently when millions of items must be processed together. Conventional hash-table algorithms often depend on linked structures, sequential updates, or searches of unpredictable length. These properties fit poorly with GPU and parallel computing, where performance depends on coordinating many threads without making them wait through different amounts of work.
The authors combine two hashing strategies. First, they distribute the input among small buckets, bringing the items assigned to each bucket together in memory. Then they construct an independent cuckoo hash table inside each bucket. Cuckoo hashing gives every key several possible positions and resolves collisions by relocating items. The important implementation decision is where this relocation happens: the small tables fit in fast shared memory, so repeated construction steps avoid repeated coordination across the entire GPU. After construction, finding a key requires examining at most three candidate positions within its bucket.
The main measurements show a useful balance between construction speed, lookup speed, and memory consumption. For 5 million key-value pairs, the hash structure takes 35.7 ms to construct, occupies 1.42 times the input storage, and supports retrieval of every element in 15.3 ms. Sorting the same input takes 36.6 ms, while retrieving all elements through binary search takes 79.5 ms. These are measurements of the authors’ implementation and experimental setting, rather than universal performance guarantees. The central result is that rebuilding a hash table on the GPU can be practical, with construction competitive with sorting and substantially faster random retrieval in the reported comparison.
The paper also develops variants for repeated keys and for collecting distinct keys into a compact array. Repeated-key storage associates a key with a contiguous range of values. Compaction creates both an array of distinct keys and a hash mapping from each key to its array position. These variants support two applications: identifying intersections between animated voxelized surfaces, and matching images through geometric hashing. The surface application runs at 25–29 fps in the reported examples. The image-matching experiments favor hash-based lookup over a sorted-list alternative, although the complete matching process takes seconds because voting and other work remain expensive.
The contribution is therefore broader than a fast collision-resolution routine. It shows how to reorganize an irregular data structure around the GPU’s memory and synchronization constraints. At the same time, the authors document the costs of that organization: spare capacity, occasional reconstruction attempts, inefficient ordered access, and difficulties when many values share a key. The paper demonstrates an effective design for its workloads while leaving several choices—especially denser storage, variable bucket sizes, and high-multiplicity handling—open for further work.
Interesting ideas
Match algorithmic boundaries to memory boundaries. The authors avoid running one large cuckoo insertion process across global memory. They partition the input and solve smaller collision problems in shared memory. The reusable lesson is to identify where repeated coordination occurs and place that work inside a memory region with cheaper communication. This applies to parallel grouping, local graph processing, and other tasks whose global problem can be separated into independent local problems.
Move irregular work into construction. Cuckoo insertion may require repeated relocations, but successful construction leaves each key with a small, fixed set of possible locations. This trade is useful when a structure will answer many queries after being built. More generally, preprocessing can absorb uncertainty and variable work so that the often executed operation has a simpler execution pattern.
Treat rebuilding as a legitimate update strategy. A data structure does not always need efficient individual insertions and deletions. If much of its content changes together, rebuilding everything can suit a parallel processor better than maintaining a complicated sequence of local edits. The idea applies to temporary indexes, changing spatial data, and derived representations whose contents are naturally refreshed in batches.
Construct compact groups with counts and offsets. The paper repeatedly turns scattered membership into contiguous storage: count members, determine starting positions, assign local offsets, and move records into their reserved ranges. This separates the logical question of which records belong together from the physical question of where to store them. The pattern is useful for repeated-key data, sparse relations, and grouped processing pipelines.
Build both directions of an index. Compaction produces an array that maps positions to keys, while hashing supplies the reverse mapping from keys to positions. The resulting two-way index lets downstream algorithms use dense arrays without losing efficient access from original identifiers. This is valuable whenever irregular identifiers must address compact working state.
Evaluate the whole workload and its components. The authors compare construction, retrieval, and space, then examine stage costs and complete applications. A lookup advantage matters differently when the structure is rebuilt frequently, queried repeatedly, or followed by expensive voting. This evaluation pattern transfers to indexes, storage systems, and parallel pipelines where a locally faster operation may not determine total runtime.
Expose recovery costs and difficult input regimes. The paper reports bucket overflow, restart frequencies, multiplicity effects, and ordered-access limitations. These analyses show where the design stops behaving like its favorable average case. The general lesson is to measure failure handling and input structure explicitly, instead of presenting a successful run as sufficient evidence of dependable performance.
Deep dive: Real-Time Parallel Hashing on the GPU
How parallel GPU hashing combines small buckets and cuckoo tables to build large lookup structures quickly, with measured speed and memory trade-offs. · about 38 minutes to read
How Mova uses it
Mova is a small, transparent language system implemented in Rust. Its documented architecture includes compiled knowledge, structured text processing, persistent indexes, and separately controlled CPU and GPU execution. Those mechanisms create concrete places to investigate the paper’s ideas. However, the available implementation evidence does not establish that Mova already uses this hybrid GPU hash construction. The marks below are proposed correspondences against documented mechanisms; they do not certify a completed transfer or a measured improvement.
Idea: Partition work to fit the memory used by each worker. Where: Sections 3.3 and 4.1. Area: parallel data processing. Mova: частково є (the shared document graph and specialist threads in world/src/knowledge/retention/mice.rs). Mova already lets specialists operate over shared document state. A proposed extension would partition expensive indexing or graph operations according to the memory needed for local computation, rather than only by document boundaries. Why Mova: reducing repeated access to larger stores could make native processing cheaper while preserving explicit task boundaries. Whether useful partitions exist, and their performance effect, remain unknown.
Idea: Keep repeated collision handling inside fast local storage. Where: Sections 3.3 and 4.1. Area: GPU execution. Mova: нове. This is a candidate addition instead of a claim of established novelty: the documented GPU boundary does not establish a local cuckoo-table implementation. A bounded prototype could test whether temporary key sets used by supported batch stages benefit from local table construction before publication. Why Mova: Mova’s exact processing paths may need fast membership checks without introducing approximate semantic decisions. The memory limits, supported key types, and comparison against existing containers would need measurement.
Idea: Pay variable work during preparation to simplify repeated access. Where: Sections 3.2–4.1. Area: indexing. Mova: частково є (tools/dictindex prepares compressed postings and lookup directories). The occurrence index already separates import work from later queries. The paper suggests evaluating whether additional preparation can reduce the number of dependent reads needed for frequent native queries. Why Mova: dictionary workers repeatedly retrieve examples and selectors, so a construction cost may be worthwhile if it improves their actual access pattern. The paper supplies a design principle, not evidence that GPU hashing would improve this index.
Idea: Rebuild derived state when updates arrive as a batch. Where: Section 1. Area: data lifecycle. Mova: частково є (tools/dictindex uses immutable source versions and separately named index epochs). A proposed application is to compare rebuilding temporary or epoch-bound indexes with maintaining many small mutations. Source identity and admission history would remain authoritative outside the rebuilt structure. Why Mova: a clear rebuild boundary can simplify recovery and reproducibility when the derived state changes substantially. The paper does not justify replacing transactional updates where Mova needs durable incremental publication.
Idea: Separate assignment, counting, placement, and local construction. Where: Algorithm 1 and Section 4.1. Area: data pipelines. Mova: частково є (tools/dictindex publishes compressed batches with directory and cursor updates). The proposed transfer is an explicit staged representation for any new native batch index: first establish membership, then calculate storage, then populate it, then validate the result. Why Mova: distinct stages make partial failure diagnosable and can prevent a completed allocation step from being mistaken for completed import. An exact correspondence with the paper’s GPU stages has not been demonstrated.
Idea: Use prefix sums to turn local counts into nonoverlapping ranges. Where: Algorithm 1 and Section 4.3. Area: parallel algorithms. Mova: нове. The digest does not establish this particular use in Mova, so it is a candidate for inspection and benchmarking. Counts from independent producers could be converted into deterministic output ranges for temporary records or grouped observations. Why Mova: this could replace repeated shared allocation with an explicit layout calculation. Its value depends on whether the target operation is limited by allocation or coordination, and no such bottleneck is established here.
Idea: Distinguish duplicate identifiers from multiple observations under one identifier. Where: Section 4.2. Area: evidence representation. Mova: частково є (tools/dictindex retains distinct occurrence evidence with source credit). The paper’s repeated-key variant suggests grouping observations while preserving each associated value. In Mova, the grouping key must include the distinctions required by source and version policy, rather than treating equal text as identical evidence. Why Mova: compact grouping could support efficient retrieval without discarding provenance. Any semantic aggregation would require separate rules; the hash structure itself establishes only membership.
Idea: Store each key’s values in a contiguous range. Where: Section 4.2 and Figure 2. Area: storage layout. Mova: частково є (tools/dictindex groups records into compressed blocks and maintains lookup directories). A proposed experiment would compare contiguous ranges for selected temporary evidence lists against the existing representation. Why Mova: workers often consume several examples associated with the same lemma or selector, so grouped access could reduce scattered reads. This remains a storage hypothesis; the paper’s uncompressed GPU arrangement cannot be assumed to outperform Mova’s compressed persistent blocks.
Idea: Build a reversible mapping between identifiers and dense positions. Where: Section 4.3. Area: graph and index addressing. Mova: частково є (tools/dictindex uses integer feature identifiers and stable posting hashes). The proposal is to retain stable external identifiers while constructing a temporary dense position space for batch calculations. Why Mova: dense arrays can make counts and working state easier to process while stable identifiers preserve links to source evidence. The paper’s two-way index is a concrete mechanism to evaluate, but its use in Mova and its costs are unknown.
Idea: Give successful lookup a declared candidate bound. Where: Sections 3.3 and 4.1. Area: execution contracts. Mova: частково є (configured bounded execution in tools/octopus and explicit CPU/GPU stage boundaries). A storage operation could publish its candidate locations, verification rule, and failure outcome as part of its operational contract. Why Mova: bounded native operations are easier to budget and inspect than open-ended searches. The paper bounds the positions examined after construction; it does not establish a bound on all preprocessing, retries, or downstream evidence processing.
Idea: Treat a hash match as an address candidate that still needs identity checking. Where: Section 4.1, retrieval procedure. Area: data correctness. Mova: частково є (tools/dictindex uses stable posting identities and SHA-256 block checks). The proposed correspondence is to keep exact key verification distinct from location computation in any new accelerated index. Why Mova: a fast route to a slot should not be confused with confirmation that the requested record is present. The documented digest supports explicit identity checks generally, but does not establish the paper’s candidate-slot lookup in Mova.
Idea: Define concurrent-write success before optimizing it. Where: Section 3.3. Area: concurrency correctness. Mova: частково є (tools/dictindex uses transactional publication and a corpus import lock). Any new parallel native container should specify which write wins, how losing writers detect failure, and when readers may inspect the result. Why Mova: transparent concurrency rules prevent apparent speed from depending on lost records or unobserved races. The paper’s synchronization semantics concern temporary GPU tables; they do not replace the persistence guarantees of Mova’s existing stores.
Idea: Retry at the smallest independently recoverable unit. Where: Sections 4.1 and 7. Area: recovery. Mova: частково є (tools/enrich retains saved stages and supports finishing interrupted work). The hash construction distinguishes retrying one bucket’s internal functions from rebuilding the initial distribution. Mova could use the same reasoning when defining which failed stages invalidate only local work. Why Mova: smaller recovery units can reduce wasted computation while keeping completed evidence intact. The precise restart unit must follow dependencies, and the paper itself shows cases where a local failure requires a broader restart.
Idea: Make retry limits and failure outcomes visible. Where: Section 4.1. Area: bounded execution. Mova: вже є (configured bounded deputy execution and hard epoch caps in world/src/knowledge/retention/mice.rs). The paper provides another example of stopping an unsuccessful local process and changing its construction conditions instead of continuing indefinitely. Mova can preserve this principle in new indexing operations by recording the failed attempt and its replacement. Why Mova: an explicit unsuccessful outcome is operational evidence, whereas an exhausted loop is not a completed result. No new hash implementation is implied by this correspondence.
Idea: Choose spare capacity from an explicit workload assumption. Where: Sections 4.1 and 7. Area: statistics and resource planning. Mova: частково є (tools/jobs records estimates and actual resource use; tools/twin calibrates cost predictions). The proposed use is to record the input distribution assumed when choosing a batch or table capacity, then compare predicted overflow with observed outcomes. Why Mova: capacity choices affect both memory and recovery time. The paper’s distributional approximation applies to its bucket assignment and should not be imported as a claim about linguistic frequencies.
Idea: Compare probabilistic expectations with measured failures. Where: Sections 4.1 and 7. Area: evaluation. Mova: частково є (paired evaluation, negative controls, and confidence analyses described in the digest). A new index or scheduler could report both its expected failure behavior and observed exceptions on declared workloads. Why Mova: a mathematical estimate is more useful when its assumptions and empirical fit are visible. The paper illustrates this with bucket occupancy and restart measurements, but supplies no evidence about Mova’s current resource estimates.
Idea: Measure rare recovery events separately from routine completion. Where: Section 7. Area: latency evaluation. Mova: частково є (tools/jobs logs estimated and actual work; worker protocols retain outcomes). Proposed reports could distinguish normal completion, local retry, broader restart, and refusal rather than combining them into one average. Why Mova: an uncommon expensive retry can matter for interactive workers even when average throughput is acceptable. The digest establishes retained operational evidence, while this particular reporting scheme and its measurements remain proposals.
Idea: Compare construction, query cost, and storage together. Where: Sections 5 and 8. Area: evaluation design. Mova: вже є (tools/dictindex reports imported coverage, stored bytes, timings, and repeated-result hashes). The paper reinforces measuring a data structure across its lifecycle. Mova should preserve separate accounting for preparation and repeated use when evaluating alternative layouts. Why Mova: a smaller or faster index may still be worse for the worker that builds and queries it. Existing measurements do not establish which hashing strategy would be best.
Idea: Evaluate the access pattern the application actually uses. Where: Sections 5 and 7. Area: workload design. Mova: частково є (tools/dictindex distinguishes selector rarity, visited blocks, and cache scope). A proposed extension would compare frequent-lemma retrieval, rare-selector lookup, and sequential evidence export as different workloads. Why Mova: the paper shows that random and ordered access can favor different structures. Its conclusion supports workload-specific evaluation, not a general recommendation to replace Mova’s ordered maps or persistent directories.
Idea: Break total runtime into stages before choosing an optimization. Where: Section 5 and Figure 5. Area: profiling. Mova: вже є (tools/enrich exposes profiling information; tools/dictindex reports import and query measurements). The transferable practice is to identify the stage whose cost changes with input size and distinguish startup effects from sustained processing. Why Mova: optimizing a native primitive is useful only if that primitive contributes materially to the worker’s runtime. The paper’s stage profile cannot identify Mova’s bottlenecks, which require their own measurements.
Idea: Sweep duplication instead of reporting only total record count. Where: Section 5 and Figure 6. Area: benchmark design. Mova: нове. A dedicated multiplicity sweep is a candidate addition; its existence is not established by the digest. An index benchmark could hold the record budget fixed while varying how observations concentrate under keys. Why Mova: common lemmas, repeated source patterns, and concentrated selectors may stress grouping differently from uniformly distributed records. The paper’s performance thresholds belong to its GPU implementation and would not be transferred to Mova.
Idea: Record extreme group sizes as well as averages. Where: Section 6, geometric hashing analysis. Area: statistics. Mova: частково є (tools/dictindex reports feature support and source strata). Proposed workload reports could add the largest evidence groups and the work they cause. Why Mova: an average number of observations per key can hide a small set of expensive keys. The paper’s image-matching examples demonstrate why averages alone are incomplete; they do not establish that Mova currently suffers from the same skew.
Idea: Compare equal semantics across alternative containers. Where: Section 5, repeated-key experiments. Area: experimental controls. Mova: вже є (CPU reference behavior and exact-versus-approximant declarations in the GPU execution contract). The authors compare repeated-key structures that both return a value range, instead of comparing operations with different outputs. Mova should apply the same discipline when benchmarking accelerated evidence lookup. Why Mova: a faster operation is not a substitute if it silently omits provenance, changes ordering guarantees, or returns a different set of records.
Idea: Validate correctness after a fast propagation procedure. Where: Section 6, spatial intersection application. Area: consistency checking. Mova: частково є (UD gates in treeagree and validation stages in tools/enrich). The application checks for contradictory neighboring classifications and withdraws the initiating evidence responsible for a conflict. A possible Mova transfer is dependency-aware invalidation of derived observations when a checker finds inconsistency. Why Mova: retaining the origin of a conclusion can make correction more precise. The geometric rule itself has no demonstrated linguistic application.
Idea: Preserve the origin that initiated a derived chain. Where: Section 6, flood-fill procedure. Area: provenance. Mova: вже є (rule evidence, source-bound observations, and retained reasons throughout prag, world, and groupants). The spatial application attaches an initiating cell identity to propagated state. Mova already uses the broader principle that derived results should retain their justification. Why Mova: when a source observation fails review, an explicit dependency chain helps identify affected conclusions. The correspondence concerns evidence tracking, not an implemented spatial algorithm.
Idea: Verify common performance intuitions experimentally. Where: Section 5, output-write comparison. Area: systems evaluation. Mova: частково є (held-out change gates and deterministic repeated measurements). The authors find that writing only occupied slots with an irregular pattern is faster than their coalesced alternative. Mova could similarly compare a proposed optimization with the actual complete operation before accepting it. Why Mova: a plausible hardware explanation cannot substitute for observed behavior. This proposal concerns disciplined testing and supplies no prediction about which layout will win in Mova.
Idea: Specialize containers according to what their values mean. Where: Section 8. Area: data representation. Mova: частково є (distinct representations for source evidence, graph state, dictionary metadata, and operational receipts). The paper separates unique keys, preserved value lists, and possible aggregate values. Mova could make these distinctions explicit when choosing native containers, especially where counts may be combined but source witnesses must remain separate. Why Mova: avoiding unnecessary generality may save work, while preserving evidence semantics prevents an aggregate from being mistaken for its underlying observations.
Idea: Keep physical layout separate from evidence admission. Where: Sections 4.2–4.3, proposed transfer from grouping and compaction. Area: provenance and architecture. Mova: вже є (tools/dictindex indexes occurrences while dictionary admission and versioned labels remain separate). Hashing can reorganize records or give them compact positions, but it cannot establish that their contents are true or admissible. Why Mova: faster grouping must preserve the distinction between source occurrence, reviewed interpretation, and admitted knowledge. This is a Mova architectural correspondence, not a conclusion the authors draw about language systems.
The problem and its context
Sparse information needs efficient addressing
Many graphics computations work with a large possible domain but only a small occupied portion of it. A surface embedded in a voxel grid is a clear example. Most cells do not intersect the surface, so allocating a record for every cell can waste storage. Yet the computation may still need to ask whether a particular coordinate is occupied. The representation must therefore remain compact while supporting access from a coordinate that is not known in advance.
A hash table addresses this mismatch by converting a key into a storage location. Its usefulness comes from avoiding a search through all stored items. However, an initial location may already contain another key. Collision handling determines how additional work is performed, how much space is needed, and how predictable lookup becomes.
The authors focus on structures containing millions of entries that must be both prepared and queried at interactive rates. That combination matters. A representation with fast lookup but slow preparation may be useful for a static scene, yet unsuitable when its contents change every frame. Conversely, rapid construction is less valuable if every later query requires a long search.
The paper situates this problem alongside GPU construction of spatial hierarchies such as k-d trees and octrees. Its concern is not that every spatial task should use hashing. Rather, efficient GPU data structures were still a restricted toolbox compared with the alternatives available on scalar processors. The authors investigate a basic building block for irregular random access.
Why ordinary collision handling is awkward
A conventional chained hash table stores colliding entries in a linked collection. Constructing such a collection requires coordinating updates to its links. On a parallel processor, many threads may try to modify the same collection simultaneously. The sequential dependency has not disappeared merely because more threads are available.
Lookup introduces another difficulty. Different chains can have different lengths. A query that finds its answer immediately does less work than one that traverses many entries. When threads execute together, this imbalance can leave some waiting while others continue. The paper therefore treats variability in query work as an architectural concern, not just an asymptotic detail.
Hashing also disrupts locality. Nearby logical items can be sent to distant physical locations, so caches and hierarchical memory do not automatically solve the access problem. A GPU implementation must work in spite of irregular memory traffic, or reorganize enough of the computation to reduce its cost.
The authors’ terminology needs care. They use “perfect hash table” for a structure with a worst-case constant-time lookup bound. That is broader than a perfect hash function that assigns every stored key a distinct position directly. Their cuckoo structure can involve collisions and relocations during construction while still satisfying their intended lookup property after construction succeeds.
The alternatives described by the authors
The classical FKS construction separates hashing into levels. Its underlying observation is that enough spare space makes a collision-free random placement reasonably likely. Applying this independently to small buckets produces constant-time lookup with expected linear total space. The authors see its randomness and independence as attractive for parallel implementation.
The difficulty is occupancy. To obtain reasonable storage efficiency with the basic construction, buckets must remain very small. The paper therefore treats FKS as a useful organizational pattern instead of the final answer. Its outer partitioning is retained, while the storage method inside each partition is replaced.
Minimal and near-minimal perfect hashing pursue the opposite priority: reducing spare slots. The paper describes earlier spatial hashing by Lefebvre and Hoppe as belonging to this family. Such structures can be economical in storage, but their preparation may depend strongly on placements already made. The authors identify that sequential dependence as an obstacle to rapid GPU construction.
Another alternative is simply to sort the records. A sorted array is compact, supports ordered processing, and can be searched with binary search. The paper uses a high-performing GPU radix sort described by Satish and colleagues as a serious baseline. Its comparison is therefore between different representations of sparse data, rather than hashing against an intentionally weak construction method.
Earlier theoretical parallel hashing results provide another part of the context. The paper credits them with strong asymptotic construction, lookup, and storage bounds. However, it argues that their constants and assumptions do not map comfortably onto available GPU hardware. The practical question is how to obtain useful behavior under actual memory and synchronization constraints.
Why rebuilding changes the design space
A CPU hash table is frequently valued because it supports individual insertions and deletions efficiently. The authors deliberately step away from that requirement. If many entries change together, they rebuild the complete structure.
This choice removes the obligation to keep a complicated mutable representation efficient after every small edit. Instead, the construction can be organized as broad parallel phases with temporary working storage. The relevant comparison becomes the cost of refreshing and then using the representation over an application cycle.
That does not make rebuilding universally preferable. The paper’s conclusion explicitly allows different choices for workloads with infrequent updates or different storage constraints. Rebuilding is the operating assumption that makes this particular combination of partitioning, local construction, and compact lookup attractive.
The method, step by step
The overall construction
The input to the basic construction is a collection of integer key-value pairs with distinct keys. A key identifies the record; the value is the payload that must be returned. The algorithm first reorganizes the records into manageable groups and then builds an independent lookup structure for each group.
From scattered records to bounded hash lookup
The steps in order.
The separation between the initial distribution and the local cuckoo construction is essential. Without it, repeated cuckoo relocation would require traffic through global memory and synchronization across a much larger computation. With it, a thread block can complete a bucket’s work using shared memory.
The final representation still lives in global memory because it must remain available to later queries. Shared memory is used as a construction workspace, not as the permanent home of the complete dataset.
Why cuckoo hashing gives a short lookup
Cuckoo hashing supplies several candidate locations for each key. If a location is occupied during insertion, the incoming item can displace the current occupant. The displaced item then tries another candidate position. Construction is therefore a relocation process instead of a rule that permanently accepts an item’s first placement.
The authors use three subtables. In the general description, their sizes are expressed as follows:
|Tᵢ| = n(1 + γ)/3
Here, Tᵢ is subtable i, |Tᵢ| is its number of positions, n is the number of items in the cuckoo instance, and γ controls spare capacity. The subscript i identifies which subtable is being considered. The expression describes the conceptual parallel cuckoo construction; the implementation later fixes the local table capacities.
A lookup does not replay the insertion history. It computes the candidate positions and compares the stored keys with the requested key. Once construction has succeeded, the number of places that need checking is fixed by the number of choices.
The paper contrasts this property with chained storage. A chain can become longer as collisions accumulate. A cuckoo table instead spends effort relocating entries during construction so that a query has a bounded candidate set.
For the two-choice case, the paper discusses a logarithmic expected bound on the largest insertion effort. For three choices, useful occupancy is better, but theoretical insertion bounds are harder to establish. The authors therefore rely on practical measurements and simulation when selecting the implemented settings.
Partitioning the complete input
The local construction must fit within the resources available to a thread block. The authors limit a bucket to 512 items in the basic distinct-key case. With this approach, every thread handles no more than a single item, while the local cuckoo structure remains small enough to fit in shared memory.
They do not aim to fill every bucket to that limit on average. Instead, they allocate the number of buckets using:
B = ⌈n/409⌉
Here, B denotes the number of buckets, n is the total input item count, and the ceiling brackets mean rounding upward to an integer. The denominator sets the intended average bucket population. The authors describe this as an average fill of 80% relative to the item limit.
The slack is intended to make bucket overflow uncommon. Their calculation approximates a binomial distribution with a Poisson distribution for a large key set. Under that estimate, a specified bucket exceeds 512 entries with probability below one in a million. This is an estimate about a bucket under the assumed distribution, not a statement that an entire construction can never overflow.
For the initial distribution attempt, the bucket function is particularly simple:
h(k) = k mod B
Here, k is a key, h(k) is its bucket identifier, B is the bucket count, and mod returns the remainder. The function is not presented as a random choice. The authors use it first because prior observations suggested useful locality, and their implementation showed a small retrieval benefit.
If the assignment overfills a bucket, the construction changes the hash function:
h(k) = [(c₀ + c₁k) mod 1900813] mod B
The coefficients c₀ and c₁ are random integers. The key is k, the bucket count is B, and 1900813 is the prime used by the implementation. The bracketed expression first mixes the key through modular arithmetic, after which the final remainder selects the bucket.
The algorithm counts the resulting populations and checks the bucket limit. If a bucket is too large, it chooses another function and repeats this distribution work. This is a broader recovery operation than retrying the internal cuckoo construction of one bucket.
Turning assignments into contiguous records
Knowing a key’s bucket is not enough. The records assigned to a bucket must be brought together so that its thread block can read them efficiently.
Each input thread atomically increments its bucket’s counter. An atomic increment updates the shared counter without losing simultaneous increments from other threads. The value returned before the increment becomes that record’s local offset within the bucket.
A prefix sum over the bucket counts determines where each bucket begins in the temporary array. The paper uses the scan primitive from the CUDA Data Parallel Primitives work for this step. Each record now has both a bucket start and a unique offset within that bucket:
p(k) = start[bₖ] + offset[k]
Here, p(k) is the temporary storage position for key k, bₖ is its assigned bucket, start[bₖ] is the first position reserved for that bucket, and offset[k] is the offset returned by its counter increment.
A subsequent kernel copies each key-value pair to that position. This converts scattered membership into contiguous per-bucket input. Keys and values are interleaved in the array, a layout chosen to help the writes performed during redistribution.
The atomic counter operations do serialize requests to the same counter. The authors’ argument is that the contention is localized: in a successful basic distribution, a bucket contains no more than 512 entries. Increasing the complete dataset does not require every input item to contend for one global allocation counter.
Constructing a bucket in shared memory
Each bucket is assigned a block of 512 threads. Its cuckoo representation contains three subtables, each with 192 slots. The paper gives the total local capacity as:
3 × 192 = 576
The factors describe the number of subtables and the slots per subtable; the result is the total number of candidate storage positions available to the bucket. This capacity is chosen for buckets containing at most 512 distinct keys.
Each subtable has its own hash function:
gᵢ(k) = [(cᵢ₀ + cᵢ₁k) mod 1900813] mod |Tᵢ|
Here, gᵢ(k) gives the candidate position of key k in subtable Tᵢ. The coefficients cᵢ₀ and cᵢ₁ determine that function, and |Tᵢ| is the subtable’s size. The prime modulus is the same one used in the randomized outer assignment.
The implementation derives all 6 coefficients from a seed by XOR operations with fixed numbers. Seeds originate from pseudorandom numbers generated on the CPU. Keeping a seed for each completed bucket allows lookup to reconstruct its hash functions without storing every coefficient separately.
All active threads initially try to write into the first subtable. Colliding writes must leave a single winner that can be identified after synchronization. Each key then compares itself with the key currently stored in its candidate slot. If it is absent, it remains active.
Unplaced keys proceed through the other subtables. When the process returns to a previously used subtable, an incoming item may displace an occupant. The active set therefore includes both unsuccessful writers and entries that were evicted.
Synchronization separates writing from checking. Without a stable point at which threads inspect the table, an apparent success could be invalidated while it is being tested. The paper makes these update semantics part of the algorithm, instead of treating collisions as an incidental implementation detail.
If a bucket requires more than 25 iterations, its construction is abandoned under those hash functions. New functions are selected and the bucket starts again. In the authors’ measurements, a bucket cycles through the subtables an average of 5.5 times before completion. They report that only a small number need a replacement choice of functions.
Publishing and querying the completed tables
Once a bucket is complete, its keys and associated values are copied from shared memory into the persistent global array. The output layout groups the first subtables of all buckets together, then the second subtables, then the third.
This arrangement is intended to keep simultaneous retrievals concentrated within a corresponding portion of the array. It does not eliminate random access: different keys still select different buckets and positions. It is a layout choice that attempts to improve the structure of otherwise irregular traffic.
The average occupancy follows from the intended population and fixed local capacity:
409/576 ≈ 71%
The numerator is the intended average bucket population, the denominator is its slot capacity, and the percentage is the overall load factor reported by the authors. The expression also explains why spare slots are an integral part of the design.
A query computes its outer bucket, reads that bucket’s seed, reconstructs the three local functions, and checks their candidate positions. A single thread performs these checks and stops once it finds the requested key. An unsuccessful query must exhaust the candidates before concluding that the key is absent.
Handling repeated keys
The repeated-key variant changes the meaning of the payload. Rather than storing a single value directly under each key, the hash entry stores the size and starting position of a contiguous value range.
The paper describes the associated range as:
iₖ … iₖ + cₖ − 1
Here, iₖ is the index of the first value associated with key k, and cₖ is the number of its values. The expression identifies all positions occupied by that key’s list.
All copies of the same key go to the same outer bucket. However, the number of records in that bucket may exceed 512 even when its distinct-key population remains small enough. Threads must therefore be able to manage several input items.
During cuckoo construction, repeated copies do not each need a separate hash slot. A key counts as placed when any copy is stored successfully. After distinct keys have positions, shared-memory atomic operations count their values, assign unique local offsets, and reserve ranges in the output value array.
This distinction changes failure handling. The basic construction can count input items to know whether a bucket exceeds its distinct-key limit. With duplicates, the distinct count is not available until the cuckoo process has been attempted. Repeated local failure can therefore trigger a restart from the outer distribution.
Compacting distinct keys
The compaction variant needs the distinct keys rather than their complete value lists. After cuckoo construction, occupied slots receive an indicator of one and empty slots an indicator of zero. A prefix sum over those indicators assigns a unique compact position to each stored key and counts the distinct keys.
The keys are copied into an array at their assigned positions. The array supplies direct access from a compact position to its key. The hash table supplies the reverse operation, from key to compact position.
This is the paper’s two-way index. Its significance becomes clearer in the applications: compact arrays can hold per-voxel state or voting coordinates, while original spatial or geometric identifiers remain usable for lookup.
There is no training phase. The method builds a data structure from the input records using hashing, counts, scans, synchronization, and retries. Its choices are construction parameters and memory layouts, not learned linguistic or visual decisions.
Experiments and results
Hardware, comparisons, and timing procedure
The experiments use CUDA 2.2 on Ubuntu Linux with an EVGA GeForce GTX 280 SSC. The reported core clock is 648 MHz. The authors average every plotted timing over 100 runs because both GPU execution and randomized construction can vary.
The main alternatives are radix sorting followed by binary search, and the authors’ implementation of perfect spatial hashing, abbreviated PSH. These alternatives make different tradeoffs. Sorting provides a compact ordered representation. PSH emphasizes storage efficiency and GPU retrieval, while its construction runs on the CPU.
The PSH implementation searches for an economical offset-table size and typically uses 1.16n storage. Its preparation is reported to be orders of magnitude slower than the other construction methods, so those build timings are omitted from the graphs. As a consequence, similar lookup times do not imply similar suitability for frequently rebuilt data.
Construction and lookup on large inputs
The headline comparison uses 5 million key-value pairs. Hash construction and sorting take similar time, while random retrieval strongly favors the hash structure.
Construction for 5 million key-value pairs
The hybrid hash construction is competitive with radix sorting.
The numbers
| System or setting | ms |
|---|---|
| Radix sort | 36.6 |
| Hybrid hash (this paper) | 35.7 |
The accompanying retrieval measurement accesses every stored element. It compares hash lookup with binary search in the sorted representation.
Retrieval of all elements for 5 million key-value pairs
The bounded candidate search is faster than binary search in this experiment.
The numbers
| System or setting | ms |
|---|---|
| Binary search | 79.5 |
| Hybrid hash (this paper) | 15.3 |
These results must be read together with storage. The hash representation uses 1.42 times the space occupied by the input in the headline experiment. Its short lookup depends on maintaining enough capacity for successful local construction.
The Lucy experiments vary the resolution of a voxelized surface. Each voxel’s coordinates are encoded into 30 bits within a 32-bit integer, and the lowest 10 bits hold its z-coordinate. The experiment therefore tests a structured spatial key set rather than only independent random identifiers.
For these inputs, construction tracks radix sort closely and becomes favorable as the voxel set grows. The figure discussion identifies the 3.5 million item case as one where hashing moves ahead. Retrievals query every voxel in random order, so the experiment specifically stresses access that cannot benefit from sequential traversal.
The paper also reports a combined-workload crossover around 300k items for the Lucy comparison. Beyond that point, constructing the hash representation and retrieving its elements takes less time than sorting and performing the corresponding binary searches. This is a result for the reported complete operation, not a universal minimum dataset size for useful hashing.
Random voxel inputs
A separate experiment samples voxel positions from a grid with 1024 positions along each spatial axis. Each sampled voxel is represented by a 32-bit integer. As in the structured experiment, retrieval processes the stored voxels in randomized order.
The random-input results keep construction close to radix sorting, with hashing overtaking it after 5 million items. Hash retrieval remains comparable with PSH retrieval, while binary search becomes less attractive as the input grows.
The PSH comparison ends at 4 million items because its construction becomes impractical for the experiment beyond that size. This stopping condition matters: the paper does not present an unrestricted large-scale PSH construction comparison.
The authors explain the lookup trend through memory trips. Binary search repeatedly narrows a range and therefore performs more dependent work as the array grows. Hashing computes a small candidate set, although those accesses are irregular and require hash-function arithmetic.
Repeated-key workloads
The repeated-key experiment uses random sets containing 1 million items and varies the average number of values associated with a key. The comparison structure also preserves repeated-key semantics: it sorts the records, compacts the distinct keys, and allows binary search to recover a key’s value range.
The query procedure performs a lookup for each value associated with a key. This is important when interpreting the curve. Increasing multiplicity changes how often keys repeat and how much construction work is shared, while the experiment retains a value-driven query workload.
With only 1 value per key, the more general repeated-key implementation carries overhead. At an average of 2 values per key, construction time falls sharply. The authors attribute this to easier placement of repeated keys and fewer cuckoo iterations.
The trend reverses after the average reaches 32 values per key. Organizing all values and performing the necessary shared-memory atomic operations becomes expensive. Global atomic work also contributes, though the paper describes its effect as smaller.
Retrieval remains competitive with binary search up to that region. The authors explicitly identify better performance at higher multiplicity as unresolved. The experiment therefore supplies both a favorable operating range and evidence against treating repeated-key hashing as uniformly efficient.
Surface intersection
The surface application refreshes and queries the structures every frame. Input point clouds are transformed, assigned to voxels, compacted into unique occupied cells, and associated with per-cell information such as normals and classification state.
An occupied cell checks its 6 grid neighbors and queries the other surface’s hash structure. Cells occupied by both surfaces mark intersections. Neighboring cells receive tentative inside-or-outside classifications based on a dot-product test, and a flood-fill procedure propagates those classifications across the surface.
For point clouds of roughly 160k points, the authors normally use a grid with 128 cells along each axis. One demonstrated dataset uses 256 along each axis. The reported frame rates are 25–29 fps, with intersection and flood filling taking 15–19 ms.
The paper states that rendering consumes most of the frame time in these examples. Thus the application shows that repeated construction fits into an interactive pipeline, while also illustrating why hash timings alone do not describe the whole frame.
Geometric image matching
The geometric hashing application extracts edge features with a Sobel filter and uses pairs of features as coordinate bases. Other feature points receive quantized coordinates relative to each basis. Matching coordinate codes connect possible reference-image bases to query-image bases, and votes accumulate for promising correspondences.
The application uses both repeated-key hash storage and two-way indexes. A coordinate code may refer to many reference bases, while compact basis positions address a dense vote array. The complete comparison replaces these lookup structures with sorted-list alternatives while retaining the matching procedure.
Geometric matching, average time per frame
The hash-based version is faster across the reported matching datasets.
The numbers
| System or setting | ms |
|---|---|
| Persepolis, binary search | 2858 |
| Persepolis, hash (this paper) | 2377 |
| Kremlin, binary search | 4969 |
| Kremlin, hash | 3025 |
| Taj Mahal, binary search | 1735 |
| Taj Mahal, hash | 1437 |
| Easter Island, binary search | 2095 |
| Easter Island, hash | 1721 |
The associated repeated-key tables contain approximately the item counts printed as ∼3M for Persepolis, ∼4M for Kremlin, ∼440K for Taj Mahal, and ∼550K for Easter Island. These are counts of inserted key-value records, not distinct coordinate codes.
The application is much more demanding than unique random-key lookup. Kremlin averages 105 values per key and reaches a maximum of 5813. The Persepolis example averages 18 and reaches 947. Such uneven lists increase the work performed after a successful lookup.
For the Figure 8 case, construction of a table containing 3.02 million items requires 44 ms. The authors describe this as roughly twice the time needed for a comparable unique random-item input. Nevertheless, repeated retrieval makes faster addressing valuable.
Voting is the largest part of matching time. Hashing improves the path to the relevant records and vote positions; it does not remove the need to process candidate correspondences or coordinate concurrent vote updates.
What the ablations show
The paper does not present a systematic ablation suite that removes each design component independently; it offers implementation comparisons, parameter experiments, stage profiles, and workload analyses.
Where construction time goes
The stage breakdown on random voxel data is important because aggregate construction time alone hides different scaling behavior. Most stages grow roughly linearly with input size. The initial bucket-assignment stage has a ramp-up cost that weighs more heavily on smaller datasets.
The authors connect that initial cost to the construction disadvantage below 5 million items in the plotted comparisons. At larger sizes, its relative importance diminishes and local cuckoo construction becomes the most expensive stage.
This analysis supports the claim that the hybrid is practical at scale, but it does not isolate the contribution of every implementation decision. In particular, it is not a controlled comparison between the hybrid and an equally optimized full-size global-memory cuckoo implementation.
Coalesced writes are not automatically faster
The authors examine whether completed cuckoo tables should be written out through contiguous accesses. Such accesses normally appear attractive because neighboring threads can cooperate in moving adjacent memory.
Their implemented comparison favors writing only occupied positions, even though those writes are uncoalesced. This observation shows why access regularity cannot be evaluated independently of the amount of work performed.
The paper does not supply a general rule that irregular writes are better. Its narrower result is that avoiding unnecessary output work wins in this particular comparison. A careful transfer would test the complete operation instead of assuming that one memory-access property determines speed.
Larger buckets buy occupancy at a construction cost
Preliminary experiments increase the number of items handled by a bucket to 1024. The authors report an overall load factor of 75% under that setting, compared with the standard 71%.
Retrieval changes only modestly, while construction becomes slower. The denser local tables require more work to place their contents. This comparison exposes a real design choice: a table can save storage while making refreshes more expensive.
Because the experiment is described as preliminary, it should not be elevated into a comprehensive parameter study. The paper does not establish that either capacity is optimal for all workloads, nor does it fully map the space between occupancy and construction effort.
Multiplicity changes the algorithm’s behavior
The repeated-key sweep is a controlled input analysis. It shows that input record count alone is insufficient to predict cost. The number of distinct keys, their repetition, and the work required to arrange associated values all matter.
Moderate repetition makes cuckoo placement easier because duplicate copies share a successful slot. Heavy repetition eventually makes value organization and atomic updates dominate. The same implementation can therefore benefit from duplication in one regime and suffer from it in another.
The image-matching examples extend this analysis to uneven real application lists. Reporting both average and maximum list sizes makes visible a workload feature that a single average would conceal.
Restarts reveal the cost of unfavorable assignments
For 1 million random items, bucket overflow occurs in 22 out of 25,000 trials, reported as 0.088%. In those cases, average construction time rises from 9.78 to 14.7 ms.
For 5 million items, the paper reports 125 restarts in 25,000 trials, or 0.5%. The corresponding construction time rises from 35.7 to 49.4 ms.
These measurements distinguish routine success from recovery. They also show why the paper’s expected fast behavior should not be read as a strict latency guarantee. The restart path remains correct, but it performs additional distribution and construction work.
The alternatives expose different priorities
PSH supplies a storage-oriented comparison with similar retrieval behavior but much slower construction. Sorting supplies a compact representation with competitive preparation and more expensive random lookup.
Neither comparison proves that the hybrid dominates every alternative. Instead, they identify the circumstances that make it appealing: data that changes frequently enough for construction to matter, receives enough random queries for lookup to matter, and can tolerate spare capacity.
The application comparisons strengthen that interpretation because they preserve work beyond simple lookup. They demonstrate practical gains while revealing that other stages, especially voting, can remain dominant.
Limitations
Limits stated by the authors
Storage efficiency is an explicit limitation. Every bucket reserves the same local table capacity even when it contains fewer keys. That is especially wasteful when input records include many duplicates: the outer allocation follows total records, while local occupancy depends on distinct keys.
The authors propose dynamically sized tables as future work. Such tables could use space more efficiently, but would require additional information to locate each bucket’s storage during construction and lookup. The paper therefore recognizes that tighter packing brings an addressing cost rather than offering a free improvement.
Shared-memory capacity constrains the local problem size. Larger buckets can improve occupancy, as the preliminary experiment indicates, but they also make construction harder. The chosen settings are an engineering balance for the reported implementation.
Restarts are another stated limitation. Changing the outer bucket assignment can require repeating substantial work. The repeated-key and compaction variants have an additional difficulty because distinct-key populations are not known before local construction has been attempted.
The authors discuss multiple-choice assignment at the outer level as a possible improvement. Choosing a less-loaded bucket could reduce extreme populations and improve space use. However, retrieval would then need to consider more outer possibilities. The proposal trades a simpler construction distribution against a larger lookup search space.
Ordered retrieval is a separate weakness. Hashing deliberately disperses records, which can undermine locality when an application wants a sorted sequence. The paper argues that sorted storage may be preferable for sequential access, especially when parallel binary searches have favorable branching and coalesced reads.
High multiplicity remains unresolved. The repeated-key method eventually spends too much time organizing values and coordinating atomic updates. The geometric application further demonstrates that large value lists can make work after lookup expensive even when locating the key is fast.
The image-matching algorithm also has an application-specific failure mode. Dense edge regions may produce misleading correspondences because they can match many query curves. Faster hashing does not establish that the best vote is a correct image alignment.
Limits visible in the experimental setup
The measurements come from a particular GPU, software environment, and implementation. They establish feasibility and tradeoffs under those conditions. They do not determine performance on every parallel architecture or justify carrying the reported crossover points unchanged into another system.
The main retrieval benchmarks search stored voxels in random order. That is appropriate for evaluating successful random access, but it does not provide a complete characterization of workloads dominated by absent keys. Though the lookup procedure checks a bounded set of candidates for absence, the experimental results should not be expanded into an unreported negative-query benchmark.
The basic algorithm assumes distinct integer keys. Repeated keys require the separate method, and more complex identifiers would require an encoding or additional representation choices. The paper does not establish a general-purpose solution for every key and payload type.
Construction is randomized and may restart. The authors average over repeated timings and separately study overflow events, which is useful evidence. However, those averages do not constitute a comprehensive account of latency variation or a deadline guarantee for an interactive system.
The theoretical discussion is also deliberately incomplete for the implemented choice count. The authors explain that tight insertion bounds for the relevant cuckoo setting are difficult and select capacities in part through CPU simulation. The reported practical success should therefore remain distinct from a proof of the same behavior for every input.
The representation is designed around rebuilding rather than efficient ongoing mutation. Its application results do not establish a concurrent mutable dictionary that accepts arbitrary insertions and deletions while unrelated queries continue. That would require additional update semantics and measurements.
The spatial classification procedure includes a conflict check, but it is not presented as a complete geometric correctness proof. Its initialization uses approximate information from a voxelized surface, and the authors acknowledge that erroneous initialization can produce wrong propagation. The successful examples show usefulness, not universal robustness.
The geometric matching procedure reduces its candidate basis set through sampling and distance restrictions. The authors report that their sampling choice did not harm quality in the tested examples. That observation does not guarantee recovery of every valid correspondence, especially given the stated dense-edge failure mode.
Finally, the experiment set does not establish a single best representation independent of workload. Some applications may query a static structure many times, others may rebuild it constantly, and still others may need ordered iteration. The paper’s strongest conclusion is that its hybrid occupies a useful point among those competing requirements.
What came after
The paper ends by identifying several directions rather than presenting a finished general solution. Variable-sized local tables could improve occupancy. A multiple-choice outer distribution could reduce overload. Repeated-key construction could be redesigned for large value lists, while aggregation operations such as counting or averaging could justify variants that avoid preserving every value separately.
These are the authors’ proposed extensions. They should not be described as completed follow-up results. No later citing study is identified here with enough evidence to explain its method, measurements, or relationship to this construction.
What the paper does establish is a concrete research agenda: evaluate sparse GPU structures through construction, access, and storage together; organize repeated coordination around local memory; and specialize representations according to the operations their applications require. Any claimed successor would need to show which of these constraints it changes and measure the resulting tradeoff.
Cite
Cite as Dan A. Alcantara, Andrei Sharf, Fatemeh Abbasinejad, Shubhabrata Sengupta, Michael Mitzenmacher, John D. Owens and Nina Amenta. 2009. Real-Time Parallel Hashing on the GPU. ACM Transactions on Graphics 28(5) (SIGGRAPH Asia 2009).
@article{alcantara2009real,
title = {{Real-Time Parallel Hashing on the GPU}},
author = {Dan A. Alcantara, Andrei Sharf, Fatemeh Abbasinejad, Shubhabrata Sengupta, Michael Mitzenmacher, John D. Owens and Nina Amenta},
journal = {ACM Transactions on Graphics 28(5) (SIGGRAPH Asia 2009)},
year = {2009},
doi = {10.1145/1618452.1618500},
url = {https://doi.org/10.1145/1618452.1618500}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/alcantara-2009-real-time-parallel-hashing-gpu/