A Dynamic Hash Table for the GPU
Paper · 2017 · Saman Ashkiani, Martin Farach-Colton and John D. Owens
Summary
A hash table on a graphics processing unit can answer many lookups in parallel. The harder problem is keeping it up to date while those lookups are running. In the GPU hash tables that Ashkiani, Farach-Colton, and Owens use as their starting point, a change to the input can require rebuilding the table, and some other mutable GPU structures handle changes in a separate phase. The authors design slab hash so that insertions, deletions, and lookups can coexist. Their starting point is a hardware constraint. A GPU executes threads in groups called warps, and a warp makes efficient use of memory bandwidth when its threads access neighboring locations. A conventional linked list sends each thread from one independently located node to the next. The paper asks how to make a mutable list work with the way warps execute and read memory. GPU & parallel computing
The authors give each hash bucket a linked list whose nodes, called slabs, hold several entries and a shared pointer to the next slab. When threads have different requests, the warp chooses a request and works on it together. Its threads load neighboring portions of the same slab, then communicate within the warp to find a matching key, an available slot, or the address of the next slab. An insertion can extend a bucket by attaching a slab at runtime. A deletion marks an entry so that searches skip it, and a separate compaction pass can reclaim space. SlabAlloc, the paper’s allocator, uses the same cooperative approach to reserve fixed-size slabs on the GPU.
On an NVIDIA Tesla K40c, the slab hash reaches peak bulk rates of 512 M insertions/s and 937 M queries/s. The fastest results come at 19–60% memory utilization, and rates drop sharply at about 65%, where traversing beyond a bucket’s first slab becomes more common. CUDPP’s static cuckoo table leads on the geometric means across memory utilizations in the fixed-size bulk experiment, while slab hash comes closer in parts of that range. The advantage shifts when new entries arrive periodically. With batches of 32k entries, slab hash’s reported final speedup is 17.3x over repeated cuckoo-table builds. In concurrent workloads, it also outperforms the earlier lock-free hash table used for comparison. For the tested allocation pattern, SlabAlloc reports 600 M slabs/s, about 37x the rate of Halloc. Together, the experiments show where the cost of maintaining a mutable table is modest and where avoiding repeated builds makes the largest difference.
Deep dive: A Dynamic Hash Table for the GPU
Slab hash lets a GPU insert, delete, and look up keys concurrently by sharing work across threads and storing bucket entries in slabs. · about 37 minutes to read
The problem and its context
A table that changes while it is being read
A hash table finds a record by transforming its key into a location to inspect. It is useful when the caller already knows the key and wants the associated value, or simply wants to know whether the key exists. The GPU setting considered here adds a second problem to that basic job. Many callers can arrive at once, and the operations can ask different things of the table. A lookup needs to see whether a record is available. An insertion needs a place to put a record and may have to acquire additional storage. A deletion must change what later lookups can find. The paper asks how those actions can proceed on the same structure without assigning each kind of work a separate execution phase.
The authors describe rebuilding as a common way to handle changes to GPU data structures. A bulk build takes the input records together and arranges them into a new structure. That works naturally when the caller has the complete input at the outset. When a table is already populated and more records arrive, the same interface makes the old records part of the next build as well. The authors also point to cuSTINGER as an example of phased mutation. Its graph can change over time, with updates and lookups assigned to different phases. Slab hash targets an interface where an insertion, a deletion, and a lookup can be in flight together.
Why a conventional linked list is awkward on a GPU
The paper considers a linked list because it can grow in pieces. Each node contains its data and a pointer that tells a traversal where to go next. A node can be prepared in available memory and then linked into place. For concurrent updates, the crucial primitive is compare-and-swap, or CAS. It compares a memory location with an expected value and changes that location only if the comparison succeeds. If competing callers try to change the same link, the comparison gives each caller a way to tell whether its view of that link was still current when it tried to write.
That approach addresses how to coordinate changes. The GPU also makes the cost of reaching a node important. The paper describes an NVIDIA warp as a group of 32 threads executing in lockstep. If different threads encounter different branches of the same code, the warp executes those paths in turn. The authors call this branch divergence. Threads within a warp can also issue accesses to different locations. Contiguous, suitably aligned accesses can be combined, or coalesced, in a way that scattered accesses cannot. In the arrangement described by the authors, a warp in which every thread reads a neighboring 32-bit word covers 128 bytes.
Giving each thread its own traversal can therefore create difficulties in both execution and memory access. The thread looking for a key might find it in its current node. Its neighbor might have to keep going, and another thread might already be trying to attach a new node. Even when several threads all need another node, the addresses they follow may have little to do with one another. The next node on a particular path is known only after the current node has been read. Changing how fields are laid out inside a node, or fetching a contiguous block into shared memory, offers little help when the records that matter to a traversal are scattered individually. The authors also expect fine-grained locks to contend heavily when large numbers of GPU threads are active, which motivates their use of non-blocking list techniques.
The designs the authors compare against
The main static point of comparison is the open-addressed cuckoo table developed by Alcantara and colleagues. Open addressing places entries in slots of the table itself. The paper describes a favorable cuckoo insertion as needing a single atomic operation and a favorable search as needing an ordinary memory read. Those paths make the design a demanding baseline for constructing a table and then querying it. The authors also note that higher load factors increase the risk that a cuckoo build fails. Load factor here refers to how much of the table’s capacity is occupied. The authors use the CUDPP implementation for their bulk comparisons. Real-Time Parallel Hashing on the GPU
The paper mentions Robin Hood hashing and stadium hashing to put that choice in context. In the account it gives, the Robin Hood scheme favors higher occupancy and spatial locality for graphics workloads, with a performance cost relative to cuckoo hashing. Stadium hashing uses a pair of tables and is aimed mainly at tables that cannot fit in the memory of a single GPU. Slab hash’s bulk comparison concerns a general-purpose table that fits on the device. The different aims of these earlier designs matter because a favorable benchmark for one of them need not exercise the same tradeoffs.
The closest earlier concurrent baseline comes from Misra and Chaudhuri. Their chained GPU table supports simultaneous insertion, deletion, and search with conventional lock-free lists. Its storage is reserved in an array sized for future insertions, so its list operations run within storage determined in advance. The slab hash design takes on the additional task of obtaining nodes at runtime. The authors also discuss Moscovici and colleagues’ GPU-friendly skip list, which uses locks and aims to coalesce memory accesses. On the CPU side, they cite a locality-conscious linked list that groups individually linked entries into larger chunks. That earlier design shows how placing records together can aid traversal. Slab hash uses a common successor pointer for all entries in a group, making the group itself the unit of traversal.
Earlier GPU allocation methods present a related mismatch. CUDA provides device-side malloc, and specialized allocators manage large pools from which they reserve smaller regions. The paper describes Halloc and CMalloc as performing best when several requests from a warp can be combined into a larger allocation. With slab hash, a request for more storage may arise only after the warp has followed the current bucket to its end. The next request for more storage may come from a different operation later in that warp’s lifetime. The allocator must therefore serve requests as the traversal exposes them. The method ties the shape of each list node, the scheduling of requests, and the size of allocations to that execution pattern.
The method, step by step
Put several entries behind each link
The slab list changes what a pointer connects. Each node is a fixed-size slab with room for multiple entries and a link to a successor slab. The entries are unordered within the slab. When the warp arrives at a slab, its threads can inspect the entries together, so finding a key there requires a parallel comparison followed by a way to identify which comparisons succeeded. If the key is absent from that slab, the warp gets the successor address from the thread that read it. The address can still lead to a distant part of memory. Within each visit, however, the warp reads a contiguous region and inspects several potential matches before it needs another address.
Sharing the successor pointer also changes the space occupied by list metadata. A conventional list pays for a pointer alongside each record. The slab list pays for a pointer per group of records. The authors describe the reduction in pointer overhead as approximately a factor of M when a slab holds M entries. The qualification matters because an actual slab can have unoccupied slots and can reserve room for additional metadata. Good occupancy within each slab and short lists across the table are separate goals. How closely the design can approach both depends on the number of buckets and how keys are distributed among them.
The implementation uses slabs of 128 B. A lane is the position of a thread in its warp, and the paper also uses the word for the corresponding portion of the slab. Lanes 0–29 hold data. The slab can store 32-bit key-only entries or 64-bit key-value entries. In the key-value layout, the even data lanes hold keys and the neighboring odd lanes hold values. Lane 31 contains the address of the next slab. Lane 30 is reserved for auxiliary information, such as flags or pointer information when needed. When the data lanes are full, the paper puts maximum memory utilization at about 94%. At lower occupancy, empty entry positions have to be counted too.
Give each bucket a base slab
Slab hash applies hashing before it does any list traversal. It has an array of base slabs, one for each bucket. The hash function maps a key to a bucket. Keys that map to the same bucket are handled by the same slab list, a collision-resolution method called chaining. The base slab can be reached through the array, and each extra slab in that bucket can be reached by following the link from its predecessor. In the description used for analysis, base slabs and additional slabs have the same layout. The authors note that a base slab could instead carry extra information about its list.
The paper gives the following example of a universal hash function.
To obtain \(h(k;a,b)\), take the remainder of \(a\cdot k+b\) modulo \(p\), then reduce that remainder modulo \(B\).
Here h maps the key k to a bucket. The parameters a and b are randomly chosen integers, and p is a randomly chosen prime. The product ak multiplies a by k, and + adds b. Each mod takes the remainder using the quantity that follows it. The remainder modulo B, the number of buckets, is the bucket index. = states the definition of the function, the parentheses specify the order of evaluation, and the semicolon in the function’s argument list distinguishes the key from the parameters.
The authors summarize how much data is assigned to a bucket using the average slab count.
β = n/(M B)
Here β is the mean volume of bucket data measured in units of a full slab. n is the number of stored entries, M is the number of entries that fit in a slab, and B is the number of buckets. The juxtaposition M B means multiplication, and / divides the entry count by that product. The equality defines the quantity used in the analysis. A fractional value of β describes average demand for data slots. Each bucket still starts with a base slab, and a bucket’s actual storage is allocated in whole slabs. Some buckets can overflow while others have space left over.
For a lookup that finds no match, the paper gives the following access bound.
Θ(1 + β)
Θ denotes the asymptotic order of the memory-access count. The 1 accounts for the baseline work of checking a bucket, and β describes the average amount of data assigned to it. The + includes both contributions. The paper gives the same asymptotic behavior for successful searches, with some saving because a successful lookup can finish as soon as it finds the relevant entry. Physically, each additional slab visited adds another step to a chain of dependent memory reads. The equation is an average description under the paper’s hashing assumptions. The path of an individual lookup depends on the slabs in its bucket and, for a successful search, the match’s location.
The general space calculation starts with the size of a slab that contains room for M entries and a successor pointer.
M x + y
M is the number of entry positions in the slab, x is the number of bytes per entry, and y is the number of bytes for the pointer in this layout. M x is the product of the number of positions and the size of each position, and + adds the pointer’s storage. This expression describes the general layout before the specific lane assignments and auxiliary lane of the implementation.
n x/((M x + y) ∑ᵢ₌₀ᴮ⁻¹ kᵢ) ≤ M x/(M x + y)
The left side is memory utilization. n is the stored entry count, so the product n x is the space occupied by actual entries. M x + y is the slab size in the general calculation. kᵢ is the number of slabs assigned to bucket i. The ∑ adds those counts from bucket 0 through the final bucket, indexed by B − 1. Subtracting 1 gives the last index when indexing starts at 0. The product in the denominator is the memory occupied by the slabs, including their pointers and empty slots. / forms a fraction, and ≤ gives the upper bound to the right. The upper bound is the portion of a completely filled slab that its entries occupy. An open-addressed table in the comparison has no per-slot list pointers, so its corresponding utilization is its load factor.
The initial bucket count consequently serves two purposes. It determines how much space is immediately reserved for base slabs, and it influences how often a bucket must extend its list. Increasing the number of base slabs for a fixed input tends to leave more entries in their first slab. A smaller base array gives more opportunities to fill slabs densely, with longer traversals as buckets grow. Adding storage to a bucket does not add buckets to the array. That distinction is central to interpreting the utilization experiment.
Turn a warp’s pending requests into shared work
The paper calls the scheduling method warp-cooperative work sharing, or WCWS. Each participating thread starts with a request of its own. The request includes a key, and an insertion also supplies a value. A request’s thread is responsible for receiving the result or recording that the job is finished. The warp as a group performs the memory reads and comparisons for the chosen request. When it finishes, it takes another pending request from the same group. Other warps can be handling their own requests at the same time.
A ballot is a warp instruction that collects a condition from each lane into a bit mask. The warp first uses a ballot to ask which threads have outstanding work. That mask is its local queue. The selected request’s owner is called the source lane. The paper gives choosing the first set bit as an example of selecting the next owner. A shuffle is a warp instruction that lets lanes read a value from another lane. A shuffle broadcasts the source lane’s key, so the whole warp can use the same bucket index. The warp then assigns each lane a portion of the current slab to read.
How a warp handles requests in slab hash
The steps in order.
The queue and the slab traversal have different jobs. The queue tells the warp whose request to work on. Traversal state tells it where to continue that request. While the queue is unchanged, a new iteration can follow the successor of the slab just read. When a request finishes and a different one takes over, the warp starts at that key’s base slab. This is how cooperative processing covers both a short request that resolves at the head of a bucket and a longer request that needs several visits.
The authors identify three conditions that make the arrangement suitable. Requests may come from independent threads and have irregular behavior. The data needed at a given step should fall in a contiguous region even when that region is at an arbitrary address. Finally, a warp should be able to divide the work within that region and assemble the answer using warp communication. The slab is designed to satisfy the memory and communication conditions. Cooperation keeps the lanes together on the same traversal path. It also requires the lanes to participate in the collective instructions even when only a subset owns pending requests.
Look for a match and return the result
A search begins at the base slab. Each lane reads its word, and a ballot identifies the lanes whose words equal the broadcast search key. A mask restricts those comparisons to positions that really hold keys. That restriction matters in the key-value layout because a value or an address can contain the same bits as the requested key. In that layout, a shuffle retrieves the corresponding value from the lane next to the matching key. The source lane receives the result and clears its pending status.
When there is no matching lane, the warp gets the successor from the address lane. A populated successor address sends the warp to another slab. An empty successor means the search has exhausted the bucket, so the source lane records absence and clears the request. The abstract interface also describes a search that returns every instance of a key. That request continues scanning the list after finding a match. Short-circuiting at a match is therefore a property of the single-result search, while the all-results operation traverses the chain to collect any additional matches.
The paper presents the logical operations using S for the stored collection. These expressions describe changes to its contents. In the duplicate-permitting case, placement and multiplicity also depend on the operation’s prose description, since ordinary set notation alone does not encode the order of repeated entries.
S ← S ∪ {⟨k, v⟩}
For INSERT, S is the collection, k is the key, and v is its associated value. The angle brackets form a key-value pair, and the braces enclose the pair being added. ∪ denotes addition to the collection in the paper’s notation, and ← assigns the updated contents back to S. The operation allows another entry with the same key.
S ← (S − {⟨k, *⟩}) ∪ {⟨k, v⟩}
For REPLACE, S is again the collection, k is the requested key, and v is the new value. The * matches any value in a pair with key k. The angle brackets denote pairs and the braces group the matching entries or the new entry. − removes the matching entry, the parentheses group that removal, and ∪ adds the pair carrying v. ← makes the resulting collection the new S. This is the operation used when keys must remain unique.
S ← S − {⟨k, v⟩ ∈ S}
For DELETE, S is the collection and ⟨k, v⟩ is the selected stored pair for the requested key k and its value v. ∈ denotes membership in S. The braces delimit the entry selected for removal, − removes it, and ← updates the collection. The abstract interface describes the removed instance as the least recently inserted one. The traversal description identifies the entry by the first match it encounters.
S ← S − {⟨k, *⟩}
For DELETE ALL, S is the collection, k is the target key, and * stands for any value. The angle brackets specify matching pairs, and the braces collect all such pairs. The − removes them and ← assigns the resulting collection back to S. The corresponding traversal continues through the bucket after a match.
{⟨k, *⟩ ∈ S}
This expression is the collection sought by SEARCH ALL. Here k is the requested key, * admits any value, and ⟨k, *⟩ describes the matching pairs. The membership symbol ∈ restricts those pairs to entries in S, the stored collection, and the braces collect the results. The paper uses ⊥ to represent absence when a search finds no matching entry. For SEARCH, a matching pair ⟨k, v⟩ gives the key and value of the selected result. The operational description returns the first match in traversal order.
Insert into a slot or extend the chain
The duplicate-permitting insertion checks for an available slot as it works down the list. Finding a slot in a read of the slab gives the warp a candidate, since another warp may be trying to use the same slot. The source lane uses a CAS with the empty slot as the expected state. A successful CAS commits the pair. If the slot changed since the warp read it, the failed comparison leaves the other writer’s entry in place and the insertion looks again. For key-value entries, the implementation describes an atomic operation over the 64-bit pair, so the operation installs the key and value together.
A full slab leads to its successor if it already has one. A full tail requires a new slab. The warp obtains storage from SlabAlloc and tries to publish the slab by replacing the empty successor with the allocated address. The successor update is a 32-bit CAS in the described layout. If it succeeds, the insertion can use the attached slab. If another warp has already attached a slab, the failed publisher releases its unused allocation and continues with the now-available successor. The pair installation and the publication of a successor are distinct operations. The latter is needed only when the traversal must extend the chain.
When the caller requires unique keys, the insertion has to account for a possible existing entry. The paper’s abstract description of REPLACE searches for that key, changes an existing pair with CAS, and inserts at the tail if the key is absent. Its implementation discussion integrates the check into the slab traversal by looking for a match or a genuinely empty position. The distinction between empty and deleted slots supports this rule. If a slot vacated near the head could immediately be treated like a never-used slot, an insertion could stop there while another copy of the same key remained farther down the chain. A marker for deletion lets the traversal recognize that the vacant-looking position is part of a chain it may need to keep examining.
Delete logically and reclaim in a separate phase
Deletion uses the same cooperative read and comparison pattern as search. When the warp identifies a matching key, its source lane marks that entry as deleted. A delete for a missing key reaches the end and finishes there. With duplicates enabled, the design can mark a deleted slot empty for reuse by ordinary insertions. In the uniqueness-preserving variant, the paper separates the deleted state from the empty state. It reserves two 32-bit values in the key domain for these states. The marker lets searches ignore the deleted entry while preserving the distinctions that insertion relies on.
The markers separate the time at which an entry disappears from lookups from the time at which its space can be recovered. The paper calls the recovery operation FLUSH. It takes a bucket and compacts the live entries into fewer slabs. Extra slabs can then return to the allocator for reuse. The implementation runs that maintenance as a separate kernel, with other operations excluded from the buckets being compacted. Search and logical deletion can coexist during normal use. Rewriting a chain to release its storage follows the separate compaction procedure.
Allocate a slab with the whole warp
SlabAlloc starts from a hierarchy of pools. A large pool, called a super block, contains memory blocks, and each block contains fixed-size units that can be handed out as slabs. The counts used to describe that organization are as follows.
Nₛ Nₘ
Nₛ is the number of super blocks and Nₘ is the number of memory blocks per super block. Their juxtaposition denotes multiplication. The product counts the memory blocks available across the pool hierarchy.
Nᵤ = 1024
Nᵤ is the number of memory units per block, and the equality sets it to 1024 in this design. A memory unit is the space reserved for a slab.
A warp normally allocates from its resident block, the block assigned to serve its current requests. Several warps can have the same resident block. Each block has a bitmap recording availability, with bits corresponding to individual units. Each lane keeps a 32-bit portion of the resident bitmap in a register. Together those portions cover the block. For instance, lane 0 handles the first 32 units, while lane 1 covers units 32–63. Each lane can check whether its portion contains an available unit, and the warp can select an eligible lane using a pre-defined priority.
The local bitmap records the warp’s view of availability. To obtain a unit, the chosen lane uses CAS to change the authoritative bitmap in global memory. If the expected bitmap still matches, the allocation succeeds and the lane shares the new address with the warp through a shuffle. A competing warp can change the bitmap between the local check and the CAS. In that case the local view must be updated before trying again. The best case under low contention is a single atomic operation for a reservation. Deallocation locates the relevant global bitmap and atomically clears the bit for the returned unit.
When a resident block fills, the warp probes for another. The paper describes choosing the super block and the block within it with hash functions that take the global warp identifier and the number of attempts to change residents. The probe therefore can change even though the warp identifier stays fixed. On switching blocks, the warp loads the new bitmap with a coalesced read. The design also describes adding super blocks after a threshold number of resident changes and reflecting the additions in the address selection. This is how the allocator is meant to continue supplying fixed-size nodes as different buckets need them.
Encode the location in a shorter address
The allocator represents a slab address with a 32-bit layout. It assigns 10 bits to the unit index, 14 bits to the memory-block index, and 8 bits to the super-block index. These fields identify the slab within the allocator’s memory hierarchy. Encoding a successor this way lets the slab store the link in the address lane, and a shuffle can share the encoded link between lanes. To read the slab from global memory, the implementation turns the encoded location into a 64-bit address.
The paper gives a size inequality for storing the memory blocks and their bitmaps in a super block.
(2⁷ + 2¹⁷)Nₘ ≤ 2³² ⇒ Nₘ < 2¹⁵
Nₘ counts memory blocks per super block. In bytes, 2⁷ is the bitmap space per block, 2¹⁷ is the block’s slab storage for this calculation, and 2³² is the size bound used for the super block. The + adds the bitmap and slab storage, and the expression next to Nₘ is multiplied by it. ≤ bounds the total, ⇒ introduces the resulting restriction, and < makes that restriction strict. The address field separately gives room to identify up to 2¹⁴ blocks per super block. The superscripts denote powers of 2.
2⁷ Nₛ Nₘ Nᵤ < 1 TB
2⁷ gives the number of bytes per slab for this storage calculation, Nₛ is the super-block count, Nₘ is the memory-block count per super block, and Nᵤ is the number of units per memory block. Juxtaposition multiplies the quantities. < bounds the total by 1 TB, with TB denoting terabytes. The bound expresses the scale the address scheme is designed to support. The experiments use storage that fits on the tested device.
Regular SlabAlloc keeps the beginning addresses of the super blocks in shared memory. Decoding a link therefore includes a shared-memory lookup for the relevant starting address. The authors also implement SlabAlloc-light, which places all the super blocks in a single contiguous array. With that arrangement, one beginning address suffices to locate the slabs in the array. The tradeoff is capacity, with the light arrangement limited to about 4 GB. For lookups, the difference between the representations is paid each time a traversal needs to decode a link. For an insertion that only visits the base slab and finds a candidate slot there, the traversal already has a direct route to the slab through the bucket array.
Experiments and results
Hardware, inputs, and comparisons
The experiments run on an NVIDIA Tesla K40c with ECC disabled. The paper gives a peak memory bandwidth of 288 GB/s and 12 GB of GDDR5 memory. It compiles the implementation with CUDA 8.0. The reported hash-table insertion runs use the uniqueness-preserving REPLACE operation. The allocator configuration for the evaluation is described with 32 super blocks in a contiguous allocation, 256 memory blocks, 1024 memory units, and slabs of 128 bytes. The authors choose a contiguous allocation to compare with baselines that also preallocate a contiguous array. In slab hash, allocation at runtime refers to assigning individual slabs from the allocator’s pools as buckets extend.
The evaluation uses generated key-value inputs and lookup requests. One comparison gives slab hash and CUDPP the same entries, first for building the tables and then for querying them. Another changes how the entries arrive, delivering them in batches to exercise incremental insertion. The concurrent comparison uses randomly mixed insertions, deletions, and queries and includes the earlier table by Misra and Chaudhuri. A separate allocator test focuses on the rate of handing out slabs. The experiment that matters for interpreting a number is the one that supplies its work. Peak query throughput in a bulk run, for example, is a count of queries resolved per second under a search-only input. The concurrent throughput counts all the operations in its particular mix.
Building from scratch at different occupancies
In the fixed-size bulk tests, each trial stores 2²² entries. CUDPP can receive the target load factor as a parameter. Slab hash takes a bucket count, and the achieved utilization emerges from how the input occupies the bucket lists. The authors use the relationship between average slab count and utilization to choose the bucket count, then compare with cuckoo hashing at the same utilization and on the same inputs. They average over 50 independent random trials.
A bulk build in slab hash uses the ordinary insertion mechanism. Threads receive pairs from the input array and insert them into the table, with slab allocations occurring when buckets need more room. There is no separate placement algorithm for a bulk build in this implementation. It is a large batch of the same kind of insertion that can also be issued against a populated table. CUDPP uses its own bulk construction procedure. Comparing build rates under equal utilization therefore compares how the two systems construct tables of a similar memory efficiency from the same records.
The paper tests lookup performance with 2²² queries per case. In search-all, every requested key is present. In search-none, every requested key is absent. Both are bulk workloads on a previously built table. The names denote the composition of the query set. Each lookup still asks for the result associated with its own key. This differs from the operation named SEARCH ALL, which collects all entries matching a particular key in the duplicate-permitting interface. In a bulk search, the slab implementation can assign multiple queries per thread before writing results to the output array.
Slab hash’s strongest bulk performance occurs between 19–60% memory utilization, which the paper associates with an average slab count of 0.2–0.7. Its peak rates in the bulk experiments are 512 M insertions/s and 937 M queries/s. The authors connect this favorable regime with a high share of operations that can be settled within the base slab. An insertion that finds a slot there needs the initial slab read and the atomic write of the entry. A search that finishes there reads the slab and uses warp instructions to decide what to return. Traversals that follow additional links add dependent memory reads to these paths.
At about 65% utilization, insertion and query rates drop sharply. The paper associates that part of the curve with an average slab count around 0.9–1.1 and more visits to successor slabs. This decline occurs well below the approximately 94% utilization possible with the chosen lane layout. The two values describe different properties. The upper figure is about how much slab memory can hold data. The drop in throughput is about the additional search and insertion work caused by the occupancy that produces longer chains.
The authors describe slab hash as especially competitive with cuckoo hashing around 45–65% utilization. They report a marginal insertion advantage at 65% and a 1.1x advantage in their discussion of searches for absent keys in that region. Across all the utilizations in the fixed-size experiment, the geometric means favor CUDPP. It is 1.33x as fast for construction, 2.08x as fast for search-all, and 2.04x as fast for search-none. The local comparisons and the geometric means answer different questions about the same evaluation. A local result shows what happens at a selected occupancy. The geometric mean summarizes relative performance across the collection of tested occupancies.
Changing the size of the table
The authors also vary the number of stored entries. The figure and the setup paragraph identify the utilization for this experiment as 60%, corresponding to an average slab count of 0.7. Each search workload has as many queries as stored entries, with present-key and absent-key cases again considered separately. The point of fixing utilization here is to examine what changes as the problem grows while aiming for a similar degree of occupancy.
At small sizes, CUDPP’s build rate is high. The authors attribute that behavior to many atomic operations being served at the cache level. They identify the range from 2²⁰ through 2²⁴ stored entries as one in which slab hash saturates the device’s resources and bulk-build performance is roughly similar for the compared methods. As table sizes become very large, both methods slow, with the slab hash decline starting earlier. The paper reports harmonic mean query rates of 861 M queries/s for search-all and 793 M queries/s for search-none across the size experiment.
The same discussion reports geometric mean CUDPP-to-slab-hash speedups of 1.19x for bulk build, 1.19x for search-all, and 0.94x for search-none. The sentence giving those ratios identifies the utilization as 65%, while the figure and the description of the size sweep give 60%. Those are the paper’s two labels for the setting, and the exact utilization associated with the reported ratios is unclear. In either reading, these ratios are identified as aggregates over table sizes. The fixed-size experiment’s ratios are aggregates over memory utilization.
Adding records to a populated table
In the incremental test, new entries arrive periodically until the table contains 2 million elements. CUDPP rebuilds after each batch. Slab hash inserts the arriving batch into its existing buckets. For CUDPP, the paper fixes the load factor at 65%. It chooses slab hash’s starting bucket count so that the table reaches 65% utilization after the final batch. That matches the final occupancy for the comparison while allowing utilization to change during the incremental build.
Slab hash speedup over CUDPP rebuilding by batch size, ending at 2 million entries
Smaller batches increase the advantage of keeping the existing table.
The numbers
| System or setting | speedup x |
|---|---|
| Slab hash with 128k batches | 6.4 |
| Slab hash with 64k batches | 10.4 |
| Slab hash with 32k batches (this paper) | 17.3 |
The reported final speedups are 6.4x for 128k batches, 10.4x for 64k batches, and 17.3x for 32k batches. The two systems do different amounts of work to bring their tables up to date. Each cuckoo build includes the records already accumulated. Slab hash preserves the existing table and processes the new batch. Smaller batches cause more rebuilds before the final record count is reached, so the cost of revisiting older entries appears more frequently. The comparison measures the cost of maintaining the table through the specified sequence of arrivals. Its advantage depends on that sequence and on the static baseline’s rebuild requirement.
Mixing searches and updates
For concurrent testing, the authors begin with an initial table and generate batches of work. A batch can include a new insertion, deletion of a previously inserted element, a search for an existing element, and a search for a key absent from the table. Work is assigned randomly with one operation per thread. The benchmark processes the batches in sequence so that it can generate work with the required presence or absence conditions. The requests within a batch run in parallel, and a single warp can receive different request types. Results are averaged across batches.
The paper defines the mix using a vector and a normalization condition.
Γ = (a, b, c, d)
Γ is the operation distribution. a is the fraction of new insertions, b the fraction of deletions of previously inserted entries, c the fraction of searches for existing keys, and d the fraction of searches for absent keys. The parentheses and commas give the order of the components, and = defines the vector for a particular workload.
a + b + c + d = 1
a, b, c, and d are the same non-negative fractions. The + signs add them, and = 1 requires them to account for the entire workload.
Γ₀ = (0.5, 0.5, 0, 0)
Γ₀ is the update-only scenario, indexed by 0. In the order just defined, the components are 0.5 for insertions, 0.5 for deletions, and 0 for each kind of search. The equals sign assigns those fractions to that scenario.
Γ₁ = (0.2, 0.2, 0.3, 0.3)
Γ₁ is the mixed scenario indexed by 1. The vector gives 0.2 to insertions, 0.2 to deletions, 0.3 to successful searches, and 0.3 to unsuccessful searches. The equals sign specifies the workload, which the paper describes as 40% updates and 60% searches.
Γ₂ = (0.1, 0.1, 0.4, 0.4)
Γ₂ is the mixed scenario indexed by 2. The vector assigns 0.1 each to insertions and deletions, and 0.4 each to successful and unsuccessful searches. The equals sign defines the paper’s workload with 20% updates and 80% searches.
At a fixed initial utilization, slab hash has higher throughput in the workloads with more searches. Insertion can include an atomic operation, retries, and allocation, while a search can finish by reading and comparing entries. The concurrent rates drop sharply beyond 65% utilization, with throughput falling to about 100 M ops/s at about 90% utilization. The authors identify both the use of multiple procedures in the concurrent benchmark and its single-operation assignment as differences from the bulk setup. In bulk work, having several operations available per thread can help hide memory latency.
The concurrent comparison with Misra and Chaudhuri uses one million operations per case and varies the number of buckets. Their table stores 32-bit keys and 32-bit successor indices in preallocated nodes. The paper gives that layout a theoretical maximum memory utilization of 50%. For slab hash relative to that table, the geometric mean speedups are 5.1x with 100% updates, 4.3x with 40% updates, and 3.1x with 20% updates. These speedups concern competing implementations under the stated mixes. Slab hash’s own absolute throughput and its relative advantage over that particular baseline can move in different directions as the proportion of searches changes.
The paper also discusses results reported for the GPU-friendly skip list. The authors report roughly 100 million search queries per second and 50 million updates per second using a GeForce GTX 970 whose memory bandwidth is 224 GB/s. Ashkiani and colleagues use that comparison to discuss the operations on a favorable insertion path. The skip list has lock and unlock operations in addition to ordinary memory accesses. Slab hash’s path can consist of the slab read and a CAS for the entry. The skip-list rates come from a different device, so the paper’s operation-count argument is more directly informative about the designs than the raw throughput figures are about their relative speed under identical conditions.
Allocating fixed-size slabs
The allocation experiment uses one million requests for 128-byte slabs on the Tesla K40c, with one allocation per thread and similar total memory use across the allocators. Its purpose is to examine a request pattern where the allocator cannot depend on combining multiple simultaneous requests from a warp. The authors report 1.2s for CUDA malloc, 66 ms for Halloc, and 1.8 ms for SlabAlloc. They give the following allocation throughputs.
Allocation throughput for one million fixed-size slab requests on Tesla K40c
SlabAlloc serves the independent slab requests at the highest reported rate.
The numbers
| System or setting | M slabs/s |
|---|---|
| CUDA malloc | 0.8 |
| Halloc | 16.1 |
| SlabAlloc (this paper) | 600 |
The paper describes SlabAlloc’s throughput as about 37x that of Halloc in this setting. It attributes the result to an allocator built around fixed-size units and warp cooperation for each request. The comparison concerns handing out those units. Allocation is one element of a table operation, and many table operations finish without asking for a new slab. The bulk and concurrent table measurements include the rest of the work, such as locating the bucket, reading slabs, and committing changes to individual entries.
What the ablations show
The paper has no full component-by-component ablation of slab hash, but it varies occupancy, table size, and the operation mix, compares allocation strategies, and reports a change to slab address decoding.
Traversal length and utilization
The occupancy sweep provides the clearest test of the authors’ explanation for the fast common path. They hold the number of records at 2²² and change the bucket count to obtain different utilizations. With enough buckets, a low average slab count means many requests can stop after a coalesced read of the base slab. Increasing occupancy brings more pressure on individual buckets. When those buckets spill, a request directed there can need the successor address and a further read. The throughput change near 65% utilization occurs for both bulk insertions and bulk searches. That shared pattern supports the explanation that the cost of extra slab visits matters to both actions.
The sweep changes several properties of the same table at once. Choosing a new bucket count changes the base array, the distribution of entries among buckets, and how many slabs must be traversed. The plots therefore show the combined consequence of that design choice. They leave the exact contribution of each change unresolved. The size sweep asks a complementary question by aiming to hold utilization fixed as record counts change. Small tables favor the cache-access explanation offered for CUDPP’s build rate, while the eventual declines in both implementations show that similar occupancy can coexist with different throughput as the table grows.
Present-key and absent-key tests help distinguish whether early termination is available. An unsuccessful lookup has to traverse to the end of its bucket. A successful lookup may stop at the base slab or wherever the matching record appears. That gives the lookup cases different traversal demands even with the same table and output interface. The two cases also matter for the baseline. Relative performance depends on how both algorithms handle each kind of query, so results for search-none do not follow from the slab hash traversal alone.
Address decoding and the allocation workload
SlabAlloc-light changes how a slab address is resolved. The regular allocator uses a shared-memory lookup to obtain the base address for a super block. The light variant locates slabs relative to a single starting address because its super blocks occupy one contiguous array. The authors report up to 25% better performance with the light variant in lookup-heavy settings such as bulk search. This comparison connects a particular part of the representation to measured cost. More frequent slab lookups put more weight on the address calculation. The light version also has a lower capacity limit, so its result measures the benefit of the simpler layout in the range where that layout is available.
The allocator benchmark separately asks how the systems handle a particular request pattern. SlabAlloc can use the entire warp to choose and reserve a unit each time a request appears. Halloc and the other pooling approaches discussed in the paper are described as benefiting from requests that can be combined. The experiment with independent slab allocations supports the authors’ decision to specialize the allocator for their table. It measures the allocator as a whole under those conditions. The reported rates do not assign separate effects to the bitmap in registers, the way a new resident block is chosen, or the fixed size of the units.
Workload composition and the value of keeping state
The concurrent benchmark changes the fraction of updates while keeping insertion and deletion balanced within each scenario. Absolute throughput improves as searches become more common at a given utilization. Relative speedup over Misra and Chaudhuri is greatest in the update-only mix, with the reported geometric mean of 5.1x. Those patterns can coexist because an absolute rate depends on the cost of slab hash’s mixture, while a speedup depends on the costs of that mixture in both tables. The concurrent comparisons show the sensitivity to the operation mix directly. Isolating the cost of any particular operation would require a comparison that changes only that operation’s contribution.
The bulk and concurrent figures also expose a scheduling difference. The authors explain that the bulk setting can make several requests available to a thread and can run a single kind of procedure. The concurrent benchmark exposes requests individually and can mix procedure types within a warp. The lower concurrent rate is consistent with less opportunity to hide memory latency and more variation in work. Because the experiment changes both assignment and operation mix, it leaves the size of each effect open.
Finally, the incremental batch comparison keeps the final table size and target utilization fixed while changing batch size. The rising speedup as batches get smaller demonstrates the significance of avoiding a rebuild each time entries arrive. It also clarifies how slab hash can have its largest advantages in a maintenance workload while CUDPP leads on the average rates in the fixed-size bulk sweep. In one measurement both systems construct or search a table under similar occupancy. In the other, one system can keep the work it has already done across arrivals. The cost that changes is the work required to publish the next up-to-date table.
Limitations
Limits the authors identify
The number of buckets is a capacity choice made at the start. Slab hash can continue to attach slabs to those buckets, but the authors expect performance to degrade as more entries accumulate for a fixed bucket count. They discuss the possibility that longer lists would need additional measures, such as keeping order across slabs. The reported fast path depends on retaining short chains. High utilization is therefore an option with an access cost, and the measurements show that the cost can become pronounced before the slab layout reaches its maximum occupancy.
Physical reclamation also has its own execution condition. Logical deletes can run alongside queries and insertions. An operation that compacts a bucket and returns slabs to the allocator uses a separate kernel with exclusive access to that bucket’s contents. Consequently, a workload that repeatedly deletes and reinserts entries may need to account for compaction as a periodic cost. The marker scheme also reserves values in the key space. Applications using those values would have to accommodate the representation chosen in the paper.
The authors present the regular and light allocators with different storage assumptions. Regular SlabAlloc uses a shared-memory access as part of decoding a slab location. SlabAlloc-light removes that lookup with a contiguous allocation and has a capacity of about 4 GB. The larger figure of up to 1 TB describes the scale of the general allocation scheme. The physical memory of the experimental K40c is 12 GB. The experiments accordingly establish performance on that device and with the selected allocation configuration. They do not measure a table near the general scheme’s addressability bound.
Warp-cooperative processing also requires active participation by the lanes, including when relatively few lanes own a request. The design and concrete slab layout are motivated by the target GPU’s memory access width and communication instructions. The authors allow that the design can extend to other entry types and that the best slab size depends on the hardware. Their reported layout covers key-only entries and key-value pairs with the stated widths. Different widths or execution and access characteristics would change how the work and storage are divided.
Limits apparent from the evaluation
The inputs are randomly generated and the throughput comparisons use the specified occupancy ranges, present-key and absent-key cases, and balanced update mixes. Those tests establish behavior for the measured conditions. They leave open the costs of sustained skew towards a few buckets, uneven update patterns, or long-running workloads that need repeated compactions. A mean slab count describes the table as a whole. It gives limited information about a heavily visited bucket whose occupancy or contention differs from that average. The paper also reports rates across workloads, leaving individual request latencies and variation among buckets unmeasured.
The baseline comparisons vary in what they establish. CUDPP supplies a static baseline for building and searching, plus a rebuild baseline for the batch experiment. Misra and Chaudhuri’s structure supplies a concurrent baseline using key-only, preallocated nodes. The skip-list figures are reported on a different GPU. The measured differences can be assigned to the compared systems in their stated settings. They cannot isolate the contribution of the slab layout or establish a ranking across every design capable of mutable lookup. The disagreement between 60% and 65% in the report of the bulk size sweep further limits precise reuse of its aggregate speedup figures.
The operation descriptions also leave details for a reader seeking a full correctness specification. The duplicate-permitting interface describes single-result operations in terms of when entries were inserted, while the traversal descriptions select the first matching entry they encounter. Reusing a deleted slot can put a new entry earlier in the traversal. The paper gives no ordering mechanism that resolves those descriptions for arbitrary sequences of deletions and reinsertion. For the uniqueness-preserving case, the abstract REPLACE description includes overwriting an existing pair, while the simplified pseudocode shown in the paper illustrates the CAS for an empty destination. The prose describes the intended behavior and the figures explain the common traversal and update paths. A complete case-by-case argument for all interleavings remains outside the experimental evidence.
What came after
The paper closes by proposing the slab list as a starting point for other dynamic GPU data structures, with sparse data representation and dynamic graph analytics as prospective uses. The connection is concrete. A structure that can inspect several records in one coalesced read and extend its storage as records arrive could be useful wherever the collection changes during processing. The paper presents those applications as directions for further work. Later studies that implemented, adapted, or evaluated those directions are outside the documented record for this account.
Cite
Cite as Saman Ashkiani, Martin Farach-Colton and John D. Owens. 2017. A Dynamic Hash Table for the GPU. IPDPS 2018.
@inproceedings{ashkiani2017dynamic,
title = {{A Dynamic Hash Table for the GPU}},
author = {Saman Ashkiani, Martin Farach-Colton and John D. Owens},
booktitle = {IPDPS 2018},
year = {2017},
eprint = {1710.11246},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1710.11246}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/ashkiani-2017-dynamic-hash-table-gpu/